{"id":13801189,"url":"https://github.com/dmazzella/uble","last_synced_at":"2026-01-18T10:48:30.721Z","repository":{"id":68705936,"uuid":"80002323","full_name":"dmazzella/uble","owner":"dmazzella","description":"Lightweight Bluetooth Low Energy driver written in pure python for micropython","archived":false,"fork":false,"pushed_at":"2018-11-29T12:52:34.000Z","size":7187,"stargazers_count":82,"open_issues_count":0,"forks_count":7,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-22T12:32:52.507Z","etag":null,"topics":["bluenrg-ms","bluetooth-low-energy","eddystone","hci","micropython","pyboard","spbtle-rf"],"latest_commit_sha":null,"homepage":"","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/dmazzella.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":"2017-01-25T09:59:50.000Z","updated_at":"2024-04-01T08:47:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"8bd11ef7-ece2-43c6-909e-9b98c208c937","html_url":"https://github.com/dmazzella/uble","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/dmazzella%2Fuble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmazzella%2Fuble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmazzella%2Fuble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmazzella%2Fuble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmazzella","download_url":"https://codeload.github.com/dmazzella/uble/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253932775,"owners_count":21986447,"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":["bluenrg-ms","bluetooth-low-energy","eddystone","hci","micropython","pyboard","spbtle-rf"],"created_at":"2024-08-04T00:01:20.424Z","updated_at":"2025-05-13T11:30:53.870Z","avatar_url":"https://github.com/dmazzella.png","language":"Python","readme":"# uble\n\nLightweight Bluetooth Low Energy driver written in pure python for micropython.\n\nWARNING: this project is in beta stage and is subject to changes of the\ncode-base, including project-wide name changes and API changes.\n\n\u003e [!TIP]\n\u003e If you find **uble** useful, consider :star: this project\n\u003e and why not ... [Buy me a coffee](https://www.buymeacoffee.com/damianomazp) :smile:\n\nFeatures\n---------------------\n\n- Parsing and Building of HCI packets\n- Allows PyBoard to control BLE chips using HCI packets\n\nUsage\n---------------------\n\n- Parsing of HCI packets:\n```python\n        MicroPython v1.8.7-79-g221f88d-dirty on 2017-01-26; PYBv1.1 with STM32F405RG\n        Type \"help()\" for more information.\n        \u003e\u003e\u003e from bluetooth_low_energy.protocols.hci import (cmd, uart)\n        \u003e\u003e\u003e buf = b'\\x01\\x03\\x0c\\x00'\n        \u003e\u003e\u003e hci_uart = uart.HCI_UART.from_buffer(buf)\n        \u003e\u003e\u003e print(hci_uart)\n        \u003cHCI_UART pkt_type=COMMAND(0x01) data=030c00\u003e\n        \u003e\u003e\u003e hci_cmd = cmd.HCI_COMMAND.from_buffer(hci_uart.data)\n        \u003e\u003e\u003e print(hci_cmd)\n        \u003cHCI_COMMAND opcode=0x0c03 ogf=HOST_CTL(0x03) ocf=RESET(0x03) request_data= response_data=\u003e\n        \u003e\u003e\u003e hci_cmd.to_buffer()\n        b'\\x03\\x0c\\x00'        \n        \u003e\u003e\u003e\n```\n        \n- Building of HCI Packets:\n```python\n        MicroPython v1.8.7-79-g221f88d-dirty on 2017-01-26; PYBv1.1 with STM32F405RG\n        Type \"help()\" for more information.\n        \u003e\u003e\u003e from bluetooth_low_energy.protocols.hci import cmd\n        \u003e\u003e\u003e hci_cmd = cmd.HCI_COMMAND(ogf=cmd.OGF_LE_CTL, ocf=cmd.OCF_LE_RAND)\n        \u003e\u003e\u003e print(hci_cmd)\n        \u003cHCI_COMMAND opcode=0x2018 ogf=LE_CTL(0x08) ocf=LE_RAND(0x18) request_data= response_data=\u003e\n        \u003e\u003e\u003e hci_cmd.to_buffer()\n        b'\\x18 \\x00'\n        \u003e\u003e\u003e\n```\n- Control BLE chips examples\n\n    With low level api:\n\n    - [basic.py](https://github.com/dmazzella/uble/blob/master/examples/basic.py): print BlueNRG FW versions\n    - [bluest_protocol.py](https://github.com/dmazzella/uble/blob/master/examples/bluest_protocol.py): implements the BlueST      protocol usable for test with 'ST BlueMS' app\n    - [eddystone.py](https://github.com/dmazzella/uble/blob/master/examples/eddystone.py): implement an Eddystone Beacon device\n    - [sensor_demo.py](https://github.com/dmazzella/uble/blob/master/examples/sensor_demo.py): usable for test with 'BlueNRG' app\n    - [firmware_update.py](https://github.com/dmazzella/uble/blob/master/examples/firmware_update/firmware_update.py): update SPBTLE-RF firmware (see [README](https://github.com/dmazzella/uble/blob/master/examples/firmware_update/README.txt))\n\n    With high level api:\n\n    - [api_eddystone.py](https://github.com/dmazzella/uble/blob/master/examples/api/api_eddystone.py): implement an Eddystone Beacon device\n    - [api_sensor_demo.py](https://github.com/dmazzella/uble/blob/master/examples/api/api_sensor_demo.py): usable for test with 'BlueNRG' app\n    - [api_scan.py](https://github.com/dmazzella/uble/blob/master/examples/api/api_scan.py): implement a Scanner object used to scan for LE devices which are broadcasting advertising data \n    - [api_hid_over_gatt.py](https://github.com/dmazzella/uble/blob/master/examples/api/api_hid_over_gatt.py): implement a HID over GATT keyboard (tested with iOS and Windows 10) \n    - [api_repl.py](https://github.com/dmazzella/uble/blob/master/examples/api/api_repl.py): implement a Bluetooth LE REPL (need _thread enabled and external dependency collections.deque already available into folder 'micropython-lib' of this repository. If found ucollections.deque use it internally)\n      Usable terminal available at [Micropython WebBluetooth REPL](https://dmazzella.github.io/htdocs/repl/)\n\n      \u003cimg src=\"https://media.giphy.com/media/xT9IgI6rvHY8d6Kjqo/source.gif\" alt=\"MicroPython_WebBluetooth_REPL\"/\u003e\n\nSoftware\n---------------------\n\nCurrently implemented full HCI commands from [STSW-BLUENRG-DK 2.0.2](http://www.st.com/en/embedded-software/stsw-bluenrg-dk.html)\n\nUser manual [BlueNRG-MS Bluetooth® LE stack application command interface](http://www.st.com/resource/en/user_manual/dm00162667.pdf)\n\nProgramming manual [BlueNRG, BlueNRG-MS stacks programming guidelines](http://www.st.com/resource/en/programming_manual/dm00141271.pdf)\n\n\n Hardware\n---------------------\n\nCurrently supported module STMicroelectronics [SPBTLE-RF](http://www.st.com/en/wireless-connectivity/spbtle-rf.html) \n\nFrom STMicroelectronics [X-NUCLEO-IDB05A1](http://www.st.com/en/ecosystems/x-nucleo-idb05a1.html):\n\n\u003cimg src=\"https://raw.githubusercontent.com/dmazzella/uble/master/hardware/X_Nucleo_IDB05A1/X_Nucleo_IDB05A1_mbed_pinout_v1.jpg\" width=\"80%\" height=\"80%\" alt=\"X_Nucleo_IDB05A1_mbed_pinout_v1\"/\u003e\n\n\nPyBoard breakout board:\n\u003c/br\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/dmazzella/uble/master/hardware/MicroPython_SPBTLERF_Breakout_v03/MicroPython_SPBTLERF_Breakout_v03_mod_TOP_and_BOTTOM.jpg\" width=\"80%\" height=\"80%\" alt=\"MicroPython_SPBTLERF_Breakout_v03_mod_TOP_and_BOTTOM\"/\u003e\n\u003c/br\u003e\n\n\nFritzing for breakout: [MicroPython_SPBTLERF_Breakout_v03_mod.fzz](https://github.com/dmazzella/uble/raw/master/hardware/MicroPython_SPBTLERF_Breakout_v03/MicroPython_SPBTLERF_Breakout_v03_mod.fzz)\n\n\nGerber for breakout: [MicroPython_SPBTLERF_Breakout_v03_mod.zip](https://github.com/dmazzella/uble/raw/master/hardware/MicroPython_SPBTLERF_Breakout_v03/MicroPython_SPBTLERF_Breakout_v03_mod.zip)\n\nIf have interest into preassembled breakout board contact me at damianomazzella@gmail.com\n\nExternal dependencies\n---------------------\n\nOnly for examples:\n'logging' already available into folder 'micropython-lib' of this repository\n\nInstall 'bluetooth_low_energy' into the pyboard\n---------------------\n\nTo enable the functionality you need to freeze the package 'bluetooth_low_energy',\nto do this, copy the package 'bluetooth_low_energy' into 'micropython-lib'.\n\nNavigate to the folder containing the repository [micropython](https://github.com/micropython/micropython):\n```bash\n        $ cd ports/stm32\n        $ make FROZEN_MPY_DIR=\"~/uble/micropython-lib\"\n```\n","funding_links":["https://www.buymeacoffee.com/damianomazp"],"categories":["Libraries"],"sub_categories":["Communications"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmazzella%2Fuble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmazzella%2Fuble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmazzella%2Fuble/lists"}