Reducing Bangle.js power draw

Posted on
  • Hi!

    By default Bangle.js polls the accelerometer about 12 times a second to handle step counting and twist to wake, which obviously raises power draw.

    With some JS code it's possible to lower the power draw substantially by disabling the accelerometer:

    // LCD on, after boot = ~34mA
    // LCD off,  no connection, 1mA
    // LCD off,  connection to PC, 1.65mA
    
    Bangle.setLCDPower(0); // force LCD off
    NRF.setConnectionInterval(100); // force lower Bluetooth connection speed
    // after ~2 mins inactivity this is the default anyway
    // 0.9mA - the default with LCD off
    
    Bangle.setPollInterval(1000); // lower poll frequency (this handles watchdog so must be run at some point)
    // 0.7mA
    
    //Bangle.accelRd(0x18)=24
    Bangle.accelWr(0x18,0x0A); // accelerometer off
    // or turn accelerometer back on Bangle.accelWr(0x18,0b11101100)
    // 0.52mA - around 30 days if left like this
    
    NRF.sleep(); // disable bluetooth completely
    // 0.45mA
    
    Bangle.off(); // processor completely off
    // 0.07mA
    

    So you can get down to 0.52mA pretty easily, which almost doubles standby time. It's conceivable that we could detect inactivity (eg at night time) and drop to a low power mode automatically.

    However Puck.js draws 0.03mA while awake and advertising so you'd hope we could manage to get down to almost 0.1mA on Bangle.js if everything else draws 0.07mA when the processor is off.

    It turns out the issue is actually the accelerometer polling which uses a hardware timer, even when lowered to a polling interval of 1 second. This is very much not recommended, but:

    // kick the watchdog manually
    setInterval(function() {E.kickWatchdog();},2000)
    /* set TIMER1  TASKS_STOP - stop the utility timer and all
    poll tasks. Long-press of BTN1/2/3 will no longer work!! */ 
    poke32(0x40009004, 1)
    
    // 0.13mA - >100 days idle time
    

    I've just filed an issue at https://github.com/espruino/Espruino/iss­ues/1920 but potentially Bangle.js battery life (when idle) could be raised by around 7 times!

  • Isn't the accelerometer used to turn the Bangle.js / display on when rotating (the wrist)? Changing the interval for polling the accelerometer, does that not have an impact on that behavior?

  • ... and cutting edge builds now have changes in which fix this.

    Normal power consumption has halved, and if you do:

    Bangle.setPollInterval(1000);
    Bangle.accelWr(0x18,0x0A);
    

    Power consumption drops to under 0.15mA from the 1mA that it was originally!

    Just filed an issue for sleeping: https://github.com/espruino/Espruino/iss­ues/1921

  • Isn't the accelerometer used to turn the Bangle.js / display on when rotating (the wrist)? Changing the interval for polling the accelerometer, does that not have an impact on that behavior?

    Yes, which is why I'm not doing it by default.

    However it seems many people turn off the behaviour and just use buttons for wakeup, in which case it doesn't matter.

  • @Gordon Great find. I'm loving the new power optimisations.

  • Ok, most recent changes put the accelerometer into standby if it's not moving for 1 minute. In that case Bangle.js now draws around 0.15mA, so 90 days standby (around 6x longer than it was on Monday :)

    We're also down to 0.36mA with polling at the default 80ms - so that's roughly 40 days even if you're moving about.

    So I'm pretty happy with that - hopefully 2v07 (or cutting edge builds now) will make Bangle.js a much more interesting proposition!

  • Ok, most recent changes put the accelerometer into standby if it's not moving for 1 minute.

    Tagging @Graham_Jones in case this affects your app porting.

  • Luckily it won't - the power save detects if you're using the Bangle.on('accel' event or not and doesn't go into low power mode if you are :)

  • Thanks @Gordon

  • Thanks. If it did stop sending data when there was no movement, it would have been an issue for my automated dault detection. But it sounds like it is ok.

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

Reducing Bangle.js power draw

Posted by Avatar for Gordon @Gordon

Actions