Modbus Master and Slave Simulators

(updated July 2023)

I needed to learn about Modbus recently, although I’m in the heart of Canada’s SCADA-rich Oil and Gas country, Modbus has somehow eluded me up to now.

Modbus is a communication protocol for industrial devices developed in 1979 by Modicon, now Schneider Electric. It was designed for communicating with programmable logic controllers (PLCs), but has since become popular for industrial sensors and instruments in general. Modbus.org, a U.S. non-profit trade association, now controls the Modbus protocol and provides free access to protocol specifications and technical resources

The protocol was originally described in terms of a (typically) single Master and multiple Slaves on an RS-485 bus. The Master polls a slave for register values it wants, and a Slave only responds when addressed by a Master. The protocol was recently re-defined using Client/Server terminology. A Slave is now called a Server because it provides data, and a Master is now called a Client because it requests data.

When developing a device which will communicate using Modbus, it can be helpful to use a Client or Server simulator for testing or comparison. You can use one of the many available complete simulators, modify an existing open-source project to meet your needs, or roll your own bespoke solution using an open-source Modbus library.

Client (Master) Simulators

A Modbus Client (Master) simulator is used to query data from devices and can be a valuable test when developing a Modbus Server (Slave) device. A large number of Master simulators are readily available, including free of charge, open source, and commercial software.

Free Client (Master) Simulators

Modpoll from proconX is a free proprietary Windows command-line program supporting Modbus ASCII, RTU and TCP. Modpoll is a demonstration utility for proconX’s commercial driver libraries, and could be considered a defacto standard from the number of references to it on the web.

ModbusScope is a free open-source cross-platform app for capturing and graphing Modbus data. In the past, I would capture Modbus data using Modpoll and hammer the output into CSV with sed, or use ModScan to capture CSV directly, and plot using using either DatPlot or spreadsheet software. However, thanks to a recomendation from Ben, ModbusScope is now my go-to plotting app. ModbusScope is a Qt app and coded in C++, and it uses muparser (“fast math parser library”) and QCustomplot (“easy to use plotting widget for Qt”), and icons from Lucide.

CAS Modbus Scanner is a free proprietary application recommended by Steven. It can retrieve coils, inputs, holding registers, and input registers (displaying values in a variety of formats), and also discover Modbus devices on a network (testing every address, function, length, and offset to check for exceptions or responses). I used CAS Modbus Scanner to assist in verification testing for the Modbus interface of a new industrial controller.

QModMaster is a free open-source Qt-based Modbus master based on libmodbus (see Libraries below). QModMaster is licensed using the LGPL and includes a bus monitor for examining traffic on the bus. 

Modbus Tester from Schneider Electric is a free proprietary Windows GUI program for reading Modbus registers. It supports Modbus RTU and TCP.

RMMS (Radzio! Modbus Master Simulator) is a free proprietary Windows utility (GUI) and claims to replace commercial ModScan and Modbus Poll utilities. It supports Modbus RTU and TCP, and multiple Modbus slave devices. 

Commercial Client (Master) Simulators

Simply Modbus Master (RTU and ASCII ). The Free mode allows six request messages before the application must be re-started. C$60. A slave simulator and TCP client are also available. The website has a nice intro to Modbus and Modbus Enron.

Modbus Poll from modbus tools was designed to help developers of Modbus slave devices and others to test and simulate the Modbus protocol. Using a multiple document interface, several Modbus slaves and/or data areas can be monitored at the same time. US$129 per developer. The modbus tools website also has a good intro to Modbus.

ModScan from WinTECH Software was developed to verify correct protocol operation in new or existing systems. Extensions provide third-party data acquisition using Control Automation routines or the MS Jet Database engine.  A debug mode displays raw serial data to and from a connected device, and ModScan32 can execute test scripts with stimulus messages and expected responses for production testing. Single user license US$64.95. WinTech also provide a number of other Modbus-related utilities. 

Server (Slave) Simulators

A Server (Slave) simulator provides a source of data for a Modbus Master, and can be useful as a known source of data when setting up a test workflow for a device being developed. A Slave simulator can also be used to create a model of a new device being developed, and act as both the development specification and a source of expected behavior for validating the device being developed.

Free Server (Slave) Simulators

ModRSsim2 was forked from MOD_RSSIM and seems to be the more active of the two now with a number of updates including compiling on Visual Studio 2010. ModRSsim2 supports RS-232 and TCP/IP connections, the full range of Modbus addresses for all four Modbus types (0xxxxx, 1xxxx, 3xxxx, & 4xxxx addresses), as well as diagnostics with complete traffic byte capture and logging capability. ModRSsim2 supports CSV loading and a scripting environment for testing as well as HTML custom displays. It is free and open-source, and licensed under the GPL.

pyModSlave is a free and open-source Qt-based Python-code ModBus RTU and TCP slave from the developer of QModMaster. A Windows executable is provided and pyModSlave includes a bus monitor for examining all traffic on the bus. pyModSlave is licensed under the LGPL

MOD_RSSIM is a Windows-based Modbus PLC Simulator (and basis of ModRSsim2 above). It is free and open-source, and started as a test program for a SCADA/HMI with Modbus RTU and TCP/IP. Typical uses are to verify device configuration, support development of Modbus master and slave drivers for embedded and desktop platforms, and as an educational tool to learn Modbus protocols. 

UnSlave Modbus Slave Simulator . UnSlave simulates any number of Modbus slaves. UnSlave is provided free from Unserver, possibly as a source of test data for Unserver’s Modbus REST API Server, which provides data from Modbus networks and devices to higher-level clients – and is monetized. The Unserver website includes a nice Complete Modbus Guide.

Commercial Server (Slave) Simulators

WinModbus. Modbus Slave Simulator for Windows. GBP62.50. Lifetime support. 14-day functional demo for evaluation. Polished website.

SimServe by SCADAmatic can simulate Modbus ASCII, RTU, or TCP/IP. It provides a user interface for setting up a network topology of multiple devices simultaneously. The developer James brought it to my attention, and was kind enough to provide a guest key for evaluation. SimServe could be a valuable development aid if you are developing SCADA software and need simulated devices for testing, or if you are developing a device and could benefit from having a digital twin for comparison (assuming SimServe is capable of simulatingyour device).

Libraries

A number of Modbus libraries are available to leverage application development.

FreeMODBUS is a free open-source implementation of the Modbus protocol with separate ASCII/RTU and TCP ports for a variety of embedded systems. I can recommend FreeMODBUS based on first-hand experience replacing a DIY protocol stack in an embedded industrial controller with an 8-bit MPU. FreeMODBUS is licensed using the BSD 3-clause license. 

libmodbus is a free open-source library for Linux, Mac OS X, FreeBSD, QNX and Win32. The library is written in C, supports RTU (serial) and TCP (Ethernet) communications, and is licensed using the BSD 3-clause license. 

Other Resources

Peter Chipkin has a nice list of various Modbus-related tools.

com0com is a free open-source kernel-mode virtual serial port driver for Windows. An unlimited number of virtual COM port pairs can be created, and any pair can be used to connect one COM port based application to another. The module is signed with a test certificate, and requires configuring Windows to load test-signed boot modules.