UART Over Bluetooth Low Energy

A universal asynchronous receiver/transmitter (UART) is the most popular protocol to talk to computer device over serial port. What I am talking here is not exactly UART in traditional sense. Its an emulation of serial port over BLE. Its not part of profiles defined by bluetooth SIG. But its the most custom defined service that it has almost become standard. Its an equivalent of SPP (Serial Port Profile) in Bluetooth Classic but community defined. All most all (Nordic, Adafruit, mbed) BLE hardware providers support it.

I think since Nordic started it. They defined the UUIDs and details of the service ➡️ Nordic UART Service (UUID: 0x0001). The UUID of the Nordic UART Service is 6E400001-B5A3-F393-E0A9-E50E24DCCA9E. As of now every other developer uses these UUIDs for UART.

Nordic’s UART Android client is a great app if you like to test your UART implementation. Its an Open source and available on Play store.

Below is the configuration of the Service and Characteristics that I used on a hardware device (Server or GATT Server) and then I used nRF UART 2.0 Android app (Client) to connect. The service definition below is for GATT Server. Characteristic names are from client’s point of view. For testing purpose you could import this into nRF Connect and make it a GATT Server. Then you can use nRF UART 2.0 to connect and then to chat. One can implement custom protocol over that chat.

<server-configuration name="UART OVER BLE GATT SERVER">
   <service uuid="6e400001-b5a3-f393-e0a9-e50e24dcca9e">
      <characteristic name="TX for Client Characteristic" uuid="6e400002-b5a3-f393-e0a9-e50e24dcca9e">
         <permission name="WRITE"/>
         <property name="WRITE"/>
      <characteristic name="RX for Client Characteristic" uuid="6e400003-b5a3-f393-e0a9-e50e24dcca9e">
         <permission name="READ"/>
         <property name="READ"/>
         <property name="NOTIFY"/>

Since the services above are implemented on the GATT Server. The TX Characteristic will have the WRITE permission enabled so a client can write where as a client can only READ from a RX Characteristic1. Essentially two characteristic work like register to which a client can write or read from. The picture below should make it clear.



PS1:I am doing lot of experiments with Bluetooth Low Energy. I have started to like Bluetooth again. So you will see more posts.
PS2: A more complicated picture of the BLE UART.

You may also like...

1 Response

  1. December 11, 2016

    […] In most cases Android is used as client (GATT Client). But one can also use Android as GATT Server. There are use cases where running a GATT Server on Android can be useful. For example lets say you want a desktop app displays notification of a SMS arrival. Its easy to write a GATT server (on Phone) that pushes the message to Client (Desktop) as and when it arrives. Now, there can be many other useful use-cases but in the example code I am implementing the UART Protocol over BLE. […]

Leave a Reply

Your email address will not be published. Required fields are marked *