How To: Client/Server Bluetooth 5 (no Mesh) Best Practices (novice, intermediate, expert)

custom_board
96boards

#1

I have the following Bluetooth 5 developer boards:

I’d like to use these boards to transmit text (JSON) sensor data over Bluetooth 5 (no Mesh) to the DragonBoard 410c, used as a gateway.
The data is consumed in a Debian 9.3 Stretch docker container running .NET Core 2.0/2.1 C# code.
The .NET Core 2.0/2.1 C# code can call C/C++ via PInvoke().

  • What’s the easiest way to do this in the short term?
  • What’s the best practice for the long term?
  • Is the BlueZ library the best for this?

Thank you very much for your help in advance.


#2

Bluetooth 5.0 is pretty new, Dragonboard 410C supports Bluetooth 4.1. 5.0 is compatible with 4.1 but you will not be able to use extended 5.0 features, which does not seem to be a problem for your use-case.

In my opinion, the best way is to use the existing GATT client/server profile. Your device could expose a custom GATT service in which you have one or more characteristics (e.g temperature, pressure…).
https://www.bluetooth.com/specifications/gatt/generic-attributes-overview
https://learn.adafruit.com/introduction-to-bluetooth-low-energy/gatt

Then the dragonboard (as GATT client) would retrieve the sensor data and send them to the consumer.

This is the ~‘official’ Linux Bluetooth protocol stack, BLE/GATT is well supported now. The documentation is a bit limited for beginners, but there are several examples inside the bluez source tree (e.g. gatt client https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test/example-gatt-client).

In a first time, I suggest you to start implementing the device side (GATT client) and exposes your sensor info. You should be able to test your device against existing GATT client tools like gatttool (linux) or nRF Connect (Android/IOS).

BTW what is the OS on device side ? If you plan to use Zephyr, several peripheral gatt server examples are available in the source tree (e.g. https://github.com/zephyrproject-rtos/zephyr/blob/master/samples/bluetooth/peripheral_hr/src/main.c).


#3

Thx Loic for the quick feedback. I start looking at these options and provide feedback. Thx, Ivan