PCB Technology: Considerations for Turning Your Embedded System into a Modbus Remote Terminal Unit

Created: September 12, 2017
Updated: September 25, 2020
Face with bullets flying out of its mouth

There is a misconception that engineers are terrible dates and hopeless in relationships. While I’m no relationship guru, past experiences have taught me that communication, or the lack off, is one of the main reasons relationships fail. Great communication isn’t talking endlessly to your partner, but rather being attentive to what they have to say, or decoding the hidden meaning of their cold silence.

If you have mastered the elusive skill of communication then turning your embedded system into a Modbus RTU shouldn’t be a huge problem. The Modbus RTU protocol has two version of protocols, one that uses characters to encapsulate a message and the other that uses the period of inactivity or “silence" to separate messages. Your module needs to be a good listener, depending on which version of the Modbus RTU protocol you chose. Here we’ll review what a Modbus RTU is and how it works, and then discuss what factors you should consider before turning your embedded system in a Modbus RTU.  

What is a Modbus RTU?

Modbus is a communication protocol that is commonly used in industrial applications in a Modbus slave configuration. This protocol was developed in 1979 by Modicon and has been reliably used across automation, instrumentation and process control industries for more than three decades. The Modbus protocol involves a simple process of message request by a master followed by a response by the Modbus slave.

In the context of industrial applications, an RTU is a Modbus device capable of executing processes and monitoring input data from sensors. They are advanced versions of Programmable Logic Controllers (PLC). RTUs are able to function on their own but they are often used as a standard communication interface that enables data transfer or remote monitoring back to a computer or touch screens devices. In this case, a Modbus RTU uses the Modbus RTU protocol to transfer and receive information from other connected ASCII devices. A good example of this is a PLC that monitors environmental parameters like temperature, humidity, air, and high-efficiency particulate air (HEPA) pressure and then relays that info to industrial monitors installed in the room.

PCB with oscilloscope trace background
You can turn embedded systems into a cost effective Modbus RTU PLC-replacement.

How To Turn Your Embedded System Into A Modbus RTU

We’ve already discussed how embedded systems are different from industrial PLCs in terms of programming methods and cost. While PLCs uses ladder diagram or structured charts that make programming easier, the cost of PLC can be very high compared to embedded systems that carry the same hardware functionality.

From a cost perspective, it’s beneficial to turn your embedded system into a functional Modbus RTU when your application requires multiple Modbus RTUs. Here are some solutions to consider before doing this.

1. Communications Topology

The Modbus protocol is a communication based on a master - slave topology. The master will be responsible for initiating the request and the Modbus slave replies with a response packet in a timely manner. You’ll need to determine if your embedded system needs to adopt a Modbus master or slave setup.

2. Communications Interface

Serial communication is the popular interface for Modbus communication. An underlying interface like RS232, RS422, and RS485 are commonly used to connect Modbus devices. While they are simple to set up they have limitations. The Modbus protocol requires that a message request to be completed by a response before the next message request is transmitted. A single Modbus master and slave connection on a serial interface mean that only requests must be transmitted individually, one at a time.

Modbus TCP/IP, on the other hand, operates on the TCP/IP protocol and uses IP address to identify the devices. Unlike the serial interface, TCP/IP allows multiple connections to be connected amongst devices and the complexity of collision handling and error recovery is handled by the underlying TCP/IP stack. This also means that TCP/IP allows multiple masters to connect to a single slave.

3. Modbus Protocol

There are two types of Modbus messaging structures, Modbus ASCII and Modbus RTU. Both share the same packet frame. However, Modbus ASCII uses 2 bytes of American Standard Code for Information Interchange (ASCII) characters in a field, and the Modbus RTU uses a single byte of binary value. This gives the Modbus RTU an advantage in terms of transmission speed. The Modbus ASCII uses characters to indicate the starting and ending of its message while the Modbus RTU uses a “silent period” for the same purpose. As a result of these different communication protocols, the firmware being used must be setup to detect either or both types of standard packages.

Speed boat at sea
Modbus RTU is the faster protocol because of its binary value format.

4. Memory Allocation

The Modbus protocol basically reads and writes data to register with addresses that follow a certain convention. For example, the register for digital inputs starts from address 10001 and Modbus registers storing variables and analog values start at address 40001 as defined by the Modbus standard. For example, an analog value for humidity can be read from address 40002 and the logic value of a safety limit switch can be read from address 100003.

A critical design process for the embedded system is mapping these registers to physical memory, which is likely to be different from the stated address in the Modbus protocol. Hardware engineers need to decide the which memory chips are appropriate to be used and firmware developers need to maintain a mapping table that store or retrieve the data accurately.

At times, purchasing a PLC Modbus RTU from respectable manufacturers could be the best option. However, when you have tens or hundreds similar RTU to install for your projects, it makes sense to save on the hardware costs and to design your own embedded system Modbus RTU. Do bear in mind, though, to get your memory allocation and Modbus protocol communications right in your design to conform to existing standards.

Besides taking care on Modbus specific issues, designing your embedded system requires professional board design software. When you need to access an easy-to-use PCB layout tool that includes everything needed to build high-quality manufacturable circuit boards, look no further than CircuitMaker. In addition to easy-to-use PCB design software, all CircuitMaker users have access to a personal workspace on the Altium 365 platform. You can upload and store your design data in the cloud, and you can easily view your projects via your web browser in a secure platform.

Start using CircuitMaker today and stay tuned for the new CircuitMaker Pro from Altium.

Related Resources

Back to Home
Thank you, you are now subscribed to updates.