Introduction to Modbus

Learn what Modbus is and why it exists: the communication-protocol concept, the RTU and TCP variants, and the overall shape of a real frame

Chapter Objectives

Scenario: Ms. Wang's Greenhouse

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.

Why It Matters

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.

Core Concepts: Communication Protocols and the Two Modbus Variants

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.

Protocol Details and Byte-Level Example: What a Frame Looks Like

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":

■ RTU Address ■ Function Code ■ Data ■ CRC
Slave address 0x01 01
FC 0x03: Read Holding Registers 03
Starting address 0x0000 00 00
Quantity = 2 00 02
CRC-16 (low byte first) C4 0B
ByteValueMeaning
001Slave address
103Function code: Read Holding Registers
2–300 00Starting address
4–500 02Quantity
6–7C4 0BCRC-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".

Real-World Applications

Case 1: The Greenhouse Storyline (Running Through the Whole Course)

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".

Case 2: Modbus All Around You

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.

Hands-On Lab Guide (Preview)

There is no hands-on task in this chapter yet, but get familiar with these places first:

  1. Open the Lab page, click "Read Holding Registers", and see how the message is generated automatically;
  2. Open the course home page and confirm the 10-chapter structure: theory (Chapters 1–3) → function codes (Chapters 4–5) → frame structure (Chapters 6–7) → hands-on (Chapter 8, the Lab) → real world (Chapter 9, online slave) → applications (Chapter 10);
  3. Remember this course's learning path: learn → build frames → connect → quiz.

By Chapters 6 and 7, you will assemble the frame above with your own hands and verify that it is completely correct.

Chapter Summary and What's Next

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.