View Categories

Modbus RS485 RTU – Relais module 7-24VDC 1x250V/10A

Modbus RS485 RTU Relais module 7-24VDC, 1x250V/10A NO/NC

Manual #


Setup #

Setup python virtual environment and install using pip3:

python -m venv ~/venv

source ~/venv/bin/activate

pip3 install modbus_cli

Usage #

usage: modbus [-h] [-r REGISTERS] [-s SLAVE_ID] [-b BAUD] [-p STOP_BITS] [-P {e,o,n}] [-v] [-S] [-t TIMEOUT] [-B {le,be,mixed}] device access [access …]

Example with modbus_cli #

Please note: adjust serialport ” ttyS5″ to your situation, e.g. ttyUSB0

Switch Relay ON:

modbus -b 9600 -s 255 -v /dev/ttyS5 c@0=1

Shell output:

(venv) [~]: modbus -b 9600 -s 255 -v /dev/ttyS5 c@0=1
Parsed 0 registers definitions from 1 files
Serial port /dev/ttyS5. Parameters: 9600 baud, 1 stop bit(s), parity: N, timeout 5.0s.
→ < ff 05 00 00 ff 00 99 e4 >
← < ff 05 00 00 ff 00 99 e4 > 8 bytes

Switch relay OFF:

modbus -b 9600 -s 255 -v /dev/ttyS5 c@0=0

Shell output:

(venv) [~]: modbus -b 9600 -s 255 -v /dev/ttyS5 c@0=0
Parsed 0 registers definitions from 1 files
Serial port /dev/ttyS5. Parameters: 9600 baud, 1 stop bit(s), parity: N, timeout 5.0s.
→ < ff 05 00 00 00 00 d8 14 >
← < ff 05 00 00 00 00 d8 14 > 8 bytes