{"id":14963857,"url":"https://github.com/emelianov/modbus-esp8266","last_synced_at":"2025-09-30T19:30:32.968Z","repository":{"id":37618129,"uuid":"99654102","full_name":"emelianov/modbus-esp8266","owner":"emelianov","description":"Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.","archived":false,"fork":true,"pushed_at":"2024-10-27T13:03:37.000Z","size":533,"stargazers_count":543,"open_issues_count":30,"forks_count":191,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-01-20T09:37:34.569Z","etag":null,"topics":["arduino-library","esp32","esp8266","modbus","modbus-client","modbus-library","modbus-master","modbus-protocol","modbus-rtu","modbus-serial","modbus-server","modbus-slave","modbus-tcp","modbus-tcp-security"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"andresarmento/modbus-esp8266","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emelianov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":"https://paypal.me/modbus?locale.x=en_US"}},"created_at":"2017-08-08T05:37:12.000Z","updated_at":"2025-01-09T13:54:42.000Z","dependencies_parsed_at":"2023-02-01T05:01:06.014Z","dependency_job_id":null,"html_url":"https://github.com/emelianov/modbus-esp8266","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/emelianov/modbus-esp8266","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emelianov%2Fmodbus-esp8266","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emelianov%2Fmodbus-esp8266/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emelianov%2Fmodbus-esp8266/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emelianov%2Fmodbus-esp8266/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emelianov","download_url":"https://codeload.github.com/emelianov/modbus-esp8266/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emelianov%2Fmodbus-esp8266/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277746946,"owners_count":25870056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino-library","esp32","esp8266","modbus","modbus-client","modbus-library","modbus-master","modbus-protocol","modbus-rtu","modbus-serial","modbus-server","modbus-slave","modbus-tcp","modbus-tcp-security"],"created_at":"2024-09-24T13:32:14.567Z","updated_at":"2025-09-30T19:30:32.664Z","avatar_url":"https://github.com/emelianov.png","language":"C++","funding_links":["https://paypal.me/modbus?locale.x=en_US"],"categories":[],"sub_categories":[],"readme":"# Modbus Library for Arduino\r\n### ModbusRTU, ModbusTCP and ModbusTCP Security\r\n\r\nFor detailes on the library usage visit [documentation](documentation) section.\r\n\r\n## Features\r\n\r\n* Supports all Arduino platforms\r\n* Operates in any combination of multiple instances of\r\n  * [Modbus RTU server](examples/RTU)\r\n  * [Modbus RTU client](examples/RTU)\r\n  * Modbus TCP server for [ESP8266/ESP32](examples/TCP-ESP) and [Ethernet library](examples/TCP-Ethernet)\r\n  * Modbus TCP client for [ESP8266/ESP32](examples/TCP-ESP) and [Ethernet library](examples/TCP-Ethernet)\r\n  * [MODBUS/TCP Security server (ESP8266)](examples/TLS)\r\n  * [MODBUS/TCP Security client (ESP8266/ESP32)](examples/TLS)\r\n* Modbus functions supported:\r\n  * 0x01 - Read Coils\r\n  * 0x02 - Read Input Status (Read Discrete Inputs)\r\n  * 0x03 - Read Holding Registers\r\n  * 0x04 - Read Input Registers\r\n  * 0x05 - Write Single Coil\r\n  * 0x06 - Write Single Register\r\n  * 0x0F - Write Multiple Coils\r\n  * 0x10 - Write Multiple Registers\r\n  * 0x14 - Read File Record\r\n  * 0x15 - Write File Record\r\n  * 0x16 - Mask Write Register\r\n  * 0x17 - Read/Write multiple registers\r\n* [Callbacks](examples/Callback) driven design\r\n* Real life complex examples:\r\n  * [ESP8266/ESP32 firmware update over Modbus](examples/Files)\r\n  * [ModbusRTU to ModbusTCP bridge](examples/Bridge)\r\n\r\n## Notes\r\n\r\n1. The offsets for registers are 0-based. So be careful when setting your supervisory system or your testing software. For example, in [ScadaBR](http://www.scadabr.com.br) offsets are 0-based, then, a register configured as 100 in the library is set to 100 in ScadaBR. On the other hand, in the [CAS Modbus Scanner](http://www.chipkin.com/products/software/modbus-software/cas-modbus-scanner/) offsets are 1-based, so a register configured as 100 in library should be 101 in this software.\r\n2. RS-485 transivers based on MAX-485 is working on at least up to 115200. XY-017/XY-485 working only up to 9600 for some reason.\r\n\r\nFor more information about Modbus see:\r\n\r\n* [Modbus (From Wikipedia, the free encyclopedia)](http://pt.wikipedia.org/wiki/Modbus)\r\n* [MODBUS APPLICATION PROTOCOL SPECIFICATION V1.1b3](https://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf)\r\n* [MODBUS MESSAGING ON TCP/IP IMPLEMENTATION GUIDE V1.0b](http://www.modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf)\r\n* [MODBUS over Serial Line Specification and Implementation Guide V1.02](http://www.modbus.org/docs/Modbus_over_serial_line_V1_02.pdf)\r\n* [MODBUS/TCP Security Protocol Specification](https://modbus.org/docs/MB-TCP-Security-v21_2018-07-24.pdf)\r\n\r\n## Last Changes\r\n\r\n```diff\r\n// 4.1.1\r\n+ Protocol: Fix wrong error code responce on non-existent register\r\n+ ModbusTCP: Fix potential memory leak\r\n+ API: cbEnable/cbDisable functionality extended\r\n+ ESP-IDF: CMakeList.txt added\r\n+ Examples: TCP-to-RTU fixed\r\n// 4.1.0\r\n+ API: Raw Modbus frame processing functionality\r\n+ ModbusRTU: Precise inter-frame interval control\r\n+ Examples: True ModbusRTU to ModbusTCP Server bridge\r\n+ Examples: ModbusRTU respond to multiple ID from single device\r\n+ ModbusRTU: Add direction control pin for Stream\r\n+ STL: Add Reg count limitation to vector limit of 4000 (for ESP8266 and ESP32)\r\n+ Settings: Added MODBUSIP_CONNECTION_TIMEOUT (ESP32 only)\r\n+ Settings: Set MODBUSIP_MAX_CLIENTS = 8 for ESP32\r\n+ ModbusTCP: Make using DNS names optional feature\r\n+ ModbusRTU: Add separate RE/DE pins control optional feature\r\n+ API: Drop support of Ethernet library v1\r\n+ Examples: Teknic ClearCore ArduinoWrapper examples added\r\n+ Examples: ModbusTCP to ModbusRTU example added\r\n+ ModbusRTU: Flush extra delay optional feature\r\n// 4.0.0\r\n+ Support of all Arduino boards\r\n+ ModbusTLS: ESP8266 Client/Server and ESP32 Client\r\n+ ModbusTCP: ModbusEthernet - WizNet W5x00, ENC28J60 Ethernet library support\r\n+ 0x14 - Read File Records function\r\n+ 0x15 - Write File Records function\r\n+ Examples: FW update over Modbus fullfunctional example\r\n+ 0x16 - Write Mask Register function+ Test: 0x16\r\n+ 0x17 - Read/Write Registers function\r\n+ ModbusRTU: ESP32 SoftwareSerial support\r\n+ Build with no STL dependency (switchable)\r\n+ API: ModbusIP =\u003e ModbusTCP\r\n+ API: Access control callback for individual Modbus function\r\n+ API: Master/Slave =\u003e Client/Server according to [PRESS RELEASE](https://modbus.org/docs/Client-ServerPR-07-2020-final.docx.pdf)\r\n+ Lot of code refacting and small fixes\r\n```\r\n\r\n## Roadmap\r\n\r\n```diff\r\n// 4.2.0\r\n- API: Alternative CRC calulation (reduced memory footprint)\r\n- ModbusRTU: Static buffer allocation\r\n- Test: Frame accuracy to specefication\r\n- Buffer/packet size limitation support\r\n- Slave/Server: slavePDU use early exit by return where possible\r\n- Master/Client: Check frame size against header data where possible\r\n- Master/Client: Additional responce data validation\r\n- Free global registers and callbacks on remove last Modbus instance\r\n- Test: push/pull functions\r\n- ModbusTCP: Refactor connect by dns name (using native implementation for ESP32 etc)\r\n// 4.3.0\r\n- ModbusTLS: ESP32 Server\r\n- Test: TLS ESP32 Server\r\n- Test: TLS ESP32 Client\r\n- Examples: TLS Certificate test Role extension and Alt-Name\r\n- Examples: TLS Add example explanation\r\n- ModbusTCP: ModbusAsyncTCP\r\n- API: Extend API to allow custom Modbus commands\r\n- Examples: Basic file operations\r\n- Examples: Revising\r\n```\r\n## Contributions\r\n\r\nhttps://github.com/emelianov/modbus-esp8266\r\n\r\na.m.emelianov@gmail.com\r\n\r\nOriginal version:\r\n\r\nhttps://github.com/andresarmento/modbus-esp8266\r\n\r\nhttps://github.com/andresarmento/modbus-arduino\r\n\r\nprof (at) andresarmento (dot) com\r\n\r\n## License\r\n\r\nThe code in this repo is licensed under the BSD New License. See LICENSE.txt for more info.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femelianov%2Fmodbus-esp8266","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femelianov%2Fmodbus-esp8266","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femelianov%2Fmodbus-esp8266/lists"}