Simple Stream With BLE
In order to stream data over BLE, we currently implement communication with a BLE GATT Service.
A code example of the service on an embedded device is located on github at https://github.com/sensiml/nano33_data_capture
Simple Stream BLE GATT Service
The BLE GATT service implements two characteristics: the configuration characteristic and the data characteristic.
In the code example for the Nano33 BLE Sense, the service is implemented with UUID 16480000-0525-4ad5-b4fb-6dd83f49546b
Simple Stream Service UUID |
default |
---|---|
Configuration Characteristic UUID |
default |
Data Characteristic UUID |
default |
Configuration Characteristic
The characteristic will store the device configuration JSON. Applications such as the Data Studio will only need to read the value of this characteristic once per connection.
An example configuration for a 6-axis IMU sensor at 100Hz would be
{
"sample_rate":100,
"samples_per_packet":6,
"column_location":{
"AccelerometerX":0,
"AccelerometerY":1,
"AccelerometerZ":2,
"GyroscopeX":3,
"GyroscopeY":4,
"GyroscopeZ":5
}
}
Configuration Descriptor |
Read |
---|---|
Characteristic Data |
JSON string describing output |
Characteristic Value Length |
Variable (string length) |
Data Characteristic
When notifications are enabled by applications such as the Data Studio, data should be sent via BLE GATT notifications, sending unformatted data.
The Data Studio expects the format of the data to be in the order specified by the json in the configuration characteristic.
When notifications are disabled, the data stream should stop.
Configuration Descriptor |
Notify |
---|---|
Characteristic Value |
|
Characteristic Value Length |
Variable (Up to max MTU size) |
SensiML Open Gateway
In some cases, you may want to use a gateway device to retrieve sensor data from your device as an intermediary between the Data Studio. We have created the SensiML Open Gateway that communicates with the Data Studio over Wi-Fi and can read sensor data from BLE, TCP/IP, and Serial Connections. It is open-sourced and easily extensible to other data sources.
Note
The Open Gateway will be expecting the default UUID’s for the BLE service
This application is intended to run as a simple application on a remote computer (Raspberry Pi or other single-board computers that can run Python included).
Instructions for running and configuring the application can be found in the SensiML Open Gateway Documentation.