InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.69k stars 921 forks source link

Nimble central role support #1496

Closed Johnmcenroyy closed 1 year ago

Johnmcenroyy commented 1 year ago

Verification

Pitch us your idea!

Pinetime support of external bluetooth sensors

Description

Hello Thank you very much for such a great software. It will be great if it possible to add Nimble central role to connect to external sensors such as Polar H10, Polar Stride Sensor, Zwift RunPod, external bluetooth gps (android can be as external gps device over bluetooth - Bluetooth GPS Output, Share GPS) and so on.

Thanks

Johnmcenroyy commented 1 year ago

Just investigated a little more.

There is Adafruit Feather nRF52 Bluefruit: https://www.adafruit.com/product/3406 And Adafruit Bluefruit52Lib for working with this module with Central mode example: https://github.com/adafruit/Adafruit_nRF52_Arduino/tree/master/libraries/Bluefruit52Lib/examples/Central Also example of using Bluefruit52Lib for receive data from Polar heart rate sensor (H7,H10): https://github.com/MakerLabCRI/PolarBleArduino/blob/master/nRF/nRFPolarH10/nRFPolarH10.ino

Also there is Nordic example for using BLE Central - BLE Heart Rate Collector Example https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Fble_sdk_app_hrc.html&cp=8_1_4_2_0_1 Main source file for this example from SDK (\examples\ble_central\ble_app_hrs_c) https://termbin.com/fcfq

Maybe it can be integrated in InfiniTime firmware.

Update: Sorry, just realized that all examples are for SoftDevice stack and NOT NimBLE

Johnmcenroyy commented 1 year ago

NimBLE Central example

blecent: A basic central device with no user interface. This application scans for a peripheral that supports the alert notification service (ANS). Upon discovering such a peripheral, blecent connects and performs a characteristic read, characteristic write, and notification subscription.

Riksu9000 commented 1 year ago

Can you explain what the purpose of connecting these devices to InfiniTime is?

Johnmcenroyy commented 1 year ago

Can you explain what the purpose of connecting these devices to InfiniTime is?

Hi Riksu9000

I have just listed some sensors as example, the matter is to have BLE Central possibility to connect to external sensors. It can be not just sensors but some bluetooth toys as PowerUP Smartphone Controlled Paper Airplanes and so on. What concerns certain sensors, I am especially interested to connect from Pinetime to Polar H7 to get medical grade heart rate data, to get R-R intervals data to analyze stress, also there is a possibility to get aerobic threshold, anaerbic threshold with DFA Alpha 1 from HRV from chest heart rate.

So the main point is the possibility to connect to external sensors using NimBLE Central possibility and let the user decide which sensor and how to use it, let him write some additional apps for certain sensors.

Peter Gamma wrote also about this here: https://forum.pine64.org/showthread.php?tid=11308

Johnmcenroyy commented 1 year ago

Polar H7/H10 Chest Heart Rate Sensor medical grade heart rate data hrv data (r-r intervals)
hrv give the possibility to get stress index, aerobic threshold, anaerobic threshold, heart problems etc.

no need software signal processing (heart rate and r-r intervals), sensor just give accurate heart data over bluetooth

Polar Stride Footpod speed distance leg cadence stride length

Zwift Runpod Footpod speed distance leg cadence

Footpods when calibrated can be accurate as gps and more. Work in forest, indoor etc.

PowerUP Smartphone Controlled Paper Airplanes just toys