Appearance
ESP32 Modbus edge (WiFi MQTT)
Connectivity profile P2 — the ESP32 (or similar) is the Modbus RTU master on RS485. Autoconnecto receives normalized JSON telemetry over MQTT (or HTTP). Use this for WiFi labs, indoor pilots, and panels where a 4G DTU is not required.
Bench test: Pending — pattern is documented; per-Solution firmware maps inherit from device guides (e.g. XY-MD02, AVH) when you test. See Validation status.
This pattern applies to any Solution that lists P2 in its reference stack (Fuel, Water, Climate, Cold chain, etc.). Only the register map and telemetry keys change.
What you are building
mermaid
flowchart LR
AC[Autoconnecto MQTT]
ESP[ESP32 edge master]
BUS[RS485]
SL1[Slave 1]
SL2[Slave 2]
AC <-->|TLS 8883| ESP
ESP --> BUS
BUS --> SL1
BUS --> SL2| Piece | Role |
|---|---|
| ESP32 firmware | Modbus master, scaling, publish interval |
| Autoconnecto device | Device token; telemetry keys match Solution doc |
| RS485 transceiver | MAX485 / ISO3086 — observe sensor baud and termination |
Contrast P1: With DR154 Modbus MQTT, Autoconnecto is Modbus master and the DTU is a serial tunnel only.
Wiring (field)
mermaid
flowchart TB
subgraph Power
PSU[5V USB or 12V DC supply]
end
subgraph ESP32_board
MCU[ESP32 module]
UART[UART2]
end
subgraph RS485
XCVR[MAX485]
A[A line]
B[B line]
end
subgraph Field
SENS[Modbus sensor or meter]
end
PSU --> MCU
MCU --> UART --> XCVR
XCVR --> A
XCVR --> B
A --- SENS
B --- SENS| Connection | Notes |
|---|---|
| Power | Stable 5 V for dev boards; industrial 12–24 V where required by enclosure |
| RS485 A/B | Follow sensor manual polarity; add 120 Ω termination at bus ends if cable length > ~10 m |
| Ground | Common reference between PSU and field device per manufacturer; avoid ground loops on long runs |
| WiFi | Provision SSID once; store credentials in NVS |
Always use the sensor datasheet for terminal labels (some mark A/B, others D+/D-).
Autoconnecto setup
- Devices → Create device with the Solution device type (e.g.
ht_sensor,fuel_tank). - Copy device token from Check connectivity → MQTT.
- Firmware publishes JSON telemetry, for example:
json
{
"temperature": 24.6,
"humidity": 52
}- Keys must match the Solution reference stack for that fleet.
- Optional: create a gateway device and publish with
childDeviceIdif one ESP32 serves multiple logical devices (developer gateway relay).
Use the Device SDK for TLS MQTT to mqtt.autoconnecto.in:8883.
Firmware outline (Modbus master)
- Initialize RS485 UART (typical 9600 8N1 — confirm on datasheet).
- Poll holding/input registers per slave ID on an interval (e.g. 5–30 s).
- Apply scale/offset from manufacturer manual (same as cloud Modbus map would use).
- Publish merged JSON to device MQTT topic with device token auth.
For ClimateFleet + XY-MD02, register addresses match the DR154 guide Modbus table — reuse that map in firmware instead of cloud polling.
When to prefer P2 vs P1
| Prefer P2 ESP32 WiFi | Prefer P1 4G DTU |
|---|---|
| WiFi on site | Cellular only |
| Local logic / buffering | Minimal edge software |
| Multiple local algorithms | Cloud-owned Modbus schedule |
Safety
Mains-powered meters and genset panels require qualified electricians. This guide covers low-voltage RS485 sensor wiring only.
