Ms. Wang runs a greenhouse. Inside there are three "smart" devices: a temperature and humidity sensor, an exhaust fan controller, and a water pump controller. They come from different manufacturers and each speaks its own data format. Ms. Wang's wish is simple: see temperature, humidity, and light level on a single screen in her office, and turn on the exhaust fan and start the pump from that same screen.
The question is: how do these three devices "talk" to each other? How does the 25.6°C measured by the sensor become a line of numbers on the screen? How does the exhaust fan know "it's my turn to spin"?
The device vendors reassure her: don't worry, they all support Modbus. Modbus is the common language of industrial devices—whether it's a sensor from China, a variable frequency drive from Germany, or an electricity meter from the United States, as long as they speak Modbus, they can communicate.
Modbus was born in 1979 and to this day remains the de facto standard communication protocol of industrial automation. It is open, free, and simple, and almost every industrial device supports it. Learn Modbus and you hold the first key into the world of the Industrial Internet of Things.
A communication protocol is simply the agreed "rules of speaking" between devices: who speaks first, who is being addressed, which field comes first, which comes last, and how you confirm you understood. It's like two people on a phone call—first "hello", then names, and finally "goodbye".
Modbus has two major variants; remember each with one sentence:
The good news: both speak the same "language" (the application-layer content is identical)—only the "envelope" differs. We will compare RTU frames and TCP frames in detail in Chapters 6 and 7.
Let's take a first look at the overall shape of "one frame". Don't rush to understand every byte right now—the coming chapters will take it apart piece by piece.
This frame is a complete RTU request: "read 2 holding registers from slave 1, starting at 0x0000":
01
03
00 00
00 02
C4 0B
| Byte | Value | Meaning |
|---|---|---|
| 0 | 01 | Slave address |
| 1 | 03 | Function code: Read Holding Registers |
| 2–3 | 00 00 | Starting address |
| 4–5 | 00 02 | Quantity |
| 6–7 | C4 0B | CRC-16 |
Over TCP, the same request simply gains a 7-byte MBAP envelope header; everything else is unchanged. By the end of Chapters 6 and 7, you will assemble this frame yourself in the Lab—for now, just remember its "shape".
Over the next 10 chapters we will follow Ms. Wang's greenhouse throughout: Chapter 2 builds the network, Chapter 3 draws the "register map" for the devices, Chapter 4 reads data with the read function codes, Chapter 5 controls devices with the write function codes, Chapter 6 dissects the RTU frame, Chapter 7 dissects the TCP frame, Chapter 8 goes to the Lab to assemble frames by hand, Chapter 9 connects to a real slave, and Chapter 10 returns to the real world to wrap up. After these 10 chapters, you will have the complete communication knowledge behind a "greenhouse environmental monitoring system".
You actually live in a Modbus world every day—you just don't notice it. Smart electricity meters, EV charging piles, and building air conditioning all speak Modbus behind the scenes. We'll explore those real industries in Chapter 10.
There is no hands-on task in this chapter yet, but get familiar with these places first:
By Chapters 6 and 7, you will assemble the frame above with your own hands and verify that it is completely correct.
In this chapter you met Modbus: the "common language" of industry, with two major variants, RTU and TCP, and more than 40 years of history. We also previewed what a real message looks like.
Next, we step into Ms. Wang's greenhouse network and answer a fundamental question: with so many devices, who speaks first? That is the master-slave architecture. And in Chapter 10, we will step into the real world of Modbus and see which industries actually use it.