stephane/libmodbus
FreeA Modbus library for Linux, Mac OS, FreeBSD and Windows
FreeFree tier
About stephane/libmodbus
libmodbus is a free, open-source C library implementing the Modbus protocol for communication with industrial automation devices. It supports both serial (RS-232/RS-485) and Ethernet (TCP) connections, making it suitable for a wide range of modbus devices such as PLCs, sensors, and actuators. The library is licensed under LGPL v2.1 or later and runs on Linux, macOS, FreeBSD, Embox, QNX, and Windows. It includes a unit test suite and provides a pkg-config file for easy integration into build systems. The project is maintained on GitHub with a growing community.
Key Features
Supports both serial (RS-232/RS-485) and Ethernet (TCP) Modbus connections
Written in C for high performance and low-level control
Cross-platform: Linux, macOS, FreeBSD, Embox, QNX, Windows
Licensed under LGPL v2.1 or later, free for commercial and open-source projects
Includes unit test suite for validation
Provides libmodbus.pc file for integration via pkg-config
Pros & Cons
Pros
- Free and open-source software, no licensing costs
- Portable across major operating systems and embedded platforms
- Well-established protocol implementation derived from Modicon guide
- Unit tests provided for validation and regression testing
- Active GitHub repository with community contributions and issue tracking
- Easy integration via pkg-config and standard autotools build system
Cons
- Requires C programming knowledge to use effectively
- Documentation is hosted on separate website (libmodbus.org), not directly in repo
- Build process relies on autotools (autoconf, automake, libtool) which may be unfamiliar to some developers
- Limited to Modbus protocol; not a general-purpose communication library
Best For
Communicating with programmable logic controllers (PLCs) and RTUs in industrial automationReading data from Modbus-compatible sensors and actuatorsBuilding custom SCADA or monitoring systemsEmbedded systems development with MCUs running Embox RTOSHome automation and building management systems using Modbus devices
FAQ
What is libmodbus?
libmodbus is a free software library to send/receive data with a device that respects the Modbus protocol. It can use a serial port or an Ethernet connection.
What license does libmodbus use?
libmodbus is licensed under the LGPL v2.1 or later.
Which operating systems are supported?
libmodbus runs on Linux, Mac OS X, FreeBSD, Embox, QNX, and Windows. It can also be used on MCUs with Embox RTOS.
How do I install libmodbus?
You need automake, autoconf, libtool, and a C compiler. Run './autogen.sh' to generate configure, then './configure' and 'make install'. You can change the installation prefix with '--prefix'.
Is libmodbus free?
Yes, libmodbus is free software (open source) and can be used without cost.