🛠 PSM/eDRX et sommeil bas courant

Arduino MKR NB 1500 · avance · Schéma : IMG-mkr-nb-1500-avance-1-mkrnb-psm-edrx-sommeil.svg — MKR NB 1500 sur batterie LiPo avec multimètre en mesure de courant, graphique des états veille active / PSM et chronologie d'éveil toutes les heures

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

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

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials