Pymate-Modbus-basic
Modbus is a standardized protocol over serial bus. The half-duplex RS485 bus can be used for Modbus transmission.
The Modbus over RS485 bus is available on the A+, B- terminals.
Practical example
The following example shows how to grab the data from a RS485 Wind Direction device. The Wind Direction is a Modbus device.
So the example script will rely on Modbus RTU Master (umodbus library) to read the value.
The master send the request to read register 0x0000 on slave 0x02.
The function code 0x03 = "read holding register".
From that request we do expect the following response from the device.
The data contains the angular position in degrees * 10 the value is encoded as an uint16.
The angle can be converted to wind direction thanks to simple rule:
PymateIO all right reserved © 2026 - Written by MCHobby for PymateIO



