Controlling Modbus RTU sensors with a Peakboard: A guide from the ground up

The basic idea of Modbus

The basic idea is to integrate multiple sensors into a bus system, with each sensor having an address. Each time the master (such as a PLC) requests a value from the sensors, it sends a request packet with the sensor's address onto the bus. The sensor then sends back its response. Depending on the type of response, there are four main structures for organizing data exchange:

  • A discrete entrance
  • A discrete output
  • A holding register for command and configuration values
  • An input register that contains the actual measurements or values of the sensor

Since sensor values are queried, the input register is used.

Modbus RTU vs. Modbus TCP and the required hardware

Most Modbus sensors are RTU sensors that only communicate serially. This standard is called RS485. In this example, a Jiaminye RS485 Serial Communication Temperature Sensor is used. The following image shows what this sensor looks like. In addition to the two power lines, there are two communication lines.

Jiaminye RS485 Temperatur- und Feuchtesensor XY-MD02 montiert auf Hutschiene, mit angeschlossenen Strom- und Kommunikationsleitungen.

Why use a Modbus RTU to Modbus TCP Gateway?

Peakboard works best when it can be connected to a modern network without having to handle individual cables and serial communication. Therefore, a Modbus RTU to Modbus TCP Gateway Serial to Ethernet Converter is required, which converts serial communication into something that can be addressed with a modern LAN cable. The actual protocol remains the same, it's just a physical converter. Normally, the term Modbus RTU is used for the old style and Modbus TCP for the new style. Peakboard only supports Modbus TCP and this RTU/TCP converter helps to make every Modbus sensor available and addressable for Peakboard. The sensor is connected to the converter and the converter is available on the same LAN as the Peakboard Box (and Peakboard Designer).

Configuring the Modbus data source in Designer

Configuring the data source isn't too complicated when you compare it with the hardware configuration just described. Two things must be specified in Peakboard Designer:

  • The IP address of the RTU/TCP converter.
  • The bus address of the sensor within the Modbus bus system (Unit ID). In this case: 1.

It is also specified that several input registers and two data points should be read. Ideally, the preview works immediately and shows the temperature and humidity data. In this example, the temperature is given in tenths of degrees and the humidity in tenths of a percent.

Peakboard-Einstellungsdialog zur Datenvorschau und Formatierung von Temperatur- und Feuchtewerten mit markierten Parametern.

The following image shows how to format the numbers correctly and how to format the numbers correctly. No scripting is required. The standard formatting options are used to adjust the multiplier, unit of measure, and number of decimals. That's it.

Visualisierung von Temperatur- und Feuchtedaten im Peakboard-Dashboard mit Formatierungsoptionen für Dezimalstellen und Einheiten.

Outcome and Conclusion

As explained in this article, it's easy to master Modbus with both TCP and RTU as long as you know the hardware well and have basic knowledge of Modbus. It is even more important to know how the sensor actually works in the context of serial communication. Unfortunately, there is no way around reading the documentation for each sensor. There is no standard for how the values can be addressed and interpreted. Each manufacturer has its own implementation.
Visualisierung von Sensordaten mit Temperaturanzeige 22 °C und Luftfeuchtigkeit 38,4 % als Symbole auf schwarzem Hintergrund.

Share this article:
Author: Michelle

Michelle is passionate about cutting-edge technology and loves telling others about the interesting world of innovation. As a technology enthusiast at Peakboard, she is constantly exploring the latest trends and developments.