Arduino MKR series low power code

Hi,
I have a number of projects using the MKR 1400 gsm board and would like to reduce the power consumption when the processor is idling. The current code i use is:

setup() {
  if (sleeping==1) {
    USB->DEVICE.CTRLA.reg &= ~USB_CTRLA_ENABLE;

    // Set the alarm at the 5 second mark
    _RTC.setAlarmSeconds(5);
  
    // Match only seconds
    _RTC.enableAlarm(RTCZero::MATCH_SS);
  
    // Set sleep mode
    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
  }
}

void loop() {
  //do some stuff

  digitalWrite(LED, HIGH); digitalWrite(extLED, HIGH);
  delay(15);
  digitalWrite(LED, LOW); digitalWrite(extLED, LOW);

  if (sleeping==1) {

    __WFI();
    
    _RTC.setAlarmSeconds((_RTC.getAlarmSeconds() + 5) % 60);
    
  }
}

The above code will drop the current draw to about 20 mA during idle but i would like to get down to about 1- 5 mA max if possible. Is this doable?

Any help is much appreciated.

Cheers.

Any ideas on this?

Cheers.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.