-
Hi I originally made a HRV app for the Bangle 1, which I can probably check and change if it's busted since I last updated it. I can definitely make it more efficient. I've been looking at making a similar one for the Bangle 2, which I recently got; it's a great watch but the PPG signal is definitely harder to work with either raw or filtered, signal moves around a lot probably because of the auto-adjustments it seems to make. Will try get something working for it though, I'm trying different options around polling rates and locking the LED auto-adjustment to see if I can get it more stable.
For Sp02, I doubt this would give anything useful - SP02 is usually red + IR light you need to measure not green because your blood absorbs green. I've seen notes on research using different shades of green but not green + IR. You basically do comparisons of the 2 signals to see light absorption at different wavelengths in the same kind of range but because green and IR are so far apart I'm not sure it would work. Datasheet doesn't suggest it has a red LED. It's possible they have a different similar model that uses a red LED instead of the green tailored more for Sp02.
For blood pressure, it looks like you need quite a clean, stationary signal for this. I actually think it's possible to get blood pressure from recorded data out of Bangle 1 easily. The caveat is the algorithm would probably have to be done outside of the watch so would need to use a phone or something that can handle more power and transfer the data by bluetooth or do it retrospectively. The easiest methods I've seen take PPG signals directly and run them through a neural net. The Bangle can run tensorflow so theoretically, if you get a small enough tflite model that can take a low 25Hz signal it could work but I think the pre-filtering you need to do beforehand as well with it might all be too much.
-
Hi, I've not done this myself but there are a couple of options listed in the quick start with guides on connecting to Raspberry Pi - I would personally try the Web IDE method if possible:
https://www.espruino.com/Quick+Start+BLEYou can then just copy the relevant file accross
-
Interesting project, I have a Muse S headband, which seems to work well for sleep tracking and brainwave data. On the subject of tracking sleep and general hypnogram cycles I do think indirect data points such as changes in heartrate and movement provide decent info when I benchmark against the Muse - it's not 100% of course but I find it's more practical for regular use. I've been working on a sleeptracker for the Bangle.JS that takes HRM data and movement to attempt charting sleep cycles, it wouldn't take all that much more to put in a smart alarm feature as well as possibly a REM alarm in theory - REM and wakefulness would be towards the peaks of these cycles so you just need to detect peaks and trigger an alarm soon after the descent.
A REM alarm on this would probably need to be via bluetooth to another device as the sound wouldn't be loud enough on the Bangle, and I suspect the motor wouldn't have much effect because of sleep paralysis in REM.
-
Hope your new watch works ok when you get it, FYI on the HRM data exporter app specifically, the -2 doesn't relate to your heartrate directly but the signal from the sensor so it should oscillate somewhere between I think -4 and 4 in normal situations, so your log does look bad but only because it doesn't fluctuate much rather than there being low numbers. Sometimes with mine I do have to adjust the position etc to get good readings at times and it can be sensitive to movement.
-
Hi, some of the code in that should help yes, you can also look at the hrm data exporter, which records the raw signal over a defined time period: https://banglejs.com/apps/#hrm%20data
There is a link in the readme file for that to some more signal processing stuff on my github to process the exported file, that might be a good start point also.
-
@DrBard yep that's basiscally it. BTW there's actually another app that does specific sun and moon calcs which you might want to look at also: https://banglejs.com/apps/#astroc
I'm not getting correct metrics from that app though but again I think it's just because of the acos issue; I've actually found a better function for that now than the one I gave before (Don't know what voodoo magic they do to work these out!): https://developer.download.nvidia.com/cg/acos.html
-
@DrBard should be there in the next few days once it's gone through all the checks etc. You can get it directly from my repo in the meantime also:
https://jabituyaben.github.io/BangleApps/#astral
I've not put the ISS aspect in because I need to think about which API to use, it might work better as a seperate app because this one is already trying to do a lot. -
@DrBard One thing to watch out for is the acos part, which is one of the last calculations you have to do - there is an issue in the Bangle firmware with that function on negative values and you'll get strange results. There are several ways to estimate acos you can find online and I've used one of those for now myself and it's close enough for this kind of thing. It's a known issue but fairly new so fixed for Espruino but it's not in the latest standard Bangle firmware.
function acos_estimate(x) {
return (-0.69813170079773212 * x * x - 0.87266462599716477) * x + 1.5707963267948966;
}
-
@Robin Just seeing if there’s a way to do it for any location without downloading and uploading files to the watch-I can do it that way for now tho, probably is best way actually. Just means users will need to use separate apps to generate the JSON each month or so and copy the file over which the bangle can look for. The clock app actually stores lat and Lon in its own json so I can make a python script or something that uses that to make it easier.
-
Did anyone get round to doing this ISS stuff? pretty interesting. I was looking around the forum for astronomy related projects - I've put together a Clock that calculates planet and sun positions (Alt/Az) based on GPS, will be putting it in the App Loader in the next week once I've sorted a couple things. It doesn't need to interface with any API etc and so I think it's possible to include a spot the station feature with a few more steps. For IIS you'd need to calculate when it's over the horizon, whether it's night time locally and if the Sun is at the right angle as light has to be reflected off it to be visible. The last part in all that carries most of the heavy calculation I think and this clock goes part way for it. The thing with ISS is that it's orbit drifts back and forth and they adjust it with boost so for any projected trajectories calculated - I don't know how long the results would be accurate for so will need to look into that. Worst case though, a settings file could be exposed to kind of reset the projection and orbit every now and then if needed, similar to winding dates at the end of the month on analog watches...this is obvs over the top by comparison and also why it must be done :p
-
@Gordon cheers! I had an inconsistant name for the app ID and I think the img name so once I updated the json it's sorted
-
I've forked the BangleApps repo and submitted a couple apps already no problem but this recent one isn't working via the App Loader so just seeing what options there are to debug.
The app actually works fine if you launch it manually from the IDE after installing from the App Loader but in the Launcher on the watch I've got a blank space where the icon would be and the title of the app. When you try pressing the middle button the app doesn't launch.
-I've got 2v08 and the latest bootloader
-tried deleting all apps, restarting several times
-there are other apps already on the main repo that have the same problem on my watch atm - the Desktop Launcher is one that I don't even see come up on the menu, unless it's meant to be that way for that one...again, they load fine if I do it from the IDE after installing.
-tried multiple different icons and options incase it's something to do with that, the icon appears ok when you load it in the IDE. Can a badly formatted icon even break loading the app from the Launcher?
-no errors in Chrome to notegoing to let the watch go flat and see what happens after a recharge otherwise anyone got any other ideas?
App is called HRM Data Exporter, https://jabituyaben.github.io/BangleApps/, doesn't do anything too crazy.
-
@DrBard that's basically where I was going with it - I tracked the temp overnight along with heart rate, just in case skin temp has any bearing but it doesn't...correlates more with when my heating is turned on and off so it's not bad for checking ambient temp changes, as mentioned it would need to have an offset applied for an estimate of actual temp.
-
-
Awesome, Cheers. Basically I do the rolling average at the start which is just on the 50hz samples and then I used Bézier curves as I expand it-I tried other cubic spline interpolation with libraries in python on a sample dataset but i get the same kinda results. I actually do another slight rolling average after the interpolation but I’m not sure it’s needed yet so will play around and see what can be cut out. You can see line graphs and data in my GitHub repo to see what each stage does.
-
-
The function seems to be behaving normally now, I changed a couple of things so it might have been something simple. Basically if you look at how I'm handling the HRM event I'm not sure if the way I'm calling the turn_off function is ideal and if there should be any process to wait for the hrm.raw data to be read in.
Polling the data more often might be overkill but if you're able to create a different Event seperate from the HRM one or add that option I'd be interested to test it out at double the sample rate at 100Hz maybe and see if there's much of a difference - not done anything around HRV before so worth trying different approaches.
Regardless the sample rate you'd always need to do some level of processing, and I don't think just a rolling average to smooth it out is enough because if you do too much of that you end up blurring the signal. So it's finding a compromise between doing a little bit of basic noise cancellation and then also a more intelligent interpolation between each point to define the peaks. The margins of error on HRV are quite narrow also, it's a very sensitive metric so slight errors in calculating peak gaps at 50Hz makes quite a significant difference to the reading you get.
I've submitted a pull request to the app loader. Next update will be to add a simple log function so you can record and maybe plot relative changes over time.
-
@Gordon Hi, I think the arm/wrist movement thing isn't too big of a deal because users should be sitting still ideally when taking these measurements. I've put together an app and it does mitigate some of that issue by just checking the pulse gaps aren't too wild, if it is it just drops the element.
I've added a post in the Projects forum for this as I think the project could be relevant to Espruino aside from the Bangle.js and more details in the Github repo.
http://forum.espruino.com/conversations/357885/newest/
Do you know what the sample rate is for that raw data array? I've calculated a couple of different ways but good if someone knows exactly what it is incase I'm slightly off.
-
Couldn't see this implemented anywhere so I've put together an app that can collect hrm data over ~20 seconds and attempts to report HRV on the Bangle.JS. More details in the GitHub repo. There's 1 issue where it seems to try processing the data twice but it doesn't break anything - I think I'm just not handling the hrm event quite correctly atm.
-
@fanoush thanks! I'll take a look at these other trackers that can run Espruino, didn't think of that. That F77 looks too cheap to be true if it does have it :)
-
@allObjects I’ve just used what’s available on the watch as I quite like the simplicity of it as is. As @Gordon mentioned it’s fairly straightforward to integrate other BLE things to experiment:) if there’s a v2 of this device in the future (I hope there will be) I’d request surface/skin temp sensor and Galvanic skin response-alongside HR this is, I guess, a holy trinity for health/fitness analysis.
@Gordon I’ve not looked at how the App Loader is curated but will defo check that out and put it in for others to test more easily. Cheers -
Before I found out about the Bangle.JS I'd planned on creating an arduino based glove - this watch is a game changer.
Inspired by a recent MIT study on Hypnagogia and the 'Dormio' glove. In this blog post and assoicated youtube video, I discuss how we can explore the transitional state between wakefulness and sleep, which has associations with various phenomena around perceptual hallucinations. This state has always been of interest in human history, it has been the inspiration of Salvador Dali's art, Aristotle's writings and Thomas Edison, who attributed a lot of his insights to lucid thoughts within Hypnagogia. Full code is available and I give a brief overview of current results - definitely has scope for expansion/improvements to the principle:
-
long shot - has anybody attempted getting HRV from the Bangle.JS taking in the analogue values? If not I'll give it a stab but would be handy if I can get a head start. This kind of thing can usually be quite data intensive, particularly for optical sensors so would probably push this device. HRV data opens the door to a vast array of possibilities and applications. Cheers
-
There are the .filt values that is bandpass filtered but it has issues with clipping out I guess because they are all 16 bit. It also bandpasses the wrong frequencies at 25Hz I think? I might have a better approach for filtering from the raw signal that I've put a write up on in more detail here:
https://www.majorinput.co.uk/post/bangle-js-2-dealing-with-noisy-ppg-signals
Basically you take a sample of .raw data then:
With the above, you won't get clipping issues because the values reduce as it's filtered down and you get a much better fourier transform. You could derive the HR by FFT from this even with shorter windows or calculate by peak detection and then based on the average interval/gap in the window. I've got a javascript app that runs on the bangle alligned to this but step 3 in the above is running a bit slow, I'll try getting it to run faster or even try your test harness thing and see how it works at firmware level. To be honest I think the proprietary HR algorythm seems fine so wouldn't change it for HR but this could be useful for HRV if it works ok and replace the filter algorythm.