Skip to content

Modbus RTU-485 to TCP bridge

The eManager can be configured as a modbus TCP slave in Node-RED using the Modbus Flex Server node. This node only allows TCP communication, but it is also possible to configure the eManager as a modbus RTU-485 slave, installing the emod-modbus-bridge package.

This package acts as a bridge between RTU-485 and TCP communication.

In the next sections will be detailed how to install it, the nedded configuration, and how to run it.

Installation

The emod-modbus-bridge package is already pre-installed in the eManager.

Configuration

The emod-modbus-bridge package has a default configuration for TCP and RTU-485 communication bridge.

Some modbus TCP parameters that can be set are:

  • --address localhost
  • --port 11502
  • --timeout 1.0
  • --unit_id 1

For modbus RTU-485 you can configure:

  • --device /dev/ttymxc4
  • --baudrate 19200
  • --unit_id 1
  • --timeout 1.0

Important

Do not modify the --device parameter.

In order to modify this parameters, you have to access /etc/default/modbus-bridge file. The default content of this file is the following:

EXTRA_ARGS="--port 11502"

You must add the parameters you need as EXTRA_ARGS="<PARAM1> <PARAM2> <PARAM3>". For example:

EXTRA_ARGS="--port 11502 --device /dev/ttymxc4 --baudrate 19200 --unit_id 1 --timeout 1.0"

Important

Remember to execute systemctl daemon-reload once you modify the parameters you need.

Service Usage

Once the package is installed and configured as needed, it can be managed as the other services, as explained here.

The most useful commands to manage this service are:

systemctl start modbus-bridge
systemctl stop modbus-bridge
systemctl restart modbus-bridge
systemctl status modbus-bridge

This service can be used configuring the eManager as a modbus TCP server, if we need to access it using RTU-485 connection.

You can find an example about how to configure the eManager as a modbus server using Node-RED, here.