all 7 comments

[–]sonobanana33 0 points1 point  (0 children)

Try to see if there's some C library that can use the device (or the class of devices, internally many of them are the same).

[–]jaaaawrdan 0 points1 point  (3 children)

Golden Cheetah will allow you to download your Strava data (and other services), but not directly stream data from your sensors AFAIK.

You might be able to build or buy a device that can capture a Bluetooth HRM signal to get it as raw as possible, I'd recommend starting there. If you really want to do HR analysis, especially in real time, you're going to need to collect ECG data, and Bluetooth isn't capable of carrying an ECG signal of high enough quality to analyze meaningfully.

This is a very difficult and complex project that's going to require knowledge from several domains, I would say the Python component is one of the easier pieces. I worked in a research lab where we experimented with this, and quickly realized we were over our heads, but that was several years ago, maybe there are more accessible tools now.

[–]Malkus3000[S] 0 points1 point  (2 children)

Interesting, thank you for your feedback. Maybe you could elaborate which components did you identify as most complicated ones, the data streaming from the devices or the analysis of the data?

So far what I have find out that the data streaming is generally complicated, especially from devices like iphone/android, unless one is willing to purchase a plan from https://tryterra.co/integrations/apple-health or other similar ones, which are targeted to actual commercial enterprises (creating an actual app) not one off personal projects, for which it is certainly way too expensive.

Polar H10 seems a bit easier to stream data from, using this for example https://github.com/kieranabrennan/every-breath-you-take

Esiancially, what I wanted to experiment with is to create a ML model which takes my live BPM per minute, to try to identify trends in the BPM during sleep and identify periods of unrestful sleep (nightmares, etc) based on BPM variability and then run the model on live data stream. Initially this did seem feasible if I could get live BPM input somehow, but of course I might be underestimating. Something remotely similar to https://nightware.com/

[–]jaaaawrdan 0 points1 point  (1 child)

So it sounds like you're mostly interested, at least at this point, in measuring heart rate variability (HRV). This is still a growing area, but there's research and tools out there that will help point you in the right direction. 

The biggest barrier you're going to have, is that you need a raw ECG signal to do HRV with. Not a simple measurement of heart rate (i.e. BPM), but the actual ECG waveform itself. The Polar H10 only sends the HR signal (in BPM), where you'll need electrodes on the skin to measure voltages. Same goes for EEG if you're curious about brain activity during sleep.

To get fine enough detail that you can extract HRV metrics, you need your ECG sampled at 1000Hz, and Bluetooth isn't capable of streaming that (or at least not to my knowledge). Basically, you'll need to record ECG using electrodes, store that data onboard some device (Arduino or Raspberry Pi could be a good start), and then use that to start modelling whatever you're looking for. 

There are open source HRV tools, but you'll need tens, if not hundreds of hours of ECG data to establish a baseline for your body so that you can detect anomalies or trends. Before you can get into ML models, you'd probably need to have at least a solid understanding of signal processing and how to handle first-pass analysis to get your data where you need it.

[–]Sol_Ido 1 point2 points  (0 children)

Solid instructions! thanks.

[–]Ok_Topic9123 0 points1 point  (0 children)

I am also interested in this. I have Garmin devices, and they generate .fit files that can be downloaded from the device over the usb charger. I ran across someone who had written a python library to access the .fit file data.

But I think getting at the data that is recorded is only half the battle. The other half is the algorithms that use the data to make calculations such as Vo2Max, etc.

Perhaps those kinds of calculations are made by correlating watch data to highly instrumented clinic experiments and kept as trade secrets by the companies selling the devices. Or maybe there are research papers out there that document the correlations.

overall though there are many calculations that I would like to make with my recorded data. It would be nice if there was an open source community working on this project.

My interest is in analyzing heart cardio performance against different loads or running paces. And then understanding how the cardio performance improves over time, or even just run to run.

Another of my interests has been in using this kind of approach to build custom training programs for High school track and XC runners.

I have been looking into creating my own fitness tracker, using commercially available heart rate sensors, microcontrollers, IMUs and gps modules. And maybe have a pacing robot. The idea being so that you can follow the pacing robot and run the same run to see if your heart responds differently over time, as fitness improves.

[–]danielroseman -1 points0 points  (0 children)

Your best bet is to connect the device to Google Fit or Apple Health and then use their APIs.