Issues getting sleep mode to function

Hi, I’ve got a project I’m working on to help with a breeding program for Kakapo, a critically endangered bird species in New Zealand. You can check it out on my Github page or project blog.

I’m having an issue trying to get the Arduino to wake from sleep. So far the code appears to execute only once - playing the audio file and then it does nothing. I’m certain this is due to my lack of understanding in how to use sleep mode.

I’ve tried using a number of Arduino sleep libraries, they all appear to have the same issue.
I’m not sure if the LowPower.h is conflicting with the serial read off the .wav file on the SD card, but if I drop it into sleep mode it doesn’t appear to come out of it.

I can run the code successfully without the sleep mode and using delay() instead, but the criteria for the project requires conserving enough battery power to run for 2 - 3 days.

I’ve included a code snippet below:

Any advice or suggestions on what I can do here would be greatly appreciated! Apologies if I’m missing something obvious I’m learning to code.

#include <pcmConfig.h>
#include <pcmRF.h>
#include <TMRpcm.h>
#include <SPI.h>
#include <SD.h>
#include <LowPower.h>

#define SD_ChipSelectPin 10

TMRpcm chirp;

void setup() {
  chirp.speakerPin = 9;
  Serial.begin(9600);
  if (!SD.begin(SD_ChipSelectPin)) {}
}
void loop() {    
    chirp.play("K2.WAV");
    LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF, SPI_OFF, USART0_OFF, TWI_OFF); // Power down mode to preserve battery until next loop
}

but the criteria for the project requires conserving enough battery power to run for 2 - 3 days.

I don't have any problems with the Arduino running for a week or more without sleeping.

I've included a code snippet below:

I've included an answer snippet below.

You need to post a ...

dmac: I can run the code successfully without the sleep mode and using delay() instead, but the criteria for the project requires conserving enough battery power to run for 2 - 3 days.

Is that all?

http://www.gammon.com.au/power