Transclusion: IOT-GATE-iMX8: Modbus
Revision as of 15:12, 4 January 2021 by imported>Uri.mashiach (→Modbus Communication Example)
Modbus is a standard communication protocol and is a commonly available means of connecting industrial electronic devices.
IOT-GATE-iMX8 RS485 ports can be used to implement the Modbus protocol.
It is recommended to use the mbpoll Modbus utility preinstalled in the IOT-GATE-iMX8 Debian Linux package.
Modbus Communication Example
[XY-MD02] is a high-precision temperature and humidity sensor. XY-MD02 uses the RS485 hardware interface and protocol layer compatible with standard industrial Modbus RTU protocol.
- Connect the XY-MD02 sensor to the IOT-GATE-iMX8, RS485 port:
- Connect power lines to a DC power supply 5V-30V
- Connect RS485 lines
-------------------- | | | *--(+)---< <------------- 5V-30V | | | *--(-)---< <-------------- GND ------------------------ | XY-MD02 (RS485) | | | | *--(A+)--< <---...---> >--(P7/2)---*----- | | | | P7 | IOT-GATE-iMX8 | | *--(B-)--< <---...---> >--(P7/1)---*----- | | | | | -------------------- ------------------------
- Read temperature once:
root@iot-gate-imx8:~# mbpoll -b 9600 -p none -t 3 -c 1 -r 2 -1 /dev/ttymxc0 -- Polling slave... [2]: 284
- Read humidity once:
root@iot-gate-imx8:~# mbpoll -b 9600 -p none -t 3 -c 1 -r 3 -1 /dev/ttymxc0 -- Polling slave... [3]: 453