{"id":13801918,"url":"https://github.com/eydam-prototyping/mp_modbus","last_synced_at":"2026-04-07T16:04:32.430Z","repository":{"id":155408036,"uuid":"388439556","full_name":"eydam-prototyping/mp_modbus","owner":"eydam-prototyping","description":"Modbus Lib for Micropython","archived":false,"fork":false,"pushed_at":"2021-09-16T14:02:07.000Z","size":55,"stargazers_count":11,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-22T12:33:28.566Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/eydam-prototyping.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}},"created_at":"2021-07-22T11:34:03.000Z","updated_at":"2023-12-08T02:01:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0aeac10-68ba-436c-94de-edc69155831e","html_url":"https://github.com/eydam-prototyping/mp_modbus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eydam-prototyping%2Fmp_modbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eydam-prototyping%2Fmp_modbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eydam-prototyping%2Fmp_modbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eydam-prototyping%2Fmp_modbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eydam-prototyping","download_url":"https://codeload.github.com/eydam-prototyping/mp_modbus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253942494,"owners_count":21988066,"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":[],"created_at":"2024-08-04T00:01:30.333Z","updated_at":"2026-04-07T16:04:32.407Z","avatar_url":"https://github.com/eydam-prototyping.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Communications"],"readme":"# mp_modbus\nModbus Lib for Micropython\n\n## mp_modbus_frame\n\nCreate a modbus frame (you shouldn't have to do it by yourself):\n  ```python\n  from mp_modbus_frame import modbus_rtu_frame, modbus_tcp_frame\n\n  # RTU\n  rtu_frame = modbus_rtu_frame(\n      device_addr=1,    # slave address\n      func_code=3,      # function code\n      register=100,     # requested register\n      length=2,         # number of requested registers\n      fr_type=\"request\" # type of frame\n    )\n\n  # or parsing:\n  rtu_frame = modbus_rtu_frame.parse_frame(\n    bytearray([0x01, 0x03, 0x00, 0x12, 0x00, 0x08, 0xe4, 0x09])\n    )\n\n  # TCP\n  tcp_frame = modbus_tcp_frame(\n      transaction_id=1, # transaction id\n      unit_id=1,        # unit id\n      device_addr=1,    # slave address\n      func_code=3,      # function code\n      register=100,     # requested register\n      length=2,         # number of requested registers\n      fr_type=\"request\" # type of frame\n    )  \n\n  # or parsing:\n  tcp_frame = modbus_tcp_frame.parse_frame(\n    bytearray([0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x01, 0x03, \n        0x00, 0x12, 0x00, 0x08])\n    )\n  ```\n## mp_modbus_master\n\nRTU-Master or TCP-Client:\n```python\nfrom mp_modbus_master import modbus_rtu_master, modbus_tcp_client\n\n# RTU\nrtu_master = modbus_rtu_master(\n  uart_no=2, parity=0, tx_pin=12, rx_pin=13, en_pin=32\n  )\n\nframe = rtu_master.read_holding_registers(305, 1)\nprint(frame.data)\n\n# TCP\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feydam-prototyping%2Fmp_modbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feydam-prototyping%2Fmp_modbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feydam-prototyping%2Fmp_modbus/lists"}