{"id":18397060,"url":"https://github.com/idatum/xbee-mpy","last_synced_at":"2026-04-29T00:33:31.871Z","repository":{"id":179966261,"uuid":"664379591","full_name":"idatum/xbee-mpy","owner":"idatum","description":"MicroPython code to control Digi XBee Series 2C devices with a microcontroller.","archived":false,"fork":false,"pushed_at":"2023-07-09T20:46:53.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-29T06:37:57.394Z","etag":null,"topics":["micropython","micropython-rpi-pico","raspberry-pi-pico","rp2040","xbee","xbee-api","xbee-radio","xbee-zb","zigbee"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idatum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2023-07-09T19:53:11.000Z","updated_at":"2025-05-15T21:24:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"44a48015-e946-4bc3-8bdc-786db88b6f44","html_url":"https://github.com/idatum/xbee-mpy","commit_stats":null,"previous_names":["idatum/xbee-mpy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/idatum/xbee-mpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idatum%2Fxbee-mpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idatum%2Fxbee-mpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idatum%2Fxbee-mpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idatum%2Fxbee-mpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idatum","download_url":"https://codeload.github.com/idatum/xbee-mpy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idatum%2Fxbee-mpy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32405901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["micropython","micropython-rpi-pico","raspberry-pi-pico","rp2040","xbee","xbee-api","xbee-radio","xbee-zb","zigbee"],"created_at":"2024-11-06T02:15:41.964Z","updated_at":"2026-04-29T00:33:31.866Z","avatar_url":"https://github.com/idatum.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## XBee MicroPython\n### [MicroPython](https://micropython.org/) code to control [Digi XBee](https://www.digi.com/products/embedded-systems/digi-xbee/rf-modules/2-4-ghz-rf-modules/xbee-zigbee) Series 2C devices with a microcontroller.\n\nDigi's newer XBee3 already has MicroPython and I've found it to be a great little microcontroller. One use is monitoring my laundy: [xbee3-laundry](https://github.com/idatum/xbee3-laundry). However, I still have a couple XBee Series 2C devices around that I like to interface with various microcontrollers. I recently spent a Saturday giving micropython a try on my [Raspberry Pi Pico](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html) and couldn't find an existing XBee API implementation. **xbee-mpy** is my own implementation based on Digi's documentation of their ZigBee API. I did something similar for C# with [xbeesharp](https://github.com/idatum/xbeesharp).\n\n**xbee-mpy** allows my Pico to transmit data as well as receive messages over an XBee ZigBee mesh network. Specifically, this implementation handles transmit and receive packets, both escaped and unescaped. Any other microcontroller running MicroPython with a UART should be able to use this code with an Xbee.\n\nHere is a simple example that waits to receive a \"blink\" message to toggle the Pico LED and transmits an acknowledge back:\n```\nfrom time import sleep\nfrom machine import Pin\nfrom machine import UART\nfrom xbee_serial import XbeeSerial\nimport xbee_frame\nimport xbee_frame_builder as builder\n\nled = Pin(\"LED\", Pin.OUT)\nxbs = XbeeSerial(UART(0, baudrate=115200), escaped=True)\nrx_frame = xbs.receive()\nif rx_frame.get_rame_type() == xbee_frame.FRAME_TYPE_RECEIVE:\n    src_addr = rx_frame.get_source_address()\n    msg = rx_frame.get_receive_data().decode()\n    if msg == \"blink\":\n        led.toggle()\n        sleep(.5)\n        led.toggle()\n        tx_frame = builder.create_transmit_frame(address=src_addr,\n                                                 frame_id=1,\n                                                 tx_data=\"ACK blink\".encode(),\n                                                 escaped=True)\n        xbs.transmit(tx_frame)\n```\n\nIt can use some optimization around allocating the bytes, maybe pre-allocating a bytearray once the packet length field is received.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidatum%2Fxbee-mpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidatum%2Fxbee-mpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidatum%2Fxbee-mpy/lists"}