Micropython ble example. in wireless mice and keyboards.
Micropython ble example Microphone (MP34DT05) - a microphone for recording audio samples. py programs to Pico. Conclusion ESP32 BLE with MicroPython offers a powerful and accessible way to develop IoT applications. Contribute to jp-96/esp32-micropython-ble-example development by creating an account on GitHub. Communication between BLE server and client with possibility of an ack message. The thermometer value is generated randomly every second. For most # applications, we recommend using the higher-level aioble library which takes # care of all IRQ handling and connection management. Thanks. --- MicroPython Tutorials How to use BLE in MicroPython How to ESP32 Bluetooth Low Energy in MicroPython ESP32 BLE in MicroPython ESP8266 Jun 16, 2023 · Hey, I just saw that Raspberry Pi now supports Pico W Bluetooth and BLE programming in Micropython as well. 17. Anybody know what I'm doing wrong or alternatively have some example code for AIOBLE to connect to multiple bluetooth peripherals? It’s used e. ble_uart_peripheral. What you'll find here is a MicroPython program that runs on an ESP32 to collect data from the popular DHT22 temperature and humidity sensor, sending it out not only as traditional GATT characteristics, but also in BLE advertising packets that can be captured in ESPHome's Bluetooth Jul 3, 2022 · My former post show steps to MicroPython bluetooth (BLE) exampls, run on ESP32-C3 . This project is a code example, which reads the IMU information (in my case an MPU9250-this varies depending on the . Similarly, Wi-Fi and Bluetooth examples will only build on a board that includes Wi-Fi and Bluetooth support. py). I've tested this out on a Raspberry Pi Pico W. May 30, 2025 · Bluetooth and Wireless Communication Relevant source files This document covers the wireless communication systems in micropython-lib, including Bluetooth Low Energy (BLE) via the aioble framework and LoRa radio communication via the lora driver system. I can't find any information about it in the forums. x has support for BLE (but no for LAN or PPP). Oct 16, 2025 · Combining BLE with MicroPython provides a powerful and accessible way for developers to create IoT (Internet of Things) devices, wearables, and other connected projects. Jun 13, 2024 · This tutorial is a getting started guide to Bluetooth Low Energy (BLE) with the ESP32 programmed with MicroPython firmware. This blog will guide you through the fundamental concepts, usage methods, common practices, and best practices of using BLE with MicroPython. blogspot. Our aim is to read temperature and humidity data from a DHT22 sensor connected to the ESP32 and send this data wirelessly to a mobile device via BLE. - Heerkog/MicroPythonBLEHID Contribute to jp-96/esp32-micropython-ble-example development by creating an account on GitHub. This API is intended to match the low-level Bluetooth protocol and provide building-blocks for higher-level abstractions MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems - micropython/examples/bluetooth/ble_simple_peripheral. The problem could easily be solved by modifying the name parameter of advertising_payload from "micropython" to "mpy". RGB LED - a simple RGB pixel that can be controlled by setting r , g and b values. (Both run MicroPython 1. May 30, 2025 · Bluetooth Low Energy (aioble) Relevant source files This document covers the aioble framework, a comprehensive object-oriented, asyncio-based wrapper for MicroPython's Bluetooth Low Energy functionality. Took me way too long to realize this was my own gist. Currently this supports Bluetooth Low Energy (BLE) in Central, Peripheral, Broadcaster, and Observer roles, and a device may operate in multiple roles concurrently. ubluetooth — Bluetooth Low Energy ¶ The module provides Bluetooth Low Energy control interface. Hardware Requirements ESP32 development board micropython / examples / bluetooth / ble_bonding_peripheral. One ESP32 is going to be the server, and the other ESP32 will be the client. Sep 1, 2023 · Coding Now that we understand the basics of BLE-Roles and the common protocols that are being used, we can now start creating our temperature-reading code example. 5" ESP32. # This example finds and connects to a peripheral running the # UART service (e. The `ubluetooth` module in MicroPython provides support for Bluetooth Low Energy (BLE) functionality, allowing microcontrollers to communicate wirelessly with other BLE devices Pico_w_ble_uart A simple BLE UART module for Pico W This isn't my own work, the guts of the code come straight from the MicroPython BLE examples. py example. Note: There are also additional examples for the RP2040 port of MicroPython here in the upstream MicroPython repo. This repository contains a collection of MicroPython examples and modules for utilizing Bluetooth on the Raspberry Pi Pico W and WH. Where would one find such an example? Generic OnOff Example Generic OnOff model is one of the simplest model in BLE Mesh. It's a wrapper over bluetooth library and there are some examples to get you started. These libraries provide comprehensive support for short-range BLE connectivity and long-range LoRa radio communication for IoT applications This buffer is global to the entire BLE driver and so handles incoming data for all events, including all characteristics. not bad. However, the official firmware version built with ESP-IDF v4. ESP32 Bluetooth Low Energy Client and Server Feb 26, 2024 · For that peripheral example, there is also a gatt client (central) example ble_simple_central. A project example is included that uses the BLE module to send the data of the IMU and the buttons' states and to receive a variable value in order to switch on/off the display. The documentation and example code for using Bluetooth with MicroPython have only recently been published. So here is a simple example in Python that implements a URT device. Aug 26, 2024 · In this tutorial, we'll learn how to manage and test BLE (Bluetooth Low Energy) communication on an ESP32 with MicroPython. I have a set-up in python now that uses a Zero W to read the data from an Inkbird THS-IB2 sensor and email if the temp is getting to high. The library has been tested using an ESP32 development board (TinyPICO) as the peripheral and Windows 10 as the central. py Cannot retrieve latest commit at this time. Aug 31, 2024 · Bluetooth Low Energy (BLE) is a powerful technology that enables devices to communicate wirelessly over short distances. In other words, the Client can send on/off commands to one/all nodes, and the Server is records state changes based on these commands. This blog will provide a detailed overview of ESP32 MicroPython Bluetooth HID, including fundamental concepts, usage methods, common practices, and best practices. 0) Jul 8, 2024 · On the basis of the example shown above, I developed a MicroPython application in Thonny that sends few data in advertising mode and it works! Now, the problem is that I need to transmit in extended adverting mode, since the amount of data to transmit (each 90 seconds) is about 80 bytes. I will use the Pico W as a Peripheral device (it will sense temperature data and serve it to a central device) by using the official micropython-lib package aioble. Read pushbutton status and control an LED with Android app. The BLE server advertises characteristics that contain sensor readings that the client can read. We've added BLE support to CircuitPython which makes it super simple to get started! Nov 11, 2021 · Make a BLE (Bluetooth Low Energy) connection between two ESP32 boards. py. Jun 19, 2023 · Learn how to use the onboard Bluetooth on Raspberry Pi Pico W using MicroPython. - raspberrypi/pico-micropython-examples Jul 20, 2023 · Based on the official peripheral sensor example, I need to also receive data. biemster commented on Jan 11 I searched for a BLE scanner two years later, found this and thinking this person made exactly what I need. A few aioble (asyncio BLE) examples of MicroPython using esp32 - ekspla/micropython_aioble_examples Dec 9, 2023 · If I try to start a second connection whilst the first connection is in the "async with connection" section of the code, it crashes. - raspberrypi/pico-micropython-examples The majority of examples are applicable to both RP2040 and RP2350 based boards, however certain examples that use chip-specific functionality will only build on that platform. Oct 16, 2025 · Conclusion Running MicroPython BLE examples is a great way to quickly prototype and develop IoT applications. This project is for advanced users of MicroPython on the Raspberry Pi Pico so I will make a few assumptions about your current This library provides an object-oriented, asyncio-based wrapper for MicroPython's bluetooth API. One carrier board for the radio module (XBIB-U-DEV or XBIB-C board). MicroPython Examples Examples to accompany the "Raspberry Pi Pico Python SDK" book published by Raspberry Pi Ltd, which forms part of the technical documentation in support of Raspberry Pi Pico and the MicroPython port to RP2040. I've just wrapped it up in a module so it's easy to use. In this example, the BLE profile we have chosen allows us to simulate a thermometer and turn an LED on or off. Oct 16, 2025 · Combining MicroPython with the nRF52832 allows developers to quickly prototype and develop BLE applications without having to deal with the complexities of low - level programming languages like C or C++. The easiest way! We will explore the fantastic world of Physical Computing by programming tiny devices such as the XIAO BLE Sense using CircuitPython! Dec 18, 2024 · Board Specific Features The Nano BLE Sense has a number of board-specific features that can be accessed through MicroPython: Built-in LED - a small single pixel LED on the board. BLE Client example: MicroPython bluetooth (BLE) exampls, run on ESP32-C3. By understanding the fundamental concepts, setting up the environment correctly, and following common and best practices, you can efficiently use MicroPython to interact with BLE devices. py at master · micropython/micropython This article helps you enable the Bluetooth (BLE) module on the M5Stack running MicroPython. This buffer is global to the entire BLE driver and so handles incoming data for all events, including all characteristics. A lightweight MicroPython demo showing how to: Expose a Nordic UART Service (NUS) over BLE Control the onboard LED Read temperature & humidity from an HDC1080 sensor Ideal for prototyping sensor-to-mobile IoT applications. Thank you. Platform and board information are passed to the CMake build via the PICO_PLATFORM and PICO_BOARD variables Human Interface Device (HID) over Bluetooth Low Energy (BLE) GATT library for MicroPython. An App class to run the main application logic, including pin interrupts and Watchdog Timer (WDT) integration. py sends arbitrary (short) strings to a connected device. py from the pico-micropython-examples GitHub Repository. This API is intended to match the low-level Bluetooth protocol and provide building-blocks for higher-level abstractions Aug 5, 2022 · Hello all I am so excited to see Bluetooth support for Pico W! I would very much like to use it in my project. It includes: A BLE class to handle Bluetooth Low Energy (BLE) operations. py at master · micropython/micropython Aug 24, 2023 · We’ll use the example pico_ble_temperature_sensor. In this blog post, we will explore how to run MicroPython nRF52832 BLE examples. A few aioble (asyncio BLE) examples of MicroPython using esp32 - ekspla/micropython_aioble_examples # This example finds and connects to a BLE temperature sensor (e. micropython_aioble_examples - A few aioble (asyncio BLE) examples of MicroPython using ESP32. 19. # This example demonstrates the low-level bluetooth module. Alternatively, just copy and adapt one of the examples in the MicroPython github repository. I also tested it with MicroPython recently, and found it to be quite easy (albeit not documented directly as a use-case). In the future I hope to send JSON objects in an optimized way to control the Pico W Contribute to makeuseofcode/Raspberry-Pi-Pico-W-WH-Bluetooth-Example-in-MicroPython development by creating an account on GitHub. For hardware, I'm using the Elecrow 3. Nothing fancy but it will get something Dec 18, 2024 · Arduino Nano 33 BLE Arduino Nano 33 BLE Rev2 Arduino Nano 33 BLE Sense Rev2 Arduino Nano ESP32 Software Requirements Arduino Lab for Micropython - Arduino Lab for MicroPython is an editor where we can create and run MicroPython scripts on our Arduino board. One device will act as a Central (client), and the other as a Peripheral (server). It features a Cortex M4 chip with Bluetooth Low Energy. 0 with a Xbox controller (model 1708 running firmware version 5. I found one in C++ and one in Python, but the Python one was obsolete and didn't work. Oct 16, 2025 · MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and constrained systems. 7K subscribers Subscribed Jun 18, 2022 · This video just show how MicroPython bluetooth module examples run on ESP32-C3, Ai-Thinker NodeMCU ESP-C3-32S-Kit and Espressif ESP32-C3-DevKitM-1, both running MicroPython v1. When I tried to connect directly with mobile here is the po May 22, 2016 · Micropython ESP32 BLE Xbox Controller Example Code Tested on an ESP32-S3 (YD-ESP32-S3) running Micropython version 1. 23. To run this example you need: One XBee3 radio module with MicroPython support. py and pico_ble_temperature_sensor. Furthermore, the protocol used in the radio module is a lot simpler than BLE, making it far easier to use in an educational context. 0)https://coxxect. Finally, have bi-direction BLE communication between ESP32-C3 dev. These resources aim to assist you in leveraging the Bluetooth capabilities of the board for your projects. This is an example of how to send strings from a computer to a Pico W over BLE. It might work on other microcontrollers with Bluetooth, it might not. Sep 28, 2024 · I've been playing with micropython on the esp32 lately, and I think connecting to the esp32 BLE server from a web browser was interesting. Sep 12, 2022 · I'm trying to Connect directly esp32 BLE with mobile without the help of the Bluetooth serial Terminal app. Jun 11, 2024 · This post is a quick introduction to Bluetooth Low Energy (BLE) with the ESP32 using the Arduino IDE. My test/example code here (using lightsleep not deepsleep, and low-level gap_advertise instead of Mar 20, 2025 · When launching the BLE library on an Arduino Opta with MicroPython, I get the following error: mp_bluetooth_hci_uart_write: failed to write to UART 110. See the test. boards. This allows users to create simple yet effective wireless networks of micro:bit devices. an Erik 13. We’ll introduce you to BLE basic concepts and run some simple examples: advertise and expose data to be read by other BLE devices; and detect when another BLE device writes some data on the ESP32 characteristics. A powerful microcontroller with wireless. And in our scale! You can get the details on using the MicroPython Bluetooth Library online. 2 for IoT and embedded systems. Please do Like, Comment, Share, and Subscribe. Examples to accompany the "Raspberry Pi Pico Python SDK" book. But I would also be interested in a central Python example that would work in a Linux BlueZ desktop environment (e. Connect to it with a Bluetooth terminal and it will echo back what you send it. MicroPython, a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library, provides support for BLE on various microcontrollers. Nothing fancy but it will get something UART SPI LEDs Pins ADC I2C PWM (nRF52 only) Temperature RTC (Real Time Counter. The M5Stack official and LoBo MicroPython stacks still do not support BLE. A device may operate in multiple roles concurrently. In order to use this, you’ll need to flash the latest version of MicroPython to your Pico and you will need to save both the ble_advertising. g. 17 or higher. in wireless mice and keyboards. MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems - micropython/examples/bluetooth/ble_temperature. g Ubuntu), which would communicate with the ble_uart_peripheral. So I have an application of making my BLE as an HID Device, like BLE mouse or BLE keyboard. Increasing this allows better handling of bursty incoming data (for example scan results) and the ability to receive larger characteristic values. This library offers implementations of Human Interface Devices (HID) over Bluetooth Low Energy (BLE) GATT for MicroPython. Examples and basic implementations of HID devices are Description This project demonstrates how to integrate Bluetooth functionality into an ESP32 using MicroPython. This makes it easier for MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems - micropython/examples/bluetooth/ble_advertising. Note: aioble requires MicroPython v1. Here is what I tried: from micropython import const import uasyncio as asyncio import bluetooth import aioble import st Feb 28, 2025 · Get started with Raspberry Pi Pico 2 W! Learn setup, MicroPython coding, and Bluetooth 5. py at master · micropython/micropython # This example demonstrates a peripheral implementing the Nordic UART Service (NUS). . # This example finds and connects to a BLE temperature sensor (e. 22. ubluetooth — low-level Bluetooth ¶ This module provides an interface to a Bluetooth controller on a board. I'm going to modify one of the example programs to send live data rather than a the results of simple counts. ESP32 First step is to get micropython on an esp32 board. Recommend start here! Adafruit introduction to BLE - one of several resources like it. It provides simpler and more user-friendly APIs. MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments. The framework provides high-level APIs for all BLE roles including peripheral advertising, central scanning/connecting, GATT server/client operations, L2CAP channels, and security features ble advertising exampleI am currently trying to learn about BlueThooth on the ESP32 and I tried the ble_advertising. You can start with the following tutorial: Getting Started with ESP32 Bluetooth Low Energy (BLE) on Arduino IDE This tutorial explains BLE’s most important theoretical concepts and tests some basic BLE examples on the ESP32 to set it as a BLE Client and as a BLE Server. ble_simple_peripheral. This API is intended to match the low-level Bluetooth protocol and provide building-blocks for higher-level abstractions BLESP32 is a portmanteau of BLE (for Bluetooth Low Energy) and ESP32, the venerable Espressif microcontroller. 1 on 2022-06-18. MicroPython for Seeed XIAO nRF52840. We choose the second, easier option. This guides shows how to setup BLE peripheral and as a BLE central device. It's modified to send and receive command to control Discover all our MicroPython Guides for the ESP32 and ESP8266 with easy to follow step-by-step instructions. micropython asynchronous Bluetooth Low Energy driver - core of this example! I have only lightly adapted it to add extra characteristics and change the peripheral task to remove the annoying timeout task cancellation / crash after 60s. Is it possible in Micropython? If yes, is there any example code for it which I can start on? Thanks Oct 16, 2025 · MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and constrained systems. I am very new to Bluetooth programming though, so it is challenging for me. We'll explore what's BLE and what it can be used for. This blog will delve into the fundamental concepts of MicroPython Bluetooth Low Energy, guide you through its usage, present common practices, and share best practices. When running it, I get: ValueError: advertising payload too large The payload length is 38 with a maximum of 32 allowed. 21. py at master · micropython/micropython MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems - micropython/examples/bluetooth/ble_uart_repl. Jun 3, 2024 · Learn how to install a library that enables simple wireless communication between any number of MicroPython boards without setting up connections. Equipment An ESP32 module A Oct 16, 2025 · For example, you can use a passkey for pairing and encryption. Each tutorial includes schematics and source code. Bluetooth, on the other hand, is a wireless technology standard for exchanging data over short distances. Combining Bluetooth with MicroPython allows developers to create IoT Feb 25, 2019 · The Adafruit nRF52840 has joined the growing list of CircuitPython compatible boards. In this tutorial, we’ll explore how to use BLE to establish communication between two Raspberry Pi Pico W devices using MicroPython. I used Thonny IDE for coding. Low-Power counter) BLE support including: Peripheral role on nrf51 targets Central role and Peripheral role on nrf52 targets REPL over Bluetooth LE (optionally using WebBluetooth) ubluepy: Bluetooth LE module for MicroPython 1 non-connectable advertiser while in connection The plug-in features importing samples from the Digi MicroPython GitHub repository including the BLE examples and libraries. A way to generate BLE Advertisements. 16. By understanding the fundamental concepts, following the usage methods, and implementing common and best practices, you can create robust and efficient BLE - enabled applications. I went looking for a code example. com/2023/ Aug 9, 2024 · ESP32c3 - micropython aioble . Article: How to Read Sensor Values on Raspberry Pi Pico W MicroPython bluetooth example using aioble library, between Raspberry Pi Pico W and ESP32-C3. Pairing (and bonding) is supported on some ports I got some of the very cute XAIO ESP32C3 micro-controllers that support Bluetooth LE. I see there is an example of temperature service peripheral micropython-aioble-itag - Examples using aioble to interact with iTag BLE keychain tags. the one in ble_temperature. B (LE) support in MicroPython has been a bit lacking but more support is being added especially since 1. 'mtu': Get/set the MTU that will be used during a ATT MTU exchange. Digi also provides open-source libraries in C, Java, Python, and C# for users on external hosts and mobile applications. Feb 9, 2025 · Learn how to create your own BLE Service in MicroPython on the Raspberry Pi Pico W to creating a custom BLE service for provisioning a Pico's WiFi settings. This API is intended to match the low-level Bluetooth protocol and provide building-blocks Looking for examples of micropython code for reading BLE advertisements. Contribute to IcingTomato/micropython_xiao_nrf52840 development by creating an account on GitHub. This is based on the ESP32-WROVER-B Sep 28, 2024 · Nice project, thanks for sharing! BLE advertisements are excellent for just dropping a couple of bytes of IoT sensor data from time to another, with very low power consumption. M5 BLE M5 BLE is a library that M5Stack has developed by wrapping the Low Level BLE of Micropython. Aug 5, 2022 · Programming Tiny devices with MicroPython. What I want to accomplish is a reliable connection between 2 raspberry pico W's and sending single integers from one to the other continuously. Note MicroPython uses the radio hardware with the radio module. Currently this supports Bluetooth Low Energy (BLE) in Central, Peripheral, Broadcaster, and Observer roles, as well as GATT Server and Client and L2CAP connection-oriented-channels. May 24, 2024 · Article Featured Image This guide provides a detailed walkthrough on establishing a Bluetooth Low Energy (BLE) connection between your ESP32 microcontroller and a mobile device using MicroPython. The Raspberry Pi Pico W (and 2 W) supports Bluetooth Low Energy (BLE) using MicroPython. This model illustrates the light-switches (OnOff Client) and light-bulbs (OnOff Server). Oct 16, 2025 · MicroPython, a lean and efficient implementation of the Python 3 programming language that runs on microcontrollers, provides a convenient way to work with BLE. I don't have experience with the new lib so all I can say is that you should probably look into aioble library. Oct 16, 2025 · Bluetooth Low Energy (BLE), also known as Bluetooth Smart, is a power - efficient version of the Bluetooth standard designed for short - range wireless communication. Currently this supports Bluetooth Low Energy (BLE) in Central, Peripheral, Broadcaster, and Observer roles, as well as GATT Server and Client. Oct 27, 2023 · Leave it with me: I'm an MCU and programming expert (with a severe lack of patience - but that's a good thing in this situation) but with only about 2 days since learning of micropython (and the useless no-BLE circuitpython) - I'll try to get all this working, and let you know all the steps and examples you need to tell/give to impatient geeks Oct 16, 2025 · Combining the ESP32 with MicroPython and Bluetooth HID opens up a wide range of possibilities, such as creating custom input devices, wireless game controllers, and more. We would like to show you a description here but the site won’t allow us. This API is designed to match the BLE protocol and provides building blocks for more advanced abstractions (such as specific device types). Currently, it supports BLE in central, peripheral, broadcast and observer roles, and the device can run in multiple roles simultaneously. Note that the editor is also available online, at Arduino Cloud - Arduino Labs for I got some of the very cute XAIO ESP32C3 micro-controllers that support Bluetooth LE. ccabwq fohngu lejag tiomoit gzrrxz kcf tjbpn jstcz azacrhw cmxt glqya oezyn zyjhcl pulx pdo