Modbus TCP is the cheapest and simplest way to connect a Fairino robot to a Siemens PLC — no extra hardware card needed, just an Ethernet cable. Here's a comprehensive guide based on community experience.
Prerequisites
- Fairino firmware v3.8.7 or newer recommended (Modbus RTU settings UI is not available in older versions — if you're on an old version, upgrade first: Software Upgrade Guide)
- Robot and PLC on the same network subnet
- Ethernet cable between the robot's secondary port and the PLC (or via a switch if using the same network)
Robot-side configuration
- In WebApp → Settings → Communication → Modbus
- Enable the Modbus TCP server
- Set the port (default: 502)
- Configure your register map — define which registers map to which robot variables
- Important: You must declare register names in the configuration/database before you can use them in LUA scripts. Undefined registers will cause "failed to query database" errors.
Siemens TIA Portal configuration
Use the MB_CLIENT function block (from the Communication library). Key settings:
| Parameter | Value |
| IP address | Robot IP (e.g. 192.168.58.2) |
| Port | 502 |
| Unit ID | 1 |
| REQ trigger | Positive edge (NOT continuous — continuous polling can flood the robot) |
| Connection timeout | At least 2000ms (first connect can be slow) |
Common gotchas
1. "Failed to query database (data does not exist)" error
This is the most common error. Three possible causes:
- You're using the wrong function:
ModbusMasterReadDI()is for RTU,GetModbusInput()is for TCP. Don't mix them up. - Register names contain quote marks — remove any quotes around parameter names in your LUA code
- The register hasn't been declared in the Modbus configuration database
2. Register address off-by-one
Siemens uses the Modbus convention where Holding Register 0 is addressed as 40001. If you want to read register 0 on the robot, use address 40001 in the S7 MB_CLIENT block. Getting this wrong means you silently read the wrong register.
3. Program load delay via Modbus trigger
When using Modbus to trigger a LUA program from the PLC, there can be a 2-10 second random delay before execution starts. This appears to be a firmware-level issue with no current fix. Plan your cycle accordingly.
Testing
Before connecting to a real PLC, you can test Modbus communication using free tools like ModbusPoll (Windows) or pymodbus (Python) from your laptop.
Alternative: Profinet
If you need faster communication or more I/O points, Profinet is an option — but it requires a separate PCIe card. See the Profinet thread for details. For most applications, Modbus TCP is sufficient and much simpler to set up.