🛠 PSM/eDRX et sommeil bas courant
Objectives
Extend LiPo battery autonomy by combining three levers: the low-power states of the SARA-R410M module (PSM/eDRX) activated via gsm.lowPowerMode, SAMD21 sleep, and real current measurement. NB-IoT is a LPWAN standard (3GPP Release 13) designed for PSM/eDRX; the board's power consumption figures are not published, hence the need for measurement.
Hardware
- 1 MKR NB 1500 board + 3.7 V LiPo battery on the JST connector (onboard TI BQ24195L charger)
- Antenna + data SIM (the modem must remain registered to benefit from PSM)
- A multimeter in micro-ampere mode or a nano-expert in series with the battery
- 32.768 kHz crystal on PA00/PA01 for the RTC wake-up
Complete code
// Sommeil profond + reprise toutes les heures — MKR NB 1500
#include <MKRGSM.h>
#include "arduino_secrets.h"
const char PINNUMBER[] = SECRET_PINNUMBER;
const char APN[] = "orange";
GSM gsm;
GPRS gprs;
void setup {
Serial.begin(9600);
while (!Serial);
bool ok = false;
while (!ok) {
if ((gsm.begin(PINNUMBER) == GSM_READY) &&
(gprs.attachGPRS(APN) == GPRS_READY)) ok = true;
else delay(3000);
}
// ... ici : connexion MQTT, publication, deconnexion propre ...
// Autorise le module a entrer dans ses etats basse consommation
// (PSM / eDRX negocie avec le reseau) : gsm.noLowPowerMode pour annuler.
gsm.lowPowerMode;
Serial.println("Endormissement 1 h...");
Serial.flush;
delay(3600000UL); // pour l'essai ; en production : RTC + sleep
}
void loop {}
Expected verification
After lowPowerMode, the measured current drops significantly and in steps (the module disables eDRX slots, then enters PSM). Wake up the board (reset or button press): it re-registers on the network. Compare bare battery / USB: the power LED staying permanently lit on battery (known bug arduino/ArduinoCore-samd#515) adds a constant background current.
Common errors
- Expecting "magazine" current: without real measurement, any autonomy estimate is false; measure it yourself.
- Forgetting that the PWR LED remains lit on battery (open issue with the SAMD core): fix it (desolder/cover or tolerate it) for a very low-power node.
- PSM not granted by the operator: the network may reject the requested parameters; check with the AT commands from the diagnostic tutorial.
- Too frequent wake-ups: each reconnection costs energy and battery; space out transmissions (hourly rather than every minute).
- The BQ24195L has its own peculiarities (details of PMIC quirks in the core): test the charge/discharge behavior before deployment.
Other tutorials for this board
Code examples for this board
attente-lte-nbiot.inoArduinochoix-bande.inoArduinopublish-mqtt-minimal.inoArduinoeconomie-energie.inoArduinogeoloc-cellules.inoArduinotest-coverage.inoArduino