How to set up Seeed Xiao nRF52840 with Circuit Python for BLE

Dec, 01 2022


Seeed's Xiao line is a convienent form factor for IoT projects. They're compact and affordable. Let's set up the nRF52840 flavor with Circuit Python and get it to advertise over BLE.

Seeed Xiao nrf52840

This assumes that you're familiar with BLE basics.

Installing Circuit Python to the Xiao nrf52840

The first step is to get the device into bootloader mode by double clicking the reset button.

Module pinout

Open your computer's file system and you should see a removable drive show up named XIAO-SENSE.

Next, download the .uf2 file from the Circuit Python website.


At the time of writing this post, the file from Seeed's website is outdated and does not work with BLE.

Drag the .uf2 file from you downloads into the removable drive named XIAO-SENSE. It might take a few seconds to upload.

Then, you should see your drive disconnect and reappear as CIRCUITPY.

Setting up the Xiao nRF52840 Sense with Bluetooth on Circuit Python

First, download the Circuit Python library bundle for Version 7.x.

Unzip the file and navigate to the lib directory in the library bundle you've just downloaded.

In a separate window, navigate to you CIRCUITPY drive, then open the lib folder for your device.

Back in the libraries bundle, find the folder labeled adafruit_ble. This is the library necessary to enable Bluetooth with Circuit Python.

Drag the whole folder named adafruit_ble from you library bundle, to you lib folder on you Circuit Python device. It may take a few moments to transfer.

Finally, open the file on you Xiao nRF52840 Circuit Python device and copy the following code onto it:

from adafruit_ble import BLERadio from adafruit_ble.advertising.standard import ProvideServicesAdvertisement from import UARTService ble = BLERadio() uart = UARTService() advertisement = ProvideServicesAdvertisement(uart) ble.start_advertising(advertisement) while True: # Normally other work would be done here after connecting. pass

Open a serial monitor to check for any errors. You can use a serial monitor inside of VSCode by following this guide (works for Circuit Python as well as Zephyr)

Here's the expected output:

Code stopped by auto-reload. Reloading soon. soft reboot Auto-reload is on. Simply save files over USB to run them or enter REPL to disable. output:

Once you confirm that the device is not showing any errors, you can make sure that it is advertising as expected.

Using a BLE debugging app on your phone (I use LightBlue), look for a device advertising with the name CIRCUITPYxxxx.

Seeed Xiao nrf52840 advertising with CircuitPython

You're now ready to spin up some cool IoT projects with this useful board!