🛠 Sommeil profond et réveil programmé sur la Boron
Objectives
Autonomy is the raison d'être of a battery-powered cellular board. The Boron's nRF52840 offers deep sleep modes: the datasheet specifies approximately 106 µA in HIBERNATE mode on the LTE model (127 µA with ULP GPIO wake-up), compared to 3.9 mA at idle with the radio off. You will put the board to sleep using System.sleep(SLEEP_MODE_DEEP, seconds), let it wake up on its own via the RTC, take measurements, publish data, and then go back to sleep — the classic pattern for a battery-powered sensor. Note: these figures assume a carefully configured setup; early versions of Device OS showed 0.6 to 1.2 mA in deep sleep, which is why measuring your own power consumption is essential.
Hardware
- 1× Particle Boron LTE on LiPo (3.6-4.2 V on the Li+ pin)
- 1× nano-ammeter in series with the battery (or PPK2) to validate the power budget
- Cellular antenna installed; sensor of your choice on an A0-A5 pin
Complete Code
// Boron — reveil RTC, mesure, publication, sommeil profond
#include "Particle.h"
SYSTEM_THREAD(ENABLED);
FuelGauge fuel; // jauge de batterie TI integratee
void setup {
Serial.begin(9600);
}
void loop {
// Patiente jusqu'a 60 s pour la liaison cellulaire ; sinon passe le cycle
if (waitFor( => Cellular.ready, 60000)) {
char msg[96];
snprintf(msg, sizeof(msg), "V=%.2fV SoC=%.1f%%",
fuel.getVCell, fuel.getSoC);
Particle.publish("battery", msg, PRIVATE);
Particle.process; // laisse partir l'evenement en file
delay(2000);
}
// Sommeil profond jusqu'au RTC (1 h). En HIBERNATE : ~106 uA (datasheet),
// mais prevoir les valeurs STOP ~0,5-0,6 mA si des sources de reveil
// restent actives. Le 3V3 est coupe : pas d'alimentation externe secourue.
System.sleep(SLEEP_MODE_DEEP, 3600);
}
Expected Verification
Upon waking (after 1 hour, or temporarily 60 seconds), the battery event arrives in the cloud, and then the board goes back to sleep. On the ammeter, the average current drops sharply after the System.sleep call — aim for ~0.1-0.6 mA depending on the effective mode, rather than the tens of mA seen during connected idle. Pressing Reset wakes the board immediately (full restart, not resume).
Common Mistakes
- Powering external electronics via the 3V3 pin: it is disabled during sleep, so your sensor dies along with the board; use a direct battery line and a MOSFET for power-gating.
- Back-feeding a GPIO pin from an externally powered circuit: the nRF52840 never truly turns off (a pitfall equivalent to that of the EN pin, which must never be connected directly to 3V3).
- Publishing just before sleeping without
Particle.processor a delay: the event remains in the queue and is lost during sleep. - Comparing your measurement to the datasheet's 106 µA without disabling LiPo charging and external pull-ups: each 10 kΩ pull-up on 3.3 V costs 330 µA.
- Forgetting that wake-up is a cold boot: all RAM state is lost, so persist what needs to be saved (flash, RTC).
Other tutorials for this board
Code examples for this board
clignotante.inoArduinobouton-evenement.inoArduinofonction-distance.inoArduinocapteur-dht.inoArduinoruban-neopixel.inoArduinopwm-respiration.inoArduino