🛠 Low-power : veille profonde et réveil
Objectives
Minimize the Feather nRF52840's power consumption on LiPo: turn off the NeoPixel (notable permanent consumption), cut the regulator via the Enable pin, then put the SoC into SYSTEM OFF — wake-up is done by pressing RST (the reset pad re-powers the circuit). The nRF52840 manages internal LDO + DC/DC from 1.7 to 3.3 V; it is the board's regulator and the NeoPixel, not the core, that kill battery life.
Hardware
- 1× Adafruit Feather nRF52840 Express + 3.7 V LiPo
- 1× ammeter/micro-ohmmeter in series with the battery (or a second Feather as a "tester")
- Wire on the Enable pin (EN) for external regulator cut-off
Full code
// nrf52840-low-power-system-off.ino
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel neo(1, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
void setup {
// 1) Eteindre le NeoPixel : alimente en permanence tant qu'on ne le force pas a 0
neo.begin;
neo.setPixelColor(0, 0);
neo.show;
// 2) Desactiver la charge USB inutilement, couper les broches inutilisees
// (les laisser en entrees pour eviter les courants de fuite).
Serial.begin(115200);
delay(2000); // fenetre pour lire la derniere mesure
Serial.println("Entree SYSTEM OFF : reveil par RST");
Serial.flush;
delay(100);
// 3) Sommeil profond : SYSTEM OFF coupe presque tout ; seul le pad RESET
// (bouton RST ou broche reset) relance l'alimentation du module.
NVIC_SystemOff; // equivalent: NRF_POWER->SYSTEMOFF = 1;
while (1) { /* jamais atteint */ }
}
void loop {}
Expected verification
After the console message, the ammeter drops sharply to the lowest measurable value; pressing RST restarts the program (message seen again in the console). Compare three levels: active code / NeoPixel off + EN cut / SYSTEM OFF — the difference lies mainly in the regulator and the NeoPixel.
Common errors
- Forgetting to turn off the NeoPixel: it draws power permanently as long as its supply is not cut or its data forced to 0.
- Belief that "SYSTEM OFF = scheduled wake-up": SYSTEM OFF only wakes up via reset (RST/power); for a periodic wake-up, stay in SYSTEM ON with
__WFE+ RTC or a GPIO SENSE. - Unused pins in high output: leakage current via external peripherals — leave them floating/input.
- Measuring without cutting USB: the USB converter dominates the measurement; test on battery, with EN managed.
Other tutorials for this board
Code examples for this board
neopixel_pulsation.pyPythonled_bouton.pyPythonentrees_num.pyPythonanalogique_lumiere.pyPythonservo_pwm.pyPythonscanner_i2c.pyPython