For the first eight chapters, Ms. Wang's greenhouse lived only on paper. Now we bring it to life: this site runs a real Modbus TCP slave (tcp.modbus.kredlab.com:502), which you can treat as "the simulator of Ms. Wang's greenhouse". Connect to it with any standard Modbus client, read the temperature, start the pump, write a setpoint—every byte you have studied becomes real data flowing over a real network.
Going from "messages in a browser" to "a slave on a real network" is the first real step into industrial communication debugging. The real world has latency, concurrency, and firewalls—pitfalls you never experience in a simulator. This chapter runs into all of them, and solves all of them.
| Essential | Value for this slave | Notes |
|---|---|---|
| Host | tcp.modbus.kredlab.com | Server domain name/IP |
| Port | 502 | Standard Modbus TCP port |
| Unit ID | 1 | Usually 1 or 255 |
| Address | Type | Greenhouse meaning | Conversion |
|---|---|---|---|
| 0x0000 – 0x0009 | Holding registers | Sensor values: temperature, pressure, flow, etc. | ×0.1 etc. (per the page notes) |
| 0x000A – 0x000F | Holding registers | Run time, event counters | Read directly |
| 0x0000 – 0x000F | Coils | Pump switch, alarms, modes | 0=off 1=on |
Data conversion recap: what the slave returns is a raw integer. For example, if you read 00 64 = 100 and the page notes say "×0.1", the engineering value is 10.0; if you read 1500 and the notes say "speed in RPM", it is 1500 RPM. Read the map before reading the device—just as you would read the device manual first.
Use a client to send "read 1 holding register @0x0000" (FC 03). A normal response looks like this:
00 02
00 00
00 05
01
03
02
00 64
| Request / Response | Value | Meaning |
|---|---|---|
| Request (TCP) | 00 02 00 00 00 06 01 03 00 00 00 01 | Read 1 holding register @0x0000 |
| Response 0–1 | 00 02 | Transaction ID echoed |
| Response 2–3 | 00 00 | Protocol ID |
| Response 4–5 | 00 05 | Length = 5 |
| Response 6 | 01 | Unit ID |
| Response 7 | 03 | Function code echoed |
| Response 8 | 02 | Byte count = 2 |
| Response 9–10 | 00 64 | Data = 100 → 10.0 |
Note that the response's transaction ID matches the request (both 00 02 here), and length = 0x0005 = unit ID + FC + byte count + data. If the address is out of range, the slave returns an exception: 01 83 02 (function code 0x83 + exception code 02).
Remember the VFD's register map? Holding register 0x0000 = target speed. If the slave simulator shows 0x0000 = 1500, it means "the present target is 1500 RPM"—read exactly the same way as the greenhouse's "0x0000 = 10.0 °C": look up the map first, then convert.
| Symptom | Possible cause | Fix |
|---|---|---|
| Cannot connect / timeout | Firewall blocking the port, DNS resolution failure | Make sure port 502 is allowed; test with a direct IP |
| Connection refused / rate limited | Exceeded the per-IP connection limit (3) | Close spare connections; disconnect test scripts promptly when done |
| Read returns exception 02 | Address out of range or quantity over the limit | Correct the starting address/quantity against the register map |
| Write fails | Target area is read-only / wrong address | Confirm the address is writable; read the map before writing |
pymodbus;Congratulations—you have completed Chapter 9: connecting to a real slave, reading the register map, converting raw values, and troubleshooting three common problems. You can read a device manual, draw a register map, build and parse frames, and talk to real equipment—these are the core fundamentals of a Modbus engineer.
Next: head to the quiz page to test your understanding, read deeper articles in the knowledge base, or go back to the Lab to keep practising. And don't forget there is one chapter left: in Chapter 10 we pull the camera back and walk into the real world of Modbus—which industries use it, and how real systems are put together.