QUESTIONS

Can I do serial over Bluetooth?

How do I use the micro:bit UART over BLE

Is the Nordic UART available on micro:bit


ANSWER:

In general, there is not one standard UART profile for BLE in the same way as there was for Bluetooth Classic. However, the micro:bit does include a Bluetooth UART service that is compatible with the Nordic UART service.


The service itself is documented here:

https://lancaster-university.github.io/microbit-docs/ble/uart-service/


If you'd like to use this from the JavaScript Blocks Editor, powered by Microsoft MakeCode then you can find the full documentation here

https://pxt.microbit.org/reference/bluetooth/start-uart-service


Some instructions for getting started are:

  1. Visit https://makecode.microbit.org/ and create a new project, 
  2. Now you must add the Bluetooth package by expanding the 'Advanced' header in the list of block categories and then choosing 'Add Package"
  3. Select 'Bluetooth' and accept the fact that the 'Radio' package will be removed

This is demonstrated in the following animated image:

You can now use the 'Bluetooth' blocks in order to add the UART service.


There is an example program that uses the uart available at https://makecode.microbit.org/_g8VWUU1JsaMV


On your phone, you must observe the following points

  1. Every time you update the micro:bit software over USB, you must re-pair your device
  2. The UART apps will typically only work once you have paired your micro:bit and also connected to it.


This example program can be used with any UART app that follows the Nordic UART protocol, but the example above was tested on Android with the following app. If you have had success with a different app, please let us know using the 'Feedback on this article" feature so we can include it here:

 https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal


Last Reviewed: 21 July - JA