Modbus TCP

Modbus TCP Server

Modbus TCP is standard interface to interact with the IOs of UniPi PLCs. Each PLC has its own mapping of I/O to a Modbus Register or Coil which can be downloaded from the Products section.

1Wire devices are not mapped to Modbus TCP and have to be implemented in a different way, eg. using OWFS.

Systemd service

The Modbus TCP server interface is provided by a unipitcp service. By default, the server only listening to request on the local loopback and requests from other hosts are forbidden due to security reasons. To change this, the unipitcp has to be run with parameter “-l 0.0.0.0”. If you wish, you can also change the listening port in parameter -p to a different one.

/opt/unipi-bin/unipi_tcp_server -p 502 -l 0.0.0.0

To make the change permanent, modify the service script in /lib/systemd/system/unipitcp.service and reload and restart the service by

systemctl daemon-reload

and

systemctl restart unipitcp