You are developing a SCADA system, configuring a PLC, or building an HMI — but the field devices are not available yet. The energy meters, VFDs, temperature sensors, and I/O modules are still on order, or they are installed at a remote site you cannot access.
A Modbus simulator solves this. It runs on your computer and pretends to be a real Modbus device. Your SCADA master or PLC connects to the simulator, reads holding registers, writes coils, and receives responses — exactly as it would from a real device.
This guide covers 10 free Modbus simulators (slave and master), explains when to use each one, and walks you through setting up a complete Modbus TCP test environment on your laptop in under 5 minutes.
In This Guide
1. What Is a Modbus Simulator
A Modbus simulator is software that emulates a Modbus device on your computer. There are two types:
- Slave simulator (server) — pretends to be a field device (meter, sensor, VFD). It listens for requests from a master and responds with register values you configure.
- Master simulator (client) — pretends to be a PLC or SCADA master. It sends read/write requests to a real or simulated slave device.
For most testing, you need a slave simulator — because your SCADA or PLC is the master, and you need something to talk to.
2. Slave Simulator vs Master Simulator
| Feature | Slave Simulator | Master Simulator |
|---|---|---|
| Role | Pretends to be a field device | Pretends to be a PLC/SCADA master |
| Listens on | Port 502 (TCP) or COM port (RTU) | Connects to port 502 or COM port |
| Use case | Test your SCADA/PLC master | Test your field device or slave firmware |
| You configure | Register values, coil states | Poll rate, register addresses, function codes |
| Examples | ModRSsim2, OpenModSim, diagslave | modpoll, Modbus Poll, QModMaster |
3. Quick Comparison Table
Slave Simulators (Server)
| Tool | License | GUI | TCP | RTU | OS | Key Feature |
|---|---|---|---|---|---|---|
| ModRSsim2 | Free (open source) | Yes | ✅ | ✅ | Windows | Multiple slave IDs, animation, logging |
| OpenModSim | Free (open source) | Yes | ✅ | ✅ | Windows, Linux | JavaScript scripting, error injection |
| diagslave | Free (freeware) | No (CLI) | ✅ | ✅ | Windows, Linux, Raspberry Pi | Lightweight, cross-platform |
| Modbus Slave | Free trial (30 days) | Yes | ✅ | ✅ | Windows | 100 slave windows, OLE automation |
| ModbusSlaveSimulation | Free (MIT) | Yes | ✅ | ✅ | Windows, Linux, macOS | Multiple instances, pre-set values |
Master Simulators (Client)
| Tool | License | GUI | TCP | RTU | OS | Key Feature |
|---|---|---|---|---|---|---|
| modpoll | Free (freeware) | No (CLI) | ✅ | ✅ | Windows, Linux, Raspberry Pi | Scripting, float/32-bit support |
| Modbus Poll | Free trial (30 days) | Yes | ✅ | ✅ | Windows | Professional, multiple polls |
| QModMaster | Free (open source) | Yes | ✅ | ✅ | Windows, Linux | Open source, easy to use |
| pymodbus | Free (open source) | No (Python) | ✅ | ✅ | Any (Python) | Custom simulators, scripting |
| Node-RED | Free (open source) | Yes (web) | ✅ | ✅ | Any (Node.js) | Visual flow programming |
4. ModRSsim2 — The Classic Free Slave Simulator
ModRSsim2 is the most widely used free Modbus slave simulator. It supports Modbus TCP and RTU, multiple slave addresses, register animation, and traffic logging.
| Feature | Details |
|---|---|
| License | Free (open source) |
| Protocols | Modbus TCP, Modbus RTU, Modbus ASCII |
| Slave addresses | Multiple (1–247) simultaneously |
| Register types | Coils, Discrete Inputs, Input Registers, Holding Registers |
| Data simulation | Manual entry, random, increment |
| Logging | Built-in traffic log with frame decode |
| OS | Windows |
| Download | sourceforge.net/projects/modrssim2 |
Setup: Download → run the .exe → select protocol (TCP or RTU) → set slave address → configure register values → click Start. Your SCADA master can now connect on port 502.
5. OpenModSim — Modern Open-Source Slave Simulator
OpenModSim is a newer, actively maintained open-source slave simulator with JavaScript scripting, error injection, and a clean modern interface.
| Feature | Details |
|---|---|
| License | Free (GPL, open source) |
| Protocols | Modbus TCP, Modbus RTU |
| Slave addresses | Configurable |
| Data simulation | Random, increment, decrement with configurable limits and step |
| Error injection | Simulate exception codes to test master error handling |
| Scripting | ECMAScript/JavaScript for advanced scenarios |
| OS | Windows 7+, Linux (Debian, Ubuntu, Fedora, Rocky) |
| Download | github.com/sanny32/OpenModSim |
Best for: Engineers who need to test how their master handles errors — you can inject specific Modbus exception codes (Illegal Function, Illegal Data Address, etc.) to verify error handling.
6. diagslave — Command-Line Slave Simulator
diagslave is a lightweight command-line Modbus slave simulator. No GUI, no installation — just download and run.
| Feature | Details |
|---|---|
| License | Free (freeware) |
| Protocols | Modbus TCP, RTU, ASCII, UDP, RTU over TCP |
| OS | Windows, Linux (x86, ARM), Raspberry Pi, QNX |
| Download | modbusdriver.com/diagslave.html |
Example — start a TCP slave on port 502, address 1:
bash
diagslave -m tcp -a 1 -p 502
Example — start an RTU slave on COM7, 19200 baud, even parity:
bash
diagslave -m rtu -a 1 -b 19200 -p even COM7
Best for: Quick testing, scripted test environments, Raspberry Pi, Linux headless servers.
7. Modbus Slave (ModbusTools) — Professional Slave Simulator
Modbus Slave by ModbusTools is a professional-grade simulator with a 30-day free trial. It supports up to 100 slave windows simultaneously and includes OLE automation for Excel integration.
| Feature | Details |
|---|---|
| License | Free trial (30 days), $129 for permanent license |
| Protocols | Modbus TCP, RTU, ASCII |
| Slave windows | Up to 100 simultaneously |
| OLE automation | Interface with Excel, Python, VBA |
| OS | Windows |
| Download | modbustools.com/modbus_slave.html |
Best for: Professional SCADA integration testing where you need to simulate many devices at once.
8. ModbusSlaveSimulation — Lightweight GUI Simulator
A standalone Windows app supporting Modbus RTU, TCP, UDP, and ASCII over RTU. Multiple instances can run simultaneously.
| Feature | Details |
|---|---|
| License | Free (MIT, open source) |
| Protocols | Modbus TCP, RTU, UDP, ASCII over RTU |
| Pre-set values | Set register values before starting the connection |
| Multiple instances | Run several simulators with different ports/addresses |
| OS | Windows, Linux (Mono), macOS (Mono) |
| Download | github.com/GitHubDragonFly/ModbusSlaveSimulation |
9. modpoll — Command-Line Master Simulator
modpoll is the master-side companion to diagslave. It sends Modbus requests from the command line — perfect for quick testing and scripting.
| Feature | Details |
|---|---|
| License | Free (freeware) |
| Protocols | Modbus TCP, RTU, ASCII, UDP, RTU over TCP |
| Data types | 16-bit, 32-bit integer, float, hex, module 10000 |
| OS | Windows, Linux, Raspberry Pi |
| Download | modbusdriver.com/modpoll.html |
Example — read 10 holding registers starting at 500 from a TCP slave:
bash
modpoll -m tcp -r 500 -c 10 192.168.1.100
Example — read 5 floating-point values starting at register 100:
bash
modpoll -m tcp -t 4:float -r 100 -c 5 192.168.1.100
Example — write value 1234 to register 100:
bash
modpoll -m tcp -r 100 192.168.1.100 1234
10. Modbus Poll (ModbusTools) — Professional Master Simulator
Modbus Poll is the most popular Modbus master simulator for professional use. 30-day free trial. Supports multiple simultaneous poll windows, data logging, and all function codes.
| Feature | Details |
|---|---|
| License | Free trial (30 days), $129 permanent |
| Protocols | Modbus TCP, RTU, ASCII |
| OS | Windows |
| Download | modbustools.com/modbus_poll.html |
11. QModMaster — Open-Source Master with GUI
QModMaster is a free, open-source Modbus master with a graphical interface. Built with Qt, it runs on Windows and Linux.
| Feature | Details |
|---|---|
| License | Free (LGPL, open source) |
| Protocols | Modbus TCP, RTU |
| OS | Windows, Linux |
| Download | github.com/ed-chemnitz/qmodmaster |
12. pymodbus — Python Library for Custom Simulators
pymodbus is a Python library that lets you build custom Modbus master and slave simulators with full control over behavior, register values, and timing.
| Feature | Details |
|---|---|
| License | Free (BSD, open source) |
| Protocols | Modbus TCP, RTU, ASCII, TLS |
| Language | Python 3 |
| Install | pip install pymodbus |
| Download | github.com/pymodbus-dev/pymodbus |
Example — create a Modbus TCP slave with 100 holding registers:
python
from pymodbus.server import StartTcpServer
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
from pymodbus.datastore import ModbusSequentialDataBlock
store = ModbusSlaveContext(
hr=ModbusSequentialDataBlock(0, [0]*100), # 100 holding registers
ir=ModbusSequentialDataBlock(0, [0]*100), # 100 input registers
)
context = ModbusServerContext(slaves=store, single=True)
StartTcpServer(context=context, address=("0.0.0.0", 502))
Best for: Automated testing, CI/CD pipelines, custom device emulation, dynamic value generation.
13. Node-RED with Modbus Nodes
Node-RED is a visual flow programming tool that supports Modbus through community nodes. You can build both master and slave simulators using drag-and-drop flows.
| Feature | Details |
|---|---|
| License | Free (Apache 2.0) |
| Modbus nodes | node-red-contrib-modbus |
| Install | npm install node-red-contrib-modbus |
| OS | Any (Node.js) |
| Download | nodered.org |
Best for: IIoT integration, visual prototyping, connecting Modbus to MQTT/HTTP/databases.
14. How to Set Up a Modbus TCP Test Environment in 5 Minutes
What You Need
- One computer (laptop or desktop)
- A slave simulator (ModRSsim2 or diagslave)
- A master application (your SCADA, PLC simulator, or modpoll)
Step 1. Start the Slave Simulator
Using ModRSsim2:
- Download and run ModRSsim2
- Select MODBUS TCP/IP protocol
- Set Station ID = 1
- The simulator listens on port 502 automatically
- Set some values in Holding Registers (e.g., register 0 = 2301, register 1 = 1456)
Using diagslave:
bash
diagslave -m tcp -a 1 -p 502
Step 2. Connect Your Master
Using modpoll:
bash
modpoll -m tcp -a 1 -r 1 -c 10 127.0.0.1
This reads 10 holding registers starting at register 1 from the local slave simulator.
Using your SCADA software:
Configure a Modbus TCP connection to 127.0.0.1, port 502, Unit ID 1.
Step 3. Verify
You should see register values in your master application matching what you set in the slave simulator. If you change values in the simulator, your SCADA updates automatically on the next poll.
15. How to Set Up a Modbus RTU Test Environment
For Modbus RTU, you need virtual COM ports because you do not have a physical RS-485 bus.
Step 1. Install Virtual COM Port Software
- Windows: com0com — creates pairs of virtual COM ports (e.g., COM3 ↔ COM4)
- Linux:
socat— creates virtual serial pairs
Linux example:
bash
socat -d -d pty,raw,echo=0 pty,raw,echo=0
# Output: /dev/pts/3 and /dev/pts/4 — use these as your COM ports
Step 2. Start the Slave on One Port
bash
diagslave -m rtu -a 1 -b 9600 -p even COM3
Step 3. Connect the Master on the Other Port
bash
modpoll -m rtu -a 1 -b 9600 -p even -r 1 -c 10 COM4
16. Testing Scenarios Every Engineer Should Run
| Test | What to Verify | How |
|---|---|---|
| Basic read | Master reads holding registers correctly | Read 10 registers, verify values match simulator |
| Basic write | Master writes to a register | Write a value, verify it appears in the simulator |
| Wrong slave address | Master handles no response | Set master to address 5, simulator to address 1 |
| Wrong register address | Slave returns exception code 02 | Request a register that does not exist |
| Wrong function code | Slave returns exception code 01 | Send FC 04 to a slave that only supports FC 03 |
| Multiple slaves | Master polls multiple addresses | Run multiple simulator instances with different IDs |
| Timeout behavior | Master handles slave not responding | Stop the simulator, observe master timeout behavior |
| Large block read | Verify max register count | Read 125 registers in one request |
| Float values | Verify 32-bit float decoding | Set two consecutive registers to a known float value |
| CRC errors (RTU) | Master handles corrupted frames | Disconnect/reconnect the serial link during transfer |
17. Common Simulation Problems and Fixes
| Problem | Cause | Fix |
|---|---|---|
| Connection refused on port 502 | Simulator not running, or wrong port | Start the simulator first. Verify port 502. |
| “Port 502 already in use” | Another application is using port 502 | Close the other application or use a different port (e.g., 1502). |
| No response from simulator | Wrong slave address | Verify master and simulator use the same Unit ID. |
| All registers read as 0 | Default values not set | Set register values in the simulator before connecting. |
| Exception code 02 | Register address out of range | Check the register range configured in the simulator. |
| Float values show garbage | Wrong byte order | Try swapping byte order (AB CD vs CD AB) in your master. |
| RTU communication fails | Baud rate or parity mismatch | Verify both sides use identical serial settings. |
| Firewall blocking port 502 | Windows Firewall | Allow the simulator application through the firewall. |
Summary
A Modbus simulator lets you test your SCADA, PLC, or HMI without physical field devices. The most common setup is a slave simulator on your laptop that your master connects to over TCP port 502.
The key recommendations:
- Quick GUI testing: Use ModRSsim2 (Windows) or OpenModSim (Windows/Linux)
- Command-line / scripting: Use diagslave (slave) + modpoll (master)
- Custom simulation with Python: Use pymodbus
- Error injection testing: Use OpenModSim (inject exception codes)
- Professional multi-device simulation: Use Modbus Slave by ModbusTools (30-day trial)
- RTU testing without hardware: Use com0com (Windows) or socat (Linux) for virtual COM ports
💡 Tip: Use the free Modbus Frame Decoder Tool to decode any Modbus frame captured during simulation — including MBAP header, function code, register addresses, and CRC validation.
For Modbus protocol fundamentals, see: Modbus Protocol Guide
For Wireshark analysis during testing, see: Wireshark for Modbus TCP
