Sleeping a Nano & Sim900...how should I program the wake up call?

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?

Switch to a Promini or similar without USB/Serial chip to save power, and add DS3231 module with programmable alarm to wake the sleeping microcontroller using an external interrupt to do whatever, set the next alarm time, and go back to sleep.

Thanks but I'd like another option for current setup with the nano.

What is your plan to save power on the 5V regulator and the USB/Serial adapter chip (FT232 on a real Nano)?
If you're using the Nano as the time source, you can't really put it to sleep, can you? Your time tracking will then come from the watchdog timer creating an interrupt roughly every 8 seconds (I've read it's not real accurate), updating the time your sketch is maintaining, checking if it's time to do something, updating the time and doing something if needed and then going back to sleep.
External battery-backed RTC with accurate time and programmable alarm might be simpler.

Doh! Good point! :slight_smile: . Ill have to run the numbers to see if sleeping the sim is enough. But of course the best would be to sleep both. So while my ds3231 arrives, ill work with sleeping the sim900.

Thanks!