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.03mAwhile 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
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working 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:
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 almost0.1mA
on Bangle.js if everything else draws0.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:
I've just filed an issue at https://github.com/espruino/Espruino/issues/1920 but potentially Bangle.js battery life (when idle) could be raised by around 7 times!