How to Simulate Modbus Devices for Testing: 10 Free Tools Compared

By | April 14, 2026

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.

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

FeatureSlave SimulatorMaster Simulator
RolePretends to be a field devicePretends to be a PLC/SCADA master
Listens onPort 502 (TCP) or COM port (RTU)Connects to port 502 or COM port
Use caseTest your SCADA/PLC masterTest your field device or slave firmware
You configureRegister values, coil statesPoll rate, register addresses, function codes
ExamplesModRSsim2, OpenModSim, diagslavemodpoll, Modbus Poll, QModMaster

3. Quick Comparison Table

Slave Simulators (Server)

ToolLicenseGUITCPRTUOSKey Feature
ModRSsim2Free (open source)YesWindowsMultiple slave IDs, animation, logging
OpenModSimFree (open source)YesWindows, LinuxJavaScript scripting, error injection
diagslaveFree (freeware)No (CLI)Windows, Linux, Raspberry PiLightweight, cross-platform
Modbus SlaveFree trial (30 days)YesWindows100 slave windows, OLE automation
ModbusSlaveSimulationFree (MIT)YesWindows, Linux, macOSMultiple instances, pre-set values

Master Simulators (Client)

ToolLicenseGUITCPRTUOSKey Feature
modpollFree (freeware)No (CLI)Windows, Linux, Raspberry PiScripting, float/32-bit support
Modbus PollFree trial (30 days)YesWindowsProfessional, multiple polls
QModMasterFree (open source)YesWindows, LinuxOpen source, easy to use
pymodbusFree (open source)No (Python)Any (Python)Custom simulators, scripting
Node-REDFree (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.

FeatureDetails
LicenseFree (open source)
ProtocolsModbus TCP, Modbus RTU, Modbus ASCII
Slave addressesMultiple (1–247) simultaneously
Register typesCoils, Discrete Inputs, Input Registers, Holding Registers
Data simulationManual entry, random, increment
LoggingBuilt-in traffic log with frame decode
OSWindows
Downloadsourceforge.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.

FeatureDetails
LicenseFree (GPL, open source)
ProtocolsModbus TCP, Modbus RTU
Slave addressesConfigurable
Data simulationRandom, increment, decrement with configurable limits and step
Error injectionSimulate exception codes to test master error handling
ScriptingECMAScript/JavaScript for advanced scenarios
OSWindows 7+, Linux (Debian, Ubuntu, Fedora, Rocky)
Downloadgithub.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.

FeatureDetails
LicenseFree (freeware)
ProtocolsModbus TCP, RTU, ASCII, UDP, RTU over TCP
OSWindows, Linux (x86, ARM), Raspberry Pi, QNX
Downloadmodbusdriver.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.

FeatureDetails
LicenseFree trial (30 days), $129 for permanent license
ProtocolsModbus TCP, RTU, ASCII
Slave windowsUp to 100 simultaneously
OLE automationInterface with Excel, Python, VBA
OSWindows
Downloadmodbustools.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.

FeatureDetails
LicenseFree (MIT, open source)
ProtocolsModbus TCP, RTU, UDP, ASCII over RTU
Pre-set valuesSet register values before starting the connection
Multiple instancesRun several simulators with different ports/addresses
OSWindows, Linux (Mono), macOS (Mono)
Downloadgithub.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.

FeatureDetails
LicenseFree (freeware)
ProtocolsModbus TCP, RTU, ASCII, UDP, RTU over TCP
Data types16-bit, 32-bit integer, float, hex, module 10000
OSWindows, Linux, Raspberry Pi
Downloadmodbusdriver.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.

FeatureDetails
LicenseFree trial (30 days), $129 permanent
ProtocolsModbus TCP, RTU, ASCII
OSWindows
Downloadmodbustools.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.

FeatureDetails
LicenseFree (LGPL, open source)
ProtocolsModbus TCP, RTU
OSWindows, Linux
Downloadgithub.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.

FeatureDetails
LicenseFree (BSD, open source)
ProtocolsModbus TCP, RTU, ASCII, TLS
LanguagePython 3
Installpip install pymodbus
Downloadgithub.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.

FeatureDetails
LicenseFree (Apache 2.0)
Modbus nodesnode-red-contrib-modbus
Installnpm install node-red-contrib-modbus
OSAny (Node.js)
Downloadnodered.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:

  1. Download and run ModRSsim2
  2. Select MODBUS TCP/IP protocol
  3. Set Station ID = 1
  4. The simulator listens on port 502 automatically
  5. 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

TestWhat to VerifyHow
Basic readMaster reads holding registers correctlyRead 10 registers, verify values match simulator
Basic writeMaster writes to a registerWrite a value, verify it appears in the simulator
Wrong slave addressMaster handles no responseSet master to address 5, simulator to address 1
Wrong register addressSlave returns exception code 02Request a register that does not exist
Wrong function codeSlave returns exception code 01Send FC 04 to a slave that only supports FC 03
Multiple slavesMaster polls multiple addressesRun multiple simulator instances with different IDs
Timeout behaviorMaster handles slave not respondingStop the simulator, observe master timeout behavior
Large block readVerify max register countRead 125 registers in one request
Float valuesVerify 32-bit float decodingSet two consecutive registers to a known float value
CRC errors (RTU)Master handles corrupted framesDisconnect/reconnect the serial link during transfer

17. Common Simulation Problems and Fixes

ProblemCauseFix
Connection refused on port 502Simulator not running, or wrong portStart the simulator first. Verify port 502.
“Port 502 already in use”Another application is using port 502Close the other application or use a different port (e.g., 1502).
No response from simulatorWrong slave addressVerify master and simulator use the same Unit ID.
All registers read as 0Default values not setSet register values in the simulator before connecting.
Exception code 02Register address out of rangeCheck the register range configured in the simulator.
Float values show garbageWrong byte orderTry swapping byte order (AB CD vs CD AB) in your master.
RTU communication failsBaud rate or parity mismatchVerify both sides use identical serial settings.
Firewall blocking port 502Windows FirewallAllow 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

Author: Zakaria El Intissar

I'm an automation and industrial computing engineer with 12 years of experience in power system automation, SCADA communication protocols, and electrical protection. I build tools and write guides for Modbus, DNP3, IEC 101/103/104, and IEC 61850 on ScadaProtocols.com to help engineers decode, analyze, and troubleshoot real industrial communication systems.

Leave a Reply

Your email address will not be published. Required fields are marked *