Ok I have a nano and a sim900 project. I need to put them to sleep because I need them to save power in order to run from a 20,000mah battery pack which will be rechargeable by solar power.
Anyhow, the way it is set up now, the nano uses an alarmtimer from the alarmtimer library which fires every 3 hours. So every 3 hours, the function to collect data and send sms with that data is fired.
I know to sleep the sim900 I use the AT+CSCLK=2 AT command. I know to sleep the nano I can use the sleep_mode() function. My question is how should I design the project to have the nano & sim900 wake up, do their thing and go back to sleep?
So far the nano starts up, sets the alarm timer and just sits there:
void setup(){
Alarm.timerRepeat(10800, MainAlarm);
}
void loop(){
}
After 3 hours, the MainAlarm() functions is called which does its stuff:
void MainAlarm(){
//..gets all the stuff
sendData(temp,hum);
}
The data then gets sent via sms:
void sendData(double temp, double hum){
sim900.begin(9600);
//...
Then both nano and sim900 just sit there for 3 hours again.
I was thinking of calling sleep mode after data is sent:
void sendData(double temp, double hum){
sim900.begin(9600);
//...
setSIM900ToSleep()
enterNanoSleep()
Then I would not be able to use an external interrupt because I dont have anything external to wake it up, plus the timing is being controlled by the timer alarm.
So how would I bring it back from sleep?