← index #15205PR #17679
Related · high · value 3.303
QUERY · ISSUE

ImportError: No module named 'bluetooth'

openby RobeAlVaopened 2024-06-04updated 2024-09-08
docs

Port, board and/or hardware

XIAO Seeed Sense BLE nrF52840

MicroPython version

MicroPython v1.23.0 on 2024-06-02; XIAO nRF52840 Sense with NRF52840

Reproduction

import bluetooth

Expected behaviour

Run the code

Observed behaviour

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'bluetooth'

Additional Information

I'm using a XIAO Seeed Sense BLE nrF52840 in Micropython where I want to initialize BLE communication but when I try to run the code I get an error that says "ImportError: no module named 'bluetooth'"

Code of Conduct

Yes, I agree

CANDIDATE · PULL REQUEST

zephyr: Add Seeed Studio's XIAO BLE NRF52840 SENSE board.

mergedby bikeNomadopened 2025-07-14updated 2025-10-22
port-zephyrboard-definition

Summary

This PR adds Zephyr support for Seeed Studio's XIAO BLE NRF52840 SENSE board.

It also provides a good example of a richer Zephyr port than the default, adding:

  • Frozen modules (including asyncio, upysh, aioble, neopixel, and aiorepl).
  • Enough MicroPython features to support using aioble (at least for the temp_sensor.py example)
  • JSON, random, re, struct, etc.
  • Support for my Zephyr ADC code (see PR #17615)
  • Mounted LFS2 filesystem using the 2MiB flash mounted as /flash

You can build it in the usual way:

$ cd ports/zephyr
$ west build -b xiao_ble/nrf52840/sense . 

This will produce a .uf2 file in build/zephyr/zephyr.uf2 that can be copied into the XIAO-SENSE USB drive that appears when you double-click the RESET button.

Testing

I have tested this on several of these boards, with and without my ADC (#17615) and zensor.Sensor.attr_set() (#17653) PRs.

I have run the aioble temp_sensor.py example but haven't done much more with the BLE.

Trade-offs and Alternatives

The build size is as follows:

Memory region         Used Size  Region Size  %age Used
           FLASH:      428864 B       788 KB     53.15%
             RAM:      165908 B       256 KB     63.29%
        IDT_LIST:          0 GB        32 KB      0.00%

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied