{"id":26225980,"url":"https://github.com/mrmoses1911/modbusrtu_esp32","last_synced_at":"2026-04-15T14:38:52.612Z","repository":{"id":262947014,"uuid":"888693880","full_name":"MrMoses1911/ModbusRTU_ESP32","owner":"MrMoses1911","description":"Modbus RTU library for ESP32 or Arduino Based Development Boards","archived":false,"fork":false,"pushed_at":"2025-03-06T14:44:43.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-06T15:30:52.460Z","etag":null,"topics":["arduino","arduino-library","esp32","modbus","modbus-rtu"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MrMoses1911.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-14T20:56:26.000Z","updated_at":"2025-03-06T14:44:46.000Z","dependencies_parsed_at":"2024-11-15T07:30:08.353Z","dependency_job_id":"c5a1c6cf-844f-45bb-a177-e1a9948ad4fd","html_url":"https://github.com/MrMoses1911/ModbusRTU_ESP32","commit_stats":null,"previous_names":["mrmoses1911/esp32-modbusrtu-slave","mrmoses1911/modbusrtu_max485","mrmoses1911/modbusrtu_esp32"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrMoses1911%2FModbusRTU_ESP32","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrMoses1911%2FModbusRTU_ESP32/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrMoses1911%2FModbusRTU_ESP32/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MrMoses1911%2FModbusRTU_ESP32/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MrMoses1911","download_url":"https://codeload.github.com/MrMoses1911/ModbusRTU_ESP32/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243277245,"owners_count":20265352,"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","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","arduino-library","esp32","modbus","modbus-rtu"],"created_at":"2025-03-12T19:18:28.172Z","updated_at":"2025-12-26T15:10:42.083Z","avatar_url":"https://github.com/MrMoses1911.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ModbusRTU_ESP32 Library\n\nThe **ModbusRTU_ESP32 Library** enables any ESP32 to function as a Modbus RTU slave device using the RS-485 protocol. This library is specifically designed for industrial applications where communication with PLCs, HMIs, or other Modbus master devices is required.\n\n## Features\n- Supports RS-485 communication via the MAX 485 or MAX 1487 transceivers.\n- Configurable UART pins for flexibility in hardware design.\n- Implements the following Modbus RTU functions:\n\t- **03 (Read Holding Registers):** Read multiple registers.\n\t- **06 (Write Single Register):** Write to a single register.\n\t- **16 (Write Multiple Registers):** Write to multiple registers.\n- Dynamic configuration of serial settings, including:\n\t- Baud rates.\n\t- Parity (None, Even, Odd).\n\t- Data bits (5, 6, 7, or 8).\n\t- Stop bits (1 or 2).\n- Easy-to-use API for reading and writing registers.\n\n## Hardware Requirements\n- **ESP32 or Arduino Based Development Board** for running the library.\n- **MAX 485/1487 or Equivalent RS-485 Transceiver** for RS-485 communication.\n- Pull-up and pull-down resistors, and a 120-ohm termination resistor, if needed.\n\n## Installation\nDownload or clone this repository.\nCopy the folder ModbusRTU_ESP32 to your Arduino libraries directory:\n```\n\u003cArduino Installation Directory\u003e/libraries/\n```\nRestart the Arduino IDE to apply changes.\n\n## Basic Usage\n*The Modbus communication was tested using a **WAGO Compact Controller 100** plc as a master device.*\n\n```cpp\n#include \u003cModbusRTU_ESP32.h\u003e\n\nModbusRTU_ESP32 modbus(GPIO_NUM_47, GPIO_NUM_48, GPIO_NUM_33, GPIO_NUM_34);\n\nuint16_t readData, writeData;\n\nvoid setup() {\n    //baudrate, bit configuration, slave id, number of registers\n    modbus.beginRTU(9600, SERIAL_8E1, 1, 2);\n}\n\nvoid loop() {\n    //Updates the Modbus communication\n    modbus.handleRequest();\n\n    //Set the register 0 with the \"writeData\" value\n    writeData = 155;\n    modbus.setRegister(0, writeData);\n\n    //Read the register 1 value and store it in the readData variable\n    readData = modbus.getRegister(1);\n}\n```\n\n## Examples\nCheck the **examples/** folder for ready-to-use sketches, including:\nBasic usage for reading and writing registers.\nAdvanced configuration with different UART settings.\n\n## Compatibility\nThis library is compatible with:\nArduino IDE 1.8.x and newer.\n\n## License\nThis project is licensed under the MIT License. Feel free to use, modify, and distribute it.\n\n## Contributing\nContributions are welcome! Please open an issue or submit a pull request for improvements or bug fixes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmoses1911%2Fmodbusrtu_esp32","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrmoses1911%2Fmodbusrtu_esp32","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmoses1911%2Fmodbusrtu_esp32/lists"}