Appearance
Connect USR-DR154 to Autoconnecto (Modbus over MQTT)
This guide is for customers and field engineers. It shows how to connect a USR-DR154 (or similar cellular Modbus DTU) and an RS485 sensor (example: XY-MD02 temperature/humidity) to Autoconnecto without a PC left in the field.
This is connectivity profile P1 (cloud Modbus + 4G serial tunnel). Other paths — ESP32 WiFi edge, Ethernet Modbus, native MQTT — are in Connectivity profiles.
Engineer / transport contract details live in the backend doc: backend/docs/MODBUS_TUNNEL.md.
What you are building
Autoconnecto is the Modbus master in the cloud. The DR154 only moves bytes between MQTT and RS485.
text
Autoconnecto --MQTT TX--> DR154 --RS485--> Sensor (slave)
Autoconnecto <--MQTT RX-- DR154 <--RS485-- Sensor| Piece | Role |
|---|---|
| Modbus gateway in Autoconnecto | Owns the MQTT token and connection mode |
| Child device (e.g. ht1) | Owns Modbus slave ID, register map, auto poll, telemetry |
| DR154 | MQTT client + RS485 bridge (not the Modbus master) |
| Sensor | Modbus RTU slave on the bus |
Do not use DR154 HTTPD Client or Transparent TCP as the primary path for this setup. Use MQTT mode.
Before you start
You need:
- Autoconnecto account with access to Gateways and Devices
- USR-DR154 (or equivalent) with cellular SIM and power
- RS485 sensor (XY-MD02 example below)
- Vendor AT / config tool for a one-time modem setup
- Correct APN for your SIM (e.g. Jio often needs
jionet)
Confirm UART expectations for your sensor (XY-MD02 default: 9600 8N1).
Part A — Autoconnecto setup
1. Create a Modbus gateway
- Open Gateways (or create a device marked as Modbus gateway).
- Create a gateway named e.g.
htgateway. - Open the gateway page.
- Copy the Gateway token (shown on the gateway page with a Copy button).
You will paste this token into the DR154 as MQTT username, password, and client ID.
2. Set connection mode to MQTT serial
On the gateway Setup card:
- Keep connection on MQTT (cellular DTU) (default recommended path).
- Confirm the page shows:
- Gateway token
- Subscribe topic:
devices/<GATEWAY_TOKEN>/modbus/tx - Publish topic:
devices/<GATEWAY_TOKEN>/modbus/rx - Broker:
mqtt.autoconnecto.in:8883
- Click Save setup.
Advanced options (Direct LAN, outbound tunnel, edge role) are under Advanced — not needed for cellular DR154.
3. Add a child device (sensor)
- On the same gateway page, click Add device.
- Name it e.g.
ht1. - Set Modbus slave ID to match the sensor (XY-MD02 factory default is often
1). - Create the device.
- Open the child device.
4. Configure the register map (XY-MD02 example)
On the child Modbus setup panel:
| Telemetry key | Address | Register | Type | Scale | Offset | Unit | Every (s) |
|---|---|---|---|---|---|---|---|
temperature | 1 | INPUT | int16 | 0.1 | 0 | °C | 5–30 |
humidity | 2 | INPUT | int16 | 0.1 | 0 | %RH | 5–30 |
Steps:
- Set Modbus slave ID (e.g.
1). - Add register for temperature and humidity as above.
- Click Save map.
- Toggle Auto poll On (it saves immediately).
- Or click Read now for a one-shot test.
Telemetry appears on the child device Telemetry tab (not on the gateway).
Part B — DR154 modem setup (one time)
Use the vendor tool / AT console. Enter command mode (+++ then a when prompted, or your tool’s equivalent).
Required settings
| Setting | Value |
|---|---|
| Work mode | MQTT (not Transparent, not HTTPD) |
| MQTT broker | mqtt.autoconnecto.in |
| MQTT port | 8883 |
| SSL | ON (auth typically NONE unless you install certs) |
| MQTT user | Gateway token |
| MQTT password | Gateway token |
| MQTT client ID | Gateway token |
| MQTT version | 4 (if the modem asks) |
| Subscribe topic | devices/<GATEWAY_TOKEN>/modbus/tx |
| Publish topic | devices/<GATEWAY_TOKEN>/modbus/rx |
| UART | 9600, 8, 1, NONE (match sensor) |
| UART pack time / length | e.g. 50 ms / 1024 (vendor defaults OK if RTU frames stay intact) |
Critical rules
- Topics must use forward slash
/, never backslash\. - Token must be the full gateway device token — empty client ID causes modem errors.
- After changes, save (
AT+Son USR) and exit AT mode / reboot. - Disconnect the PC from RS485 before field operation so only the sensor is on the bus with the DR154.
Example AT sequence (USR-DR154 style)
Replace TOKEN with your gateway token:
text
AT+WKMOD=MQTT,NOR
AT+MQTTSVR=mqtt.autoconnecto.in,8883
AT+MQTTUSER=TOKEN
AT+MQTTPSW=TOKEN
AT+MQTTCID=TOKEN
AT+MQTTVER=4
AT+MQTTSUBTP=1,1,devices/TOKEN/modbus/tx,0
AT+MQTTPUBTP=1,1,devices/TOKEN/modbus/rx,0,0
AT+SSLEN=ON
AT+SSLAUTH=NONE
AT+UART=9600,8,1,NONE,NONE
AT+SOptional (if the modem keeps retrying vendor sockets or heartbeat):
text
AT+HEARTEN=OFF
AT+APN=jionet,,,0
AT+SUse the APN your carrier requires.
Wiring
- DR154 RS485 A/B ↔ sensor A/B (swap if you get timeouts; polarity matters).
- Common ground if required by the sensor / installation practice.
- Power the sensor as specified (often separate from the modem).
- Antenna + SIM seated; wait 30–60s after boot for network + MQTT.
Part C — Verify end-to-end
- Wait until the modem has cellular + MQTT (vendor LEDs / status).
- In Autoconnecto, open child device
ht1. - Click Read now.
- Expect values (e.g. temperature / humidity) and a success banner.
- Enable Auto poll and confirm Telemetry timestamps advance (about every poll interval).
If Read now works but Auto poll does not:
- Confirm Auto poll shows On after a refresh (it must be stored as
true). - Confirm register Every (s) is at least 5.
Adding a second sensor (ht2) on the same DR154
One DR154 = one MQTT pipe. Extra sensors share the same RS485 bus.
- On the gateway, Add device →
ht2. - Set a different Modbus slave ID (e.g.
2). - Configure the physical sensor address to 2.
- Copy the same style of register map on ht2 → Save map → Auto poll On.
No second modem token or MQTT topics. Autoconnecto addresses each child by slave ID on the shared bus; telemetry is stored on that child.
If two sensors share slave ID 1, responses collide and reads fail or look wrong.
Troubleshooting
| Symptom | Likely cause | What to check |
|---|---|---|
| Read now timeout | Modem not MQTT / wrong topics / bus wiring | Mode MQTT; topics with /; A/B; UART 9600; PC off the bus |
Modem ERROR on AT+SOCK… | Unused socket commands in MQTT mode | Ignore; focus on MQTT + UART queries |
Topics show \ in query | Wrong separators stored | Re-set SUB/PUB with / and AT+S |
| Auto poll UI On but no new points | Attr not saved as true | Toggle Auto poll again; refresh; confirm timestamps move |
| Works for ht1, fails for ht2 | Duplicate slave ID | Unique slave IDs on bus and in Autoconnecto |
| CME / network errors | APN / coverage | Set carrier APN; check SIM/data |
| Values wrong by 10× | Scale | XY-MD02 often needs scale 0.1 on int16 |
Mental model checklist
- [ ] Gateway token copied from Autoconnecto gateway page
- [ ] Gateway connection = MQTT serial
- [ ] Child has slave ID + register map + Save map
- [ ] Auto poll On (or use Read now)
- [ ] DR154 = MQTT + SSL 8883 + token + correct
/topics - [ ] UART matches sensor; PC removed from RS485
- [ ] Telemetry checked on the child, not only on the gateway
When this list is green, the field install is ready for soak testing (power cycles, overnight auto poll) before production rollout.
