Bring industrial Modbus sensors — rugged, multi-drop, long-run — into a grower's own data lake.
| Status | Source release — build & flash it yourself |
| Interface | RS-485 · Modbus RTU |
| Delivers | Webhook (HTTP POST) · MQTT — oat-ods/0.3 |
| Site page | openagriculturetechnology.com/build/sketches/modbus-reader/ |
| License | Apache-2.0 |
Industrial sensors speak Modbus over RS-485: rugged, multi-drop, good over long noisy cable runs. This node reads their registers and pushes each as oat-ods — the bridge from the factory-floor bus into data you own.
Modbus registers are bare numbers, so you describe them on the setup page, one line per slave:
<slave> <stream_id> <reg>:<type>:<measure>:<unit>:<scale>,...
type: h = holding register, i = input registerscale: multiplies the raw signed 16-bit value (default 1)Examples:
1 gh2-env 0:i:temperature:Cel:0.1,1:i:humidity:%RH:0.1
2 gh2-flow 100:h:flow:l/min:0.1
Each register → one oat-ods message: stream = stream_id,
physical_id = modbus:<slave>:<reg>, value = (int16)raw × scale.
An RS-485 transceiver on a hardware UART: RX, TX, and — for a MAX485 — a DE/RE direction pin (set it on the setup page; use -1 for an auto-direction module). Match the slave's baud (default 9600) and 8N1. RS-485 is multi-drop: wire many slaves on one A/B pair.
Flash (see Build), join OAT-Modbus-xxxx, open the setup page (admin /
oatsetup), set Wi-Fi + delivery + the RS-485 pins/baud + the register map.
Point delivery at the test endpoint
to confirm.
pipx install platformio # or: pip install --user platformio
cd oat-modbus-reader
./build.sh
This is a source release: it compiles against the pinned deps but hasn't
earned the bench-verified badge the live sketches carry — build it, flash it, and
prove it on your bench before you trust it in the field. Deps (pinned in
platformio.ini): 4-20ma/ModbusMaster, PubSubClient, ArduinoJson, and the
local oat_ods module.
How do I read a Modbus RTU sensor with an ESP32? Add an RS-485 transceiver (such as a MAX485) to a hardware UART on the ESP32 and use a Modbus master library to read holding or input registers. Because registers are bare numbers, you map each register to a measurement, unit, and scale factor, so the reading becomes value = raw × scale.
What is RS-485 and why use it for sensors? A rugged, differential serial bus that works over long, electrically noisy cable runs and supports many devices on one pair of wires (multi-drop). It's the common physical layer for Modbus RTU industrial sensors, which suits spread-out greenhouse or farm installations where short-range buses fail.
oat-sdi12-reader/ — the other industrial-bus bridge (research-grade SDI-12 instruments).../lib/oat_ods/ — the shared oat-ods encoder + measurand vocabulary.Shared core: this sketch carries its own copy of the config / Wi-Fi / delivery scaffolding; as the shared
oat-node-corelibrary is adopted, only the acquisition layer stays sketch-specific.
Code: Apache-2.0 · Docs: CC BY 4.0 · An OAT sketch — an OpenCDC initiative.