Hi,
I am looking at what is achievable in terms of sleep current with a MKR Zero. On the MKRWAN1310 forum it looks like ~ 100uA is achievable. As posted there I can only get to ~ 600uA. I am re-posting my code below.
I am using a MKR Zero, powered via the J2 pin with a 3.7 Lipo batt. I measure the current with a CurrentRanger.
I started from the RTC example, tried both the rtc.standbyMode() and LowPower.deepSleep() calls : same result.
Any help appreciated. Thx.
#include <RTCZero.h>
#include <ArduinoLowPower.h>
/* Create an rtc object */
RTCZero rtc;
/* Change these values to set the current initial time */
const byte seconds = 0;
const byte minutes = 00;
const byte hours = 17;
/* Change these values to set the current initial date */
const byte day = 24;
const byte month = 11;
const byte year = 20;
void setup()
{
// Set digital pins to input to save on current drain
for (int i=0; i < 15; i++)
{
pinMode(i, INPUT_PULLUP);
}
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
rtc.begin();
rtc.setTime(hours, minutes, seconds);
rtc.setDate(day, month, year);
rtc.setAlarmTime(17, 00, 20);
rtc.enableAlarm(rtc.MATCH_HHMMSS);
rtc.attachInterrupt(alarmMatch);
// detach USB so chip is asleep
USBDevice.detach();
rtc.standbyMode();
}
void loop()
{
//rtc.standbyMode(); // Sleep until next alarm match
LowPower.deepSleep();
}
void alarmMatch()
{
digitalWrite(LED_BUILTIN, HIGH);
USBDevice.attach();
}