Modbus at a glance: summary and course map
Overview
Modbus has two main types of data: Coils and Registers. Coils are digital, capable of being either ON (1) or OFF (0). They can be inputs, which monitor the status of switches or sensors, or outputs, which control devices like motors and lights. Registers are 16-bit values that range from 0 to 65535. Input registers read analog input data such as temperature or pressure, while holding registers manage analog output data like setting motor speeds or valve positions.
Modbus uses a request/response protocol, with function codes specifying the type of service. These codes are important parts of the Modbus Protocol Data Unit (PDU). When a master device sends a request, the function code indicates the operation to be executed, such as reading or writing data. Common function codes include reading coils, discrete inputs, multiple holding registers, and input registers, as well as writing single or multiple coils and holding registers.
There are two main versions of Modbus: Modbus RTU and Modbus TCP. Modbus RTU uses a compact binary format for efficient communication over serial lines like RS-232 or RS-485. Modbus TCP utilizes Ethernet, offering higher data transmission rates and greater distance coverage, along with easier integration with other Ethernet-based systems.
Industrial Shields PLCs support both Modbus RTU and Modbus TCP, allowing for precise control and monitoring through the use of coils and registers. Coils control digital outputs like motors and lights, while digital inputs monitor switches, sensors, and external commands. Input registers handle analog inputs, reading data from various sensors, and holding registers manage analog outputs, setting parameters like motor speeds and valve positions.

In the following lessons, there is explained how to implement the Modbus protocol for Arduino, ESP32 and Raspberry-based PLCs:
- For the Arduino and ESP32 based PLCs is explained how to implement the protocol with the Arduino IDE. Alternatively, you can implement it with PlatformIO; for more details, refer to this post. Another option is to use OpenPLC, you can find more information in this post.
- For the Raspberry based PLCs is explained how to implement Modbus with Python, Node-RED and C.
There are no comments for now.