What is MODBUS RTU?

MODBUS is a serial communication protocol. Modicon developed and published it in 1979 and de facto it is an industrial serial standard since then.

MODBUS is an application-layer messaging protocol. In OSI model it is positioned at level 7. The protocol provides a client-server communication.

MODBUS RTU utilizes RS-232 or RS-485 as the physical layer. In a standard MODBUS RTU network, there is one Master and up to 247 Slaves. Each Slave has a unique address from 1 to 247. All communication between master and slaves flows as request-reply. Different function codes specify different services. The functions codes are part of request-reply PDUs.
The format of the request-reply PDUs is as follows:

modbus-rtu-pdu-fields

More about MODBUS RTU can be read at www.modbus.org.

MODBUS RTU – physical layer

MODBUS RTU systems over the serial line should implement an electrical interface in accordance with EIA/TIA-485 standard (also known as RS485 standard). This standard allows a point to point and multipoint systems, in a “two-wire configuration”.

On standard MODBUS RTU system, all the devices are connected in parallel. The number of parallel connected devices depends on the impedance of the devices. The interface needs at least 3 wires. Two of those conductors ( the “Two-Wire” configuration ) form a balanced twisted pair for bi-directional data transition. The third wire is ground (“Common”).

Even that only 3 wires are needed, it is strongly recommended to use a standard UTP as a trunk cable. Even more that RJ45 is one of the recommended connectors for MODBUS RTU system.

For proper operation one pair of resistors must be connected on the RS-485 balanced line:
– Pull-Up Resistor to a 5V Voltage on B- (D1) circuit,
– Pull-Down Resistor to the common circuit on A+ (D0) circuit.

On both ends of the line, there should be installed terminators of 120ohms/0.5W.

modbus-serial-line

RJ45 pinout

RJ45 is one of the connectors for MODBUS RTU system.

modbus-rtu-connectors

Pin DescriptionUTP wires color
not connectedOrange/White Tracer
not connectedOrange
not connectedGreen/White Tracer
Line B-Blue
Line A+Blue/White Tracer
not connectedGreen
+VDDBrown/White Tracer
Common (GND)Brown

Data signals and rates

The required baud rates for standard MODBUS RTU sensor are 9600 and 19200 but the 19200 is the default.

Other baud rates can be 1200, 2400, 4800, 38400 bps, 56 Kbps and 115 Kbps.

The default parity mode must be even parity with one stop bit.

Test software

We recommend using Simply Modbus Master software. It is free for download. All unlicensed programs are in demo mode with full functionality.

We strongly encouraged testers to respect Simply Modbus and buy a license for the program after the tests.

Test MODBUS RTU sensor TSH300/TST300

To test the functionality of MODBUS RTU sensor TSH300/TST300, without TCW210-TH controller, you will need a PC with WIN OS, USB to RS-485 converter, UTP cables, and 5VDC power supply.

1. Read carefully the user manual of the sensor.

2. Wire properly the sensor, power supply, USB to RS-485 converter and terminator(s).

3. Execute factory default setting for the sensor. This will ensure following settings:

– Baud rate – 19200;

– Data bits – 8;

– Stop bits – 1;

– Parity – Even;

– Slave address (ID) – 1.

4. Power permanently the sensor. Its LED should blink shortly on 3 seconds.

modbus-rtu-test-rs485-to-tsh-tst300

5. Run previously installed Simply Modbus Master software.

6. Set the right COM port.

7. Set Slave ID, Function code, and registers as in the screenshot below:

symply-modbus-get-temp

Where the numbers in request window are:

01 Slave address (ID)

03 Function code for reading the registers

00 64 Address of temperature register in hexadecimal (100 in decimal)

00 04 Number of registers to read. One register is 2 bytes.

05 D6 CRC of above values

8. Press Send button.

9. If all works properly in Response window following data will apear:

01 Slave address (ID)

03 Function code for reading the registers

04 Number of data bytes

41 D2 9E 68 Temperature register data (26.327347°C)

27 B8 CRC of above values