ESP-Modbus
The Espressif ESP-Modbus Library (esp-modbus) supports Modbus communication in the networks based on RS485, Wi-Fi, Ethernet interfaces.
Options Of Usage
There are two options for using the ESP-Modbus library in your projects:
Using the
freemodbuscomponent included in the current release of ESP-IDF.The ESP-IDF component
freemodbusincluded in this release reflects theesp-modbuscomponent of version v1.0.7. This release of the component is used by default in the existing examples mentioned below on this page.The downside of this option is that the
freemodbuscomponent may not contain the latest fixes from esp-modbus repository. Because of this, it is recommended to use the originalesp-modbuscomponent for new projects (the option 2).Using the
esp-modbuscomponent via the component manager instead offreemodbus.Additional information for the
ESP-Modbuscomponent can be found in the separate repository:In order to use
esp-modbuscomponent, your application must include the statement below in itsCMakeLists.txtfile to exclude thefreemodbuscomponent from the build. The excluding of thefreemodbuscomponent is required to avoid compilation issues whenesp-modbusis used in conjunction with the component manager.set(EXCLUDE_COMPONENTS freemodbus)If your project uses the make build system, the statement below needs to be added into project Makefile:
EXCLUDE_COMPONENTS := freemodbusThe
maincomponent folder of the new application shall include the component manager manifest fileidf_component.ymlas below:dependencies: idf: ">=4.1" espressif/esp-modbus: version: "^1.0"This option allows to use the latest
esp-modbuscomponent updates in any projects based on ESP-IDF versions from v4.1 up to v5.0. Refer to component manager documentation for more information on how to set up the component manager. Theesp-modbuscomponent can be found in component manager registry.
Managed Documentation
The component documentation can be found on the link below:
Application Example
The examples below demonstrate the ESP-Modbus library of serial, TCP ports for slave and master implementations accordingly.
Please refer to the specific example README.md for details.