Firmware for Open Health Band use main bracnh to work with cyclist app
This repository regroups all the firmware and tests which run on Open Health Band.
For hardware plans and schematics see movuino/OpenHealthBand. For the web BLE GUI see movuino/OpenHealthBandVisualization
All OHB firmware make use of Arduino Integrated Development Environment.
- Open the Arduino IDE
- Navigate to
Preferences
- Add
https://movuino.github.io/movuino-board-index/package_movuino_index.json
as an 'Additional Board Manager URL'.
The following librairies are required to build the firmware and tests:
- MPU9250 by hideakitai : place the version provided in Arduino Librairies
- Adafruit Bluefruit nRF52 : version 0.21.0
- Max86141 : version 1.0.4
Those libraries are all available in the Arduino Library manager except MPU9250 that we should add in Arduino Librairie.
The following services and characteristics use Notification properties :
The Error Characteristic allows to send boolean errors from IMU, PPG. Thus, when error is 0 data is detected else 1.
ErrorService | ErrorCharacteristic | |
---|---|---|
UUID | 0x1200 | 0x1201 |
2 bytes | byte 1 | byte 2 |
---|---|---|
ErrorCharacteristic | errorIMU | errorPPG86 |
With the IMU Service and characteristics, data from accelerometer, gyrometer and magnetometer can be send by BLE.
IMUService | AccCharacteristic | GyroCharacteristic | MagCharacteristic | |
---|---|---|---|---|
UUID | 0x1101 | 0x1102 | 0x1103 | 0x1104 |
11 bytes | 4 bytes (0-3) | 2 bytes (5-6) | 2 bytes (7-8) | 2 bytes (9-10) |
---|---|---|---|---|
AccCharacteristic | timestamp | AccX | AccY | AccZ |
GyroCharacteristic | timestamp | GX | GY | GZ |
10 bytes | 4 bytes (0-3) | 2 bytes (4-5) | 2 bytes (6-7) | 2 bytes (8-9) |
---|---|---|---|---|
MagCharacteristic | timestamp | MX | MY | MZ |
With the PPG Service and characteristics, data from PPG can be send by BLE. We can have these type of sensor configuartions :
- 1 PD - 2 LEDS
ledSeq1A_PPG1Characteristic1 = characteristic for data taken from photo-diode
PPG86Service | ledSeq1A_PPG1Characteristic1 | SNR1_2PPG1Characteristic1 | |
---|---|---|---|
UUID | 0x1300 | 0x1301 | 0x1315 |
20 bytes | 4 bytes (0-3) | 4 bytes (4-7) | 4 bytes (8-11) | 4 bytes (12-15) | 4 bytes (16-19) |
---|---|---|---|---|---|
ledSeq1A_PPG1Characteristic1 | timestamp | sample 1 | sample 2 | sample 3 | sample 4 |
4 bytes | 4 bytes (0-3) |
---|---|
SNR1_2PPG1Characteristic1 | SNR photo-diode 1 |
- 2 PDs - 1 LED
ledSeq1A_PPG1Characteristic2 = characteristic for data taken from photo-diode 1 ledSeq1A_PPG2Characteristic2 = characteristic for data taken from photo-diode 2
PPG86Service | ledSeq1A_PPG1Characteristic2 | ledSeq1A_PPG2Characteristic2 | SNR1_2PPG1Characteristic2 | SNR2_2PPG2Characteristic2 | |
---|---|---|---|---|---|
UUID | 0x1300 | 0x1305 | 0x1307 | 0x1313 | 0x1314 |
20 bytes | 4 bytes (0-3) | 4 bytes (4-7) | 4 bytes (8-11) |
---|---|---|---|
ledSeq1A_PPG1Characteristic2 | timestamp | sample 1 | sample 2 |
ledSeq1A_PPG2Characteristic2 | timestamp | sample 1 | sample 2 |
4 bytes | 4 bytes (0-3) |
---|---|
SNR1_2PPG1Characteristic2 | SNR photo-diode 1 |
SNR2_2PPG1Characteristic2 | SNR photo-diode 2 |
- 2 PDs - 3 LEDs
ledSeq1A_PPG1Characteristic3 = characteristic for data taken from photo-diode 1 ledSeq1A_PPG2Characteristic3 = characteristic for data taken from photo-diode 2
PPG86Service | ledSeq1A_PPG1Characteristic3 | ledSeq1A_PPG2Characteristic3 | SNR1_2PPG1Characteristic3 | SNR2_2PPG2Characteristic3 | |
---|---|---|---|---|---|
UUID | 0x1300 | 0x1309 | 0x1311 | 0x1317 | 0x1318 |
12 bytes | 4 bytes (0-3) | 4 bytes (4-7) | 4 bytes (8-11) |
---|---|---|---|
ledSeq1A_PPG1Characteristic3 | timestamp | sample 1 | sample 2 |
ledSeq1A_PPG2Characteristic3 | timestamp | sample 1 | sample 2 |
4 bytes | 4 bytes (0-3) |
---|---|
SNR1_2PPG1Characteristic3 | SNR photo-diode 1 |
SNR2_2PPG1Characteristic3 | SNR photo-diode 2 |
In order to detect the peripheral in the Bluetooth Settings for iPhone, we added the HeartRate taken from Adafruit Bluefruit nrf52 librairies --> Peripheral. However, it is not sent by BLE.
The following service and characteristics use READ and Write properties :
With the Start_Stop Service and characteristics, central BLE can decide when to start or stop data transfert and change leds intensity, sample rate and sample average.
Start_StopService | StartCharacteristic | intensityLedsCharacteristic | smplRateCharacteristic | smplAvgCharacteristic | |
---|---|---|---|---|---|
UUID | 0x1400 | 0x1401 | 0x1402 | 0x1403 | 0x1404 |
1 byte | 1 byte (0) |
---|---|
StartCharacteristic | 1 (start) or 2 (stop) |
intensityLedsCharacteristic | leds intensity |
smplRateCharacteristic | PPG sample rate |
smplAvgCharacteristic | PPG sample average |
Values | leds intensity |
---|---|
0 - 255 | leds off (min value) - leds on (max value) |
Values (integer) | PPG sample rate (Hz) |
---|---|
0 | 25 |
1 | 50 |
2 | 84 |
3 | 100 |
4 | 200 |
5 | 400 |
14 | 128 |
15 | 256 |
16 | 512 |
Values (integer) | PPG sample average (Hz) |
---|---|
0 | 1 |
1 | 2 |
2 | 4 |
3 | 8 |
4 | 16 |
5 | 32 |
6 | 64 |
- Choose your PPG sensor type (PDLEDs, PDsLED or PDsLEDs) by activating the #define
- To read data from PPG, IMU activated the #define from peripheral and central
- To read data on Serial Monitor or send by BLE activate the #define from peripheral
Documentation for the project is available at movuino.github.io/OpenHealthBandFirmware or in the /docs
folder.
OHB firmware can integrate with the Open Health Band Visualization project which provide real time monitoring of the OHB sensors in a web browser.