Skip to content

ESP32 PLC - Remote Programming

ESP32 OTA Updater (Ethernet): Configuration & Deployment Guide

This guide explains how to configure and deploy an ESP32 OTA (Over-The-Air) update system over Ethernet using Node-RED. Follow the steps below to set up firmware updates over your local network.

Prerequisites

Before you begin, install the following tools:

  • ESP32 PLC: Any of our models of the ESP32 PLC Family powered within the specified range of 12-24V.
  • Arduino IDE: For compiling and uploading ESP32 firmware
  • Node-RED: For managing OTA update logic

Note

Arduino IDE setup: See ESP32 PLC - Characteristics (Initial Software Installation).

Node-RED setup: See Node-RED's website Getting Started section.

Required Files

Make sure you have these configuration files:


1. ESP32 Firmware Configuration

All configuration parameters are located at the top of the sketch, before setup().

Network Settings (Device Identity)

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x31 };  // Must be unique per device on the LAN
IPAddress staticIP(10, 10, 10, 31);   // Target static IP for this ESP32
IPAddress gateway(10, 10, 10, 1);     // Your router/gateway IP
IPAddress subnet(255, 255, 255, 0);   // Your subnet mask
IPAddress dns1(8, 8, 8, 8);           // DNS (change if using internal DNS)

Update Server Configuration

IPAddress updateServerIP(10, 10, 10, 2);   // IP of the machine running Node-RED
const int updateServerPort = 1880;         // Node-RED HTTP port (default: 1880)

HTTP Endpoints

const char* updateCheckUrl = "/esp32plc14_31/update";    // Must match Node-RED flow URL
const char* statusPostUrl  = "/esp32plc14_31/status";    // Must match Node-RED flow URL
const char* firmwareUrl    = "/esp32plc14_31/firmware";  // Must match Node-RED flow URL

Warning

Keep the endpoint paths consistent. If you rename esp32plc14_31, update it everywhere.

Firmware Version

const char* currentVersion = "0.0.2";  // Set to the version currently flashed on this device

Note

This version is reported to Node-RED for tracking purposes only.

Update Check Interval

delay(10000);  // in loop() — milliseconds between update checks (currently 10 s)

2. Node-RED Flow Configuration

Import the provided flow file into Node-RED, then complete the setup below.

Step 1: Set Firmware File Path

  • Open the file in node
  • Set the full path to your compiled .bin file:
    /home/<your_user>/firmware/OTA_ESP32_ETHERNET_31.ino.bin
    

Step 2: Define Firmware Version

  • Open the UpdateFirmware function node
  • Update the version string:
    const currentVersion = "0.0.3";
    

Step 3: Match API Endpoints

Verify that all http in nodes match your ESP32 configuration:

Purpose Endpoint URL
Update check /esp32plc14_31/update
Firmware /esp32plc14_31/firmware
Status /esp32plc14_31/status

Warning

If you changed the path in the sketch, update these nodes to match.

Step 4 (Optional): Adjust Update Window

  • Open the trigger node.
  • Default duration: 30 seconds after Node-RED restart
  • Increase if devices need more time to connect

3. Deployment & Execution

Flash the ESP32

  1. Open the sketch in Arduino IDE
  2. Update all the configuration values listed in ESP32 Firmware Configuration
  3. Compile and upload the firmware
  4. Open Serial Monitor (115200 baud)

Expected output:

ETH Connected.
Assigned IP: 10.10.10.31

Deploy the Node-RED flow

  1. In Node-RED, go to Menu → Import → Clipboard

    Note

    Node-RED menu on the webpage hosted locally located on the top right

  2. Paste the JSON or upload flows.json

  3. Complete all configuration steps in Node-RED Flow Configuration

  4. Ensure the .bin file is in the correct location

    Note

    To compile the binary (.bin) you can do so by going to Sketch → Export Compiled Binary or simply pressing Alt+Ctrl+S, as shown in the image below.

    Export Compiled Binary button on the Arudino IDE top menu under the Sketch section

  5. Click Deploy.

Enable OTA update

  1. Click the Inject true button in the flow.

    Node section of the /esp32plc14_31/update/ where the Inject true button clicked and the UpdateFirmware node green

  2. Confirm the UpdateFirmware node turns green.

Verification Checklist

Use this checklist to confirm everything is working correctly:

Component Expected Behavior
ESP32 Serial Monitor Checks for updates every 10 seconds
Node-RED (no update) Displays NO UPDATE
Node-RED (update enabled) Shows UPDATE → UPDATE SUCCESS
ESP32 after update Reboots with success message
Update flag Resets automatically (node turns red)

ESP32 OTA Updater (WiFi): Configuration & Deployment Guide

This guide walks you through setting up Over-The-Air (OTA) firmware updates on an ESP32 PLC over WiFi. Using a built-in web server embedded directly in the device, you can push new firmware wirelessly from any browser - no cables required after the initial upload.

Prerequisites

Before you begin, make sure you have the following.

  • ESP32 PLC: Any of our models of the ESP32 PLC Family powered within the specified range of 12-24V.
  • Arduino IDE: For compiling and uploading ESP32 firmware

    Note

    Arduino IDE setup: See ESP32 PLC - Characteristics (Initial Software Installation).

  • WiFi network: A stable 2.4 GHz WiFi network accessible from your ESP32 PLC.

Required Files

Download the following file before proceeding:

How It Works

The ESP32 OTA Web Updater works in three stages:

  1. Initial serial upload: The first firmware version must be flashed via the serial port. This bootstraps the OTA capability on the device.

  2. Embedded web server: Once running, the ESP32 hosts a lightweight web server accessible from any browser on the same network. This is the interface you will use for all future updates.

  3. Core OTA code requirement: Every subsequent firmware version must include the core OTA code. Uploading a sketch without it will permanently disable OTA access, requiring a serial connection to recover.

Warning

Never upload a sketch that omits the core OTA code - doing so will lock out the web interface and require a physical serial reconnection.

1. Configure the Firmware

All configuration is done at the top of the sketch, before setup().

WiFi Credentials

Replace the placeholders below with your actual network credentials:

/* Replace with your WiFi credentials **/
const char* ssid     = "YourSSID";
const char* password = "YourPassword";

Once configured, upload the sketch to the ESP32 via USB/serial. The device will connect to your WiFi network and start the OTA web server automatically.

Note

You can flash the core OTA code alone (without any application logic) to prepare the device for wireless updates later.

2. Access the OTA Web Interface

After the ESP32 boots and connects to WiFi, open a browser and navigate to one of the following:

  • IP address - Shown in the Arduino Serial Monitor at 115200 baud rate boot.
  • Local hostname - http://esp32.local (uses mDNS; may not work on all networks).

The login page will appear:

Note

ESP32 OTA login page showing username and password fields

Enter your credentials:

Field Default value
Username admin
Password admin

Warning

Change the default credentials before deploying in a production environment.

The default admin/admin login provides no security on an open network.

After logging in, the OTA upload page will be displayed:

Note

ESP32 OTA firmware upload page with file selector and Update button

3. Write, Build & Update New Firmware

Add Your Application Code

Every new firmware version must be built on top of the core OTA sketch. Insert your logic in the two designated sections:

  • /* Additional set up code here */ - runs once at the startup.
  • /* Additional loop code here */ - runs repeatedly.

Example - blink an output every second:

void setup() {
  /* Core OTA setup code */

  /* Additional set up code here */
  pinMode(Q0_0, OUTPUT);
}

void loop() {
  /* Core OTA loop code */

  /* Additional loop code here */
  digitalWrite(Q0_0, HIGH);
  delay(1000);
  digitalWrite(Q0_0, LOW);
  delay(1000);
}

Export the Compiled Binary

OTA updates require a compiled .bin file - not a .ino source file:

  1. In Arduino IDE, go to Sketch → Export Compiled Binary (or press Ctrl+Alt+S).

    Note

    Arduino IDE Sketch menu with Export Compiled Binary option highlighted

    The .bin file is saved in the same folder as your sketch.

Upload via the OTA Interface

  1. Return to the OTA web interface in your browser.
  2. Click Choose File and select the generated .bin file.
  3. Click Update.

The progress bar will track the upload. The ESP32 will reboot automatically once the transfer completes and begin running the new firmware.

Note

OTA update progress bar at 100% with success message

Monitor the Serial Monitor for confirmation messages or errors.

Verification Checklist

Use this checklist to confirm the full OTA workflow is functioning correctly:

Step Expected Result
Serial Monitor after boot Displays the assigned IP address
Browser navigation to IP Shows the OTA login page
Login with credentials Grants access to the firmware upload page
.bin file selected & Update Progress bar advances; ESP32 reboots on completion
ESP32 after reboot Runs new firmware; new IP visible in Serial Monitor
OTA web interface accessible Login page still available for the next update cycle