Skip to content

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
PieceRole
Modbus gateway in AutoconnectoOwns the MQTT token and connection mode
Child device (e.g. ht1)Owns Modbus slave ID, register map, auto poll, telemetry
DR154MQTT client + RS485 bridge (not the Modbus master)
SensorModbus 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 ​

  1. Open Gateways (or create a device marked as Modbus gateway).
  2. Create a gateway named e.g. htgateway.
  3. Open the gateway page.
  4. 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:

  1. Keep connection on MQTT (cellular DTU) (default recommended path).
  2. 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
  3. 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) ​

  1. On the same gateway page, click Add device.
  2. Name it e.g. ht1.
  3. Set Modbus slave ID to match the sensor (XY-MD02 factory default is often 1).
  4. Create the device.
  5. Open the child device.

4. Configure the register map (XY-MD02 example) ​

On the child Modbus setup panel:

Telemetry keyAddressRegisterTypeScaleOffsetUnitEvery (s)
temperature1INPUTint160.10°C5–30
humidity2INPUTint160.10%RH5–30

Steps:

  1. Set Modbus slave ID (e.g. 1).
  2. Add register for temperature and humidity as above.
  3. Click Save map.
  4. Toggle Auto poll On (it saves immediately).
  5. 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 ​

SettingValue
Work modeMQTT (not Transparent, not HTTPD)
MQTT brokermqtt.autoconnecto.in
MQTT port8883
SSLON (auth typically NONE unless you install certs)
MQTT userGateway token
MQTT passwordGateway token
MQTT client IDGateway token
MQTT version4 (if the modem asks)
Subscribe topicdevices/<GATEWAY_TOKEN>/modbus/tx
Publish topicdevices/<GATEWAY_TOKEN>/modbus/rx
UART9600, 8, 1, NONE (match sensor)
UART pack time / lengthe.g. 50 ms / 1024 (vendor defaults OK if RTU frames stay intact)

Critical rules ​

  1. Topics must use forward slash /, never backslash \.
  2. Token must be the full gateway device token — empty client ID causes modem errors.
  3. After changes, save (AT+S on USR) and exit AT mode / reboot.
  4. 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+S

Optional (if the modem keeps retrying vendor sockets or heartbeat):

text
AT+HEARTEN=OFF
AT+APN=jionet,,,0
AT+S

Use the APN your carrier requires.

Wiring ​

  1. DR154 RS485 A/B ↔ sensor A/B (swap if you get timeouts; polarity matters).
  2. Common ground if required by the sensor / installation practice.
  3. Power the sensor as specified (often separate from the modem).
  4. Antenna + SIM seated; wait 30–60s after boot for network + MQTT.

Part C — Verify end-to-end ​

  1. Wait until the modem has cellular + MQTT (vendor LEDs / status).
  2. In Autoconnecto, open child device ht1.
  3. Click Read now.
  4. Expect values (e.g. temperature / humidity) and a success banner.
  5. 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.

  1. On the gateway, Add device → ht2.
  2. Set a different Modbus slave ID (e.g. 2).
  3. Configure the physical sensor address to 2.
  4. 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 ​

SymptomLikely causeWhat to check
Read now timeoutModem not MQTT / wrong topics / bus wiringMode MQTT; topics with /; A/B; UART 9600; PC off the bus
Modem ERROR on AT+SOCK…Unused socket commands in MQTT modeIgnore; focus on MQTT + UART queries
Topics show \ in queryWrong separators storedRe-set SUB/PUB with / and AT+S
Auto poll UI On but no new pointsAttr not saved as trueToggle Auto poll again; refresh; confirm timestamps move
Works for ht1, fails for ht2Duplicate slave IDUnique slave IDs on bus and in Autoconnecto
CME / network errorsAPN / coverageSet carrier APN; check SIM/data
Values wrong by 10×ScaleXY-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.

support@autoconnecto.in · founder@autoconnecto.in · +91 92121 00555 · app.autoconnecto.in