Hi there,
And Welcome here…
So we see this A lot , you got the best reply possible from the One guy on here that as you can read has brought the receipts. Follow his path. ![]()
@msfujino is the Power Ninja
Look at All of the Charts you can see each step.
Now as far as You code posted, Well let’s just say Yeah, this one’s familiar. Your basically doing three things that fight the chip instead of letting it help You. ![]()
1. Your turning the SoftDevice off, then trying to “DIY low power”
Bluefruit.Advertising.stop();
sd_softdevice_disable();
// while(millis() - start < 5000) { __WFI(); }
Bluefruit.begin();
That’s heavy and leaky. Nordic’s low-power story is built around leaving the SoftDevice on and using sd_app_evt_wait() (or waitForEvent() in the Adafruit core) so the stack can park the CPU and clocks properly between BLE events. Toggling the SoftDevice every 5 seconds is the opposite of low power.
For sub-10 µA with timer wake and BLE still usable, the pattern is:
- Keep SoftDevice running
- Use
sd_app_evt_wait()in the idle loop - Use an RTC / app timer to tell you when 5 s has passed
- Just update the adv payload; don’t tear BLE down every cycle
120 µA smells like “peripherals left on”, not a true sleep state
In your onSleep():
Serialis still active → UARTE + HFCLK burning current.- SoftDevice has been yanked out from under the core instead of being allowed to idle.
- you’re using a
while (millis() - start < 5000)loop, which keeps SysTick / timers going and never actually transitions into a proper deep idle mode.
SYSTEMOFF + timer = great current, but you will reboot
Your powerDown() is the only truly low-power path you have now:
NRF_POWER->SYSTEMOFF = 1; // ~sub-µA
That’s exactly why you see ~2.5 µA there. But waking from SYSTEMOFF is a reset, by design. You don’t “return” to loop(). You boot again: run setup(), re-init BLE, and go. For a simple beacon, that’s often perfectly fine as a design, as long as you accept “fresh boot every 5 seconds” and stash any state you care about.
Right now your code is sitting awkwardly in the middle, so you get the worst of both worlds. ![]()
If you want to stay with Adafruit/Bluefruit and keep it simple:
- Option A – Let the SoftDevice do its job (recommended)
- Don’t call
sd_softdevice_disable()at all. - Don’t re-
begin()Bluefruit every loop. - Set a long advertising interval (e.g. several seconds) and just sit in:
- Don’t call
extern "C" uint32_t sd_app_evt_wait(void);
void loop() {
static uint32_t last = 0;
uint32_t now = millis();
if (now - last >= 5000) {
pressureValue = nextValue();
updateBLEBeacon(); // just update adv payload
last = now;
}
sd_app_evt_wait(); // real low-power idle
}
or
*Option B – Go all-in on SYSTEMOFF and embrace rebooted beacons
- Use SYSTEMOFF + RTC / GPIO wake every 5 s.
- Treat every wake as a fresh boot: init Bluefruit, update advertisement once, then go back to SYSTEMOFF. That’s how you hit a couple of µA average.
HTH
GL
PJ ![]()