🛠 Sommeil bas courant du module et réveil
Objectives
Extend battery autonomy for a field station: put the SARA-U201 module into reset (the SAMD core already keeps the modem in reset at startup to save energy), put the SAMD21 to sleep, and wake the board on an event — button press or periodic alarm — for a quick measurement and transmission. The Arduino design documents a drop from "several mA to a few µA" when the modem and crypto chip are powered off.
Hardware
- Arduino MKR GSM 1400 board + LiPo (the only power source for the test)
- Push button on D2 to ground (wake-up)
- ArduinoLowPower library (SAMD core); MKRGSM for the transmission phase
- A multimeter set to ammeter mode to verify actual power consumption
Complete code
#include <ArduinoLowPower.h>
const uint8_t BTN_REVEIL = 2;
volatile bool reveille = false;
void onReveil { reveille = true; }
void setup {
// 1) Maintenir le modem GSM en reset pendant le sommeil.
// GSM_RESETN (broche 31 de la variante) est actif a l'etat BAS.
pinMode(GSM_RESETN, OUTPUT);
digitalWrite(GSM_RESETN, LOW);
// 2) USB inutile en sommeil profond : couper la CDC libere de l'energie.
Serial.begin(9600);
delay(3000); // laisser le temps d'ouvrir la console
Serial.println("Entree en sommeil, appuyer sur D2");
LowPower.attachInterruptWakeup(BTN_REVEIL, onReveil, FALLING);
}
void loop {
reveille = false;
LowPower.sleep; // SAMD en mode attente, reveil par IT
// --- Reveil : phase active courte ---
digitalWrite(GSM_RESETN, HIGH); // relancer le modem
delay(1000);
Serial.begin(9600);
Serial.println("Reveille ! Mesure + transmission ici.");
// ... mesure capteur, gsmAccess.begin, envoi GPRS/SMS, shutdown ...;
delay(3000);
Serial.end;
digitalWrite(GSM_RESETN, LOW); // remettre le modem en reset
}
Expected verification
On the multimeter, the average current drops significantly when LowPower.sleep is reached and the modem is held in reset; pressing D2 wakes the board and the console displays the wake-up message. Measure the average over several minutes: a registered module transmits in bursts (paging), and the BQ24195L charging PMIC can mask microamperes if the charger is powered via USB.
Common errors
- Believing the module is "off" because the sketch doesn't call it: without held reset or
gsmAccess.shutdown, it remains registered to the network and consumes power during permanent paging. - >
- Wake-up failure:
attachInterruptWakeupmust target a pin capable of interrupts; test the pinout before sealing the enclosure. - Forgetting to restart the modem after wake-up:
GSM.beginfails ifGSM_RESETNis not released. - Relying on the USB clock: during sleep,
millisdoes not advance in the same way; for precise periodic wake-ups, use the RTC (supported by the SAMD core) rather than successivesleepcalls. - LiPo not fully charged: below 3.4 V, radio peaks cut off the power supply and corrupt the autonomy test.
Other tutorials for this board
Code examples for this board
gsm-connexion.inoArduinoenvoi-sms.inoArduinohttp-get.inoArduinohttp-post-capteur.inoArduinoheure-gsm.inoArduinoappels.inoArduino