Datasheet & User Manual · Board owledge (MODEL E02SA) ·
Document rev 1.0 · 2026-06-18
The E02 Modbus I/O Module is an ESP32-based industrial I/O device with 2 configurable analog/digital inputs and 1 PWM output. It is exposed simultaneously over Modbus TCP (Ethernet) and Modbus RTU (RS-485), sharing one register map, and is discoverable on the LAN via mDNS / Zeroconf. A supervisory platform browses mDNS, reads capability metadata from TXT records, then polls/controls the device — no static IP or manual register-map documentation required for integration.
| Parameter | Value |
|---|---|
| MCU | ESP32-WROOM-32U V2.1 (Xtensa dual-core, no PSRAM) |
| Flash | 4 MB (DIO, 40 MHz) |
| Firmware | e02_modbus v1.0.0, built on ESP-IDF 5.4 |
| Inputs | 2 × (Digital / 4–20 mA / 0–10 V), software-selectable per channel |
| Output | 1 × PWM, 1 kHz, 12-bit duty, 0–100 % |
| Ethernet | 10 Mbps, full-duplex |
| Serial | RS-485 half-duplex, auto-direction transceiver (no DE/RE pin) |
| ADC | 12-bit, ADC1, 12 dB attenuation, 16-sample averaging |
| Protocols | Modbus TCP (port 502) + Modbus RTU, concurrent; mDNS |
| Addressing | DHCP client; static IP fallback configurable |
| ESP32 GPIO | Function | Notes |
|---|---|---|
| 12 | Status LED | single colour; strapping pin (MTDI) — driven after boot |
| 14 | Config-mode button | hold LOW at boot → provisioning |
| 25 | Digital input 1 | |
| 26 | Digital input 2 | |
| 36 | Voltage input 1 | 0–10 V (ADC1_CH0) |
| 34 | Voltage input 2 | 0–10 V (ADC1_CH6) |
| 39 | Current input 1 | 4–20 mA (ADC1_CH3) |
| 35 | Current input 2 | 4–20 mA (ADC1_CH7) |
| 4 | Output | PWM (LEDC) |
Each logical input has 3 physical pins (digital / voltage / current); the active pin is chosen by the channel's mode register.
| ESP32 GPIO | ENC28J60 |
|---|---|
| 5 | CS |
| 18 | SCLK |
| 19 | MISO |
| 23 | MOSI |
| N/A | INT (not connected — driver runs in polling mode) |
| ESP32 GPIO | Function |
|---|---|
| 17 | UART2 TX → RS-485 transceiver |
| 16 | UART2 RX ← RS-485 transceiver |
| N/A | DE/RE — none (auto-direction transceiver) |
Each input's mode is set by its mode register (0=Digital, 1=4–20 mA, 2=0–10 V).
Values are reported over Modbus in engineering units:
| Mode | Reported value | Example |
|---|---|---|
| Digital | 0 / 1 (debounced, 3 consistent reads @ 10 ms) | 1 = high |
| 4–20 mA | centi-mA (mA × 100) | 2000 = 20.00 mA |
| 0–10 V | centi-volt (V × 100) | 1000 = 10.00 V |
In 4–20 mA mode a reading below ~3.5 mA sets the wire-break status flag.
The output register holds a duty percentage 0–100, driven on a 1 kHz PWM.
Writes take effect immediately. At boot and during fail-safe the output is forced to a
defined value (default 0 %).
e02-<wifi_mac_no_colon>.localedge_modbus._tcp.local, port 502TXT records (capability advertisement):
| Key | Example | Meaning |
|---|---|---|
model | e02_modbus | Device model |
fw | 1.0.0 | Firmware version |
i | 2 | Input channels |
o | 1 | Output channels |
unit | 1 | Modbus unit/slave ID |
proto | modbus-tcp | Protocol identifier |
mac | B4E62DDE225D | WiFi MAC (no colons) |
| Parameter | TCP | RTU |
|---|---|---|
| Role | Slave / Server (both run concurrently, shared registers) | |
| Transport | Ethernet, port 502 | RS-485, UART2 |
| Address | Unit ID (MBAP) | Slave address = Unit ID register |
| Default line | — | 9600 baud, 8N1 (configurable) |
| Function codes | 03 (read holding), 06 (write single holding) | |
| Byte order | Big-endian (standard Modbus) | |
RTU baud / parity / stop-bits and the unit/slave id take effect after a reboot (the Modbus controllers are created once at startup).
Read with FC 03, write with FC 06. Layout: configuration block first, then live I/O.
| Addr | Register | Access | Persist | Notes |
|---|---|---|---|---|
| 0 | Unit ID / RTU address | R/W | NVS | 1–247; effective after reboot |
| 1 | Input 1 mode | R/W | NVS | 0=Dig, 1=4–20 mA, 2=0–10 V |
| 2 | Input 2 mode | R/W | NVS | same |
| 3 | Fail-safe output value | R/W | NVS | percent 0–100 |
| 4 | Fail-safe timeout (s) | R/W | NVS | 0 = disabled |
| 5 | RTU enable | R/W | NVS | 0/1; effective after reboot |
| 6 | RTU baud / 100 | R/W | NVS | 96=9600 … 1152=115200 |
| 7 | RTU parity | R/W | NVS | 0=none, 1=odd, 2=even |
| 8 | RTU stop bits | R/W | NVS | 1 or 2 |
| 9 | Input 1 value | R | — | scaled (see §5.1) |
| 10 | Input 2 value | R | — | scaled (see §5.1) |
| 11 | Output | R/W | — | PWM percent 0–100 |
| 12 | Status flags | R | — | bitfield (below) |
| Bit | Mask | Meaning |
|---|---|---|
| 0 | 0x01 | Ethernet link / IP up |
| 1 | 0x02 | Modbus master polled recently (any transport) |
| 2 | 0x04 | Input 1 wire-break (4–20 mA < 3.5 mA) |
| 3 | 0x08 | Input 2 wire-break |
| 4 | 0x10 | Output forced to fail-safe |
| 5 | 0x20 | RTU transport enabled |
| State | LED | Meaning |
|---|---|---|
| Provisioning | Fast blink | Config mode (SoftAP portal active) |
| Initializing | Slow blink | Booting, network not ready |
| Running | Solid ON | Normal operation (Modbus serving) |
Boot sequence: init GPIO + safe output (LED slow-blink) → bring up Ethernet, acquire DHCP → start mDNS + Modbus TCP/RTU slaves (LED solid) → enter input-poll loop.
Write configuration registers (0–8) with FC 06. Config values persist to NVS. Transport/serial params (unit id, RTU baud/parity/stop/enable) apply on the next reboot; input modes, output and fail-safe values apply live.
E02-xxxxxx (password edge12345).http://192.168.4.1/ and set unit id, input modes, fail-safe,
RS-485 (enable/baud/parity/stop) and optional static IP.Toolchain: ESP-IDF v5.4, target esp32. Managed components
(esp-modbus v2.x, mdns, enc28j60) download on first build.
idf.py set-target esp32
idf.py build
idf.py -p /dev/ttyUSB0 flash monitor
Binary ~988 KB; factory partition 3.88 MB (4 MB flash, no OTA).
main/config.h are
placeholders and must be calibrated per hardware revision before field use:| Constant | Meaning |
|---|---|
ADC_MV_AT_FULL_VOLT | ADC millivolts when the 0–10 V terminal reads 10.00 V (divider ratio) |
CURRENT_SENSE_OHMS | RS sense resistor: I(mA) = Vadc(mV) / R |
CURRENT_WIRE_BREAK_CMA | wire-break threshold in centi-mA (default 350 = 3.5 mA) |
Recommended: 2-point calibration per mode (e.g. apply 4 mA & 20 mA, 0 V & 10 V) and adjust the constants so reported values match a reference meter.
| Symptom | Check |
|---|---|
| No IP / not discoverable | Ethernet cable & ENC28J60 wiring (CS5/SCLK18/MISO19/MOSI23); DHCP server present; LED stuck slow-blink = no IP yet |
| TCP master can't connect | Confirm IP (serial log), port 502 open, only the needed master polling |
| RTU no response | RTU enabled (reg 5); matching baud/parity/stop & slave address; A/B lines & ground; UART2 = GPIO17/16 |
| Analog values wrong | Calibrate ADC_MV_AT_FULL_VOLT / CURRENT_SENSE_OHMS; verify input mode register |
| Output only 0 % / 100 % | Write percent 0–100 to register 11; check fail-safe isn't active (status bit 4) |
| Can't enter config mode | GPIO14 must read LOW at boot; LED should switch to fast blink |