-
-
-
But something is also wrong with it :D, like it gets stuck often. Or wanders into weird hrm territory for no reason.
I found that I was getting occasional I2C errors when reading registers from the HRM device. In the end I caught these errors and re-set the HRM device when it occurred - that seems to have stopped my problem with logging freezing (https://github.com/OpenSeizureDetector/BangleSD/blob/master/apps/hrmtest/app.js#L240)
-
I have made a little test app that will record raw HRM data to a file, and allow me to vary the LED power by swiping the screen up or down.
The things I have found are:- The photodiode reading varies from 8190 counts (13 bits?) to zero
- Increasing the LED current decreases the reading
- The default current register value of 15 (decimal) is pretty good and gives a mid range photodiode reading.
As long as I don't try to plot the graph on the watch screen, I can log at about 40 ms intervals, and can pull it into a speadsheet to look at it:
From a visual inspection of the first 5 seconds, I can see about 5 peaks, which is consistent with my actual heart rate of around 60 bpm, which is encouraging. Unfortunately the watch is reporting over 100 bpm, which is not so impressive. It sounds like this is the opposite to what other users are reporting, as others are reporting low indicated heart rate compared to actual.
So I'm still not sure what to make of this, so I'm going to try to do the same on Pinetime and see how it compares, as I am still suspecting that the HRM sensor in my watch is not really working very well. If anyone else could try to collect a similar set of data on a different watch, I'd be interested in seeing the comparison of different BangleJs watches.
ThanksGraham.
- The photodiode reading varies from 8190 counts (13 bits?) to zero
-
Thank you very much for this example, d3nd3-o0. I have never seen inline C code in javascript before, so this is a bit of an education for me!
I will have a go with your example tomorrow because my attempt to implement the PineTime HRM graph app in javascript is not being very successful - I was assuming that the 'on hrm-raw' functions etc. were interrupt driven, but I was taking too long to draw the graph and blocking it, so need to be more careful.I see from the source code that there is another register that is supposed to adjust the LED current - but I find that if I try to set this, then the HRM stops updating after about 50 samples. I can see the LED intensity changing with register 0x17 as you suggested though.
But so far, I have not seen a stunning effect on the measured signal - will do some more digging tomorrow - thank you all for your suggestions! -
@user140377 If there is a plastic film cover over my sensor, it is very well attached - I can't detect it.
I thought from reading this thread that most people were finding that the Bangle bpm was lower than manual measurements, but I am seeing higher - it is consistent with my watch as I had someone else wear it and got a similar answer. I'll try the LED intensity and see if it makes any difference. -
-
I have been looking at the BangleJS2 HRM without much success for the last week or so (I was hoping to just add some filtering and error checking...) - so I thought I'd share where I have got to in case someone else has already tried my ideas and know it is not the problem.
I am using the latest BangleJS2 firmware (2v19, commit cfbc4040d).
I used a slightly modified version of the HRM data exporter app which records the sample time as well as the ppg reading in case the sample frequency was not what I was expecting.I was surprised that I could not see a heart rate signal from a simple visual examination of the data, so I did some processing to try to get rid of the baseline drift on the signal, but still can not really see anything that looks like my heart rate. The calculated heart rate from the bangleJS is nowhere near correct - it shows something like 90 bpm where my heart rate is probably more like 50 bpm when I am sitting still.
I have done a little comparison to the signal from a PineTime HRM and the heart rate signal is obvious from that - you can see some graphs etc. on my bug tracker issue here.
So I am really doubting whether the BangleJS2 HRM is actually working - one thing that is really noticeable is the LED brightness - the pine time is much, much brighter than BangleJS2 (Pinetime on the left, BangleJS on the right)
I think that if I want to increase the LED brightness, I need to build my own firmware, so I think I'll look at that next, but thought I'd share where I have got to in case anyone else has a better idea?
Thanks
Graham. -
-
Does the "HRM Accelerometer event recorder" work on bangleJS2 without an attached BT HRM? It opens a screen on the watch and I can see the events count going up on the watch, but the browser page just shows '0', and if I press the 'stop' and 'save' buttons it saves an empty file.
Could a running widget that acts as a GATT server be interfering (I am running an updated version of the openseizure widget).I am thinking of re-visiting the open source HR calculation algorithm because I am finding that the current version is too sensitive to movement - I get very high readings if I am not staying very, very still - I will look at trying an algorithm like this one: https://openresearchsoftware.metajnl.com/articles/10.5334/jors.241
Thanks,
Graham. -
-
A brief update. I have modified my OpenSeizureDetector Android App to receive acceleration data over bluetooth, which is sent using the widget that @Gordon has written (thank you for doing that, and getting a watch to me so quickly so I can try it out).
I convert the acceleration figures back into mili-g which is what my existing analysis works on.First results are promising - a gentle shake of the arm with the BangleJS watch on it gives a
sensible looking acceleration spectrum, and my app generates "seizure detected" alarms as we would expect (screenshot of phone app below).
There are a few things to add to get this to a working seizure detector:- Check reliability - we need to make sure it copes ok with disconnection and reconnects automatically.
- Send Watch battery level every now and then (to get rid of the red 0% in the screenshot below).
- Send heart rate every few seconds as well as acceleration data.
- Have the watch receive the seizure detector status (OK / Warning / ALARM) to alert the user in case it is a false alarm.
- Have the watch respond to button presses to mute the alarm system if the user is doing something that he/she knows will cause a false alarm (like brushing teeth).
Connection reliability is the most important thing to test though - will let you know how that goes...
Thanks!
Graham.
- Check reliability - we need to make sure it copes ok with disconnection and reconnects automatically.
-
some people (approx 20%) who have seizures have prewarning with signs such as aura, etc >- not sure if heart rate is one of the prewarning signs but it might be:
perhaps an option to capture heart beat data for some period of time in a rolling log, eg. last > 5 minutes prior to seizure to compare to heart beat data immediately prior to seizure with
aim to see if change of heart rhythm can be used to warn of oncoming seizure to allow
sufferer to get themselves to a safe area, lay down and inform others in the areaYes, one of the OpenSeizureDetector users is very interested in the heart rate monitoring side - she thinks there is an increase in heart rate above the normal resting one before a seizure. Your idea of a change in rhythm is an interesting one which I hadn't thought of - would maybe need to measure heart rate variability to see if it was becoming more eratic?
medical staff always ask how long did the seizure last; carers, at least for the first few
seizures are unlikely to time a seizure, or there might be no-one to witness the seizure. App
could time the convulsions.It is possible to extract this from the logged data, but I don't have a nice easy display of it, so that would be a good idea - maybe have the phone (or watch) display the time since the seizure started - that would be useful for people offering first aid because they should call an ambulance at 5 minutes if the seizure hasn't stopped.
Good ideas, thanks!
-
-
This sounds like a great idea, thank you for getting in touch, Gordon.
I think the documentation in the Github repository is a bit sparse - most description of OpenSeizureDetector is at http://openseizuredetector.org.uk - look at the Garmin Seizure Detector part to see what it does.
If I modify the Android App to receive BLE data directly we should be able to make it work with other devices, which would be great - I'll look into how to do that now.
If anyone is interested what we have looked at for seizure detection, the slides of a talk I gave today are now here: https://github.com/OpenSeizureDetector/Presentations
Thanks
Graham. -
Author of OpenSeizureDetector - free, open source tools to detect epileptic seizures and raise an alarm to warn carers that someone may need assistance. http://openseizuredetector.org.uk
@d3nd3-o0 - thanks for this detail - I will go through it and reply properly, but it might be tomorrow evening or the one after. A couple of quick thoughts:
I will check the ID from the sensor - I was starting to wonder if maybe I have a different sensor (I only purchased the Bangle2 recently)
For me, a LED current value of 15 seemed about right - the automatic adjuster varied it from about 13 to 22, so our watches do seem to be behaving differently if you had to use a much lower current (unless our skin colours are very different maybe - that might have an effect, so could be another reason for needing automatic current control for different users.).
My copy of the app store is very minimalist on purpose - I am thinking of pointing users of my seizure detector app to it if I can get the heart rate measurement working reliably, and I only want them to install apps that I now will not interfere with the seizure detector (some users like to fiddle.....).
Alas, I had to disable the graph drawing part of my little HRM test app because drawing to the screen seemed to take such a long time (over 1 second), and it blocked the HRM measurement while it was happening - it seems that the HRM measurements are not interrupt driven so if I want to achieve 40ms sample period I have to be very careful about not doing too much.... My little app is based on one of the others in the app store - I modified it to try to make it easier to try out different settings (and the idea was to have a graph at the same time to see the effect in real time). I don't get on very well with javascript so had a bit of a sense-of-humour failure at it and de-scoped my intentions for the test app!
Regards
Graham.