🛠 Sommeil profond et réveil programmé sur la Boron

Particle Boron · avance · Schéma : IMG-particle-boron-avance-1-boron-sommeil-profond.svg — Boron endormie (icône lune) branchée sur une LiPo, réveil par RTC après 1 heure, cycle mesure puis publication vers le cloud.

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

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

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials