Increasing Polling Rate of Heartrate Sensor

Posted on
  • I've been wanting to increase the polling rate of the heart rate sensor but trying to increase the polling rate to 10ms results in the timing between the readings increasing and eventually the program will stop.
    Here is the reference of the options to increase the polling rate and the code we are running.­S2#l_Bangle_setOptions

    let i = 0;
    let t = 0;
     // print(data);
      if(i == 0){
        t =;
      if(i % 10 == 0){
        n =;
        print( - t);
        t = n;
    Bangle.setOptions({"hrmGreenAdjust": false, "powerSave": true, "hrmSportMode":0, "hrmPollInterval": 10, "lockTimeout": 1000, "backlightTimeout":10000, "wakeOnBTN1": true, "wakeOnBTN2": true, "wakeOnBTN3": true, "wakeOnFaceUp": false, "wakeOnTouch": false, "wakeOnTwist": false});
  • 10ms is a bit unrealistic, it is too slow for that. Maybe even if you would remove the print calls which are slow you could probably barely run that code in 10ms. you can try to put "jit" there like

    Bangle.on("HRM-raw",function(data){ "jit"

    to enable JIT compiler, but still - printing (probably over bluetooth?) is slow

  • Actually it is me being too pesimistic. Just tried and the function call takes about 1ms (when it prints it is about 2ms) and it prints quite infrequently so when I put it into setInterval(f,10) it seem to manage the printing even over bluetooth

  • It seems to work reasonably here? I've seen it slow down a bit but moving it around seems to restart the readings. How long does it take for readings to stop? And you're sure it's not just stopping because it detected it's not being worn?

    I should also add that Bangle.getOptions().hrmGreenAdjust gets reset when you turn on the HRM, so you need to set that after you've turned it back on.

    With hrmGreenAdjust set to true, the LED intensity will change to try and get the readings within range, but it's worth bearing in mind - I think if the Bangle is viewing something dark then the sensor will have to wait for longer for a reading (effectively like a shutter speed) and the could affect you.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Increasing Polling Rate of Heartrate Sensor

Posted by Avatar for bponce02 @bponce02