/OpenHealthBandFirmware

Firmware for Open Health Band

Primary LanguageCMIT LicenseMIT

docs

Open Health Band Firmware

Firmware for Open Health Band

Description

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

Getting Started

Dependencies

All OHB firmware make use of Arduino Integrated Development Environment.

Board definition

  • 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'.

Libraries

The following librairies are required to build the firmware and tests:

Those libraries are all available in the Arduino Library manager except MPU9250 that we should add in Arduino Librairie.

Services and Characteristics for BLE

The following services and characteristics use Notification properties :

Error Service & characteristic

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
IMU Service & characteristics

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
PPG Max 86140 - 86141 Service & Characteristics

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
HeartRate Service & characteristics

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 :

Start_Stop Service & characteristics

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

Use

  • 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

Documentation for the project is available at movuino.github.io/OpenHealthBandFirmware or in the /docs folder.

Integration

OHB firmware can integrate with the Open Health Band Visualization project which provide real time monitoring of the OHB sensors in a web browser.