Trying -and failing- to put Arduino to Sleep

Hi all! I am trying to power an Arduino Uno via a battery that is charged by a solar panel and now i want to increase the battery discharging time by putting the Arduino Uno to sleep mode. I have also connected a NRF24L01+ module and an MQ-7 Gas sensor to the arduino board.

I would love if i could put the Arduino Uno to sleep for 1 hour, then wake it up, read and trasmit data for 250 seconds and then put it to sleep for 1 hour etc. I downloaded the Low Power Library from

and here is my code:

[spoiler]

#include <SPI.h> 
#include "RF24.h"
#include "LowPower.h"

RF24 myRadio (7, 8);
byte addresses[][6] = {"0"};


int sensorPin = A0;  // select the input pin for the CO sensor
// initialize digital pin ledPin as an output 
 int ledPin = 2;
 
struct package
{
  int id=1;
  char  text[100] = "CO Level:";
  public: int sensorValue = 0; // variable to store the value coming from the sensor
};


typedef struct package Package;
Package data;


void setup()
{
  Serial.begin(9600);
  delay(1000);
  myRadio.begin(); 
  myRadio.setChannel(115);
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS ) ;
  myRadio.openWritingPipe( addresses[0]);
  delay(1000);
 pinMode(ledPin, OUTPUT);   
 
}

void loop()
{
for (int i=0; i<=250; i++) 
{
 analogWrite(ledPin, 255);  // "HIGH" state - 5V 
  delay(60000);            // HIGH" state lasts 60 seconds 
 // After heating it's time to go to "LOW" state 
  analogWrite(ledPin, 72);  // "LOW" state - 1.4V 
  delay(90000);            // "LOW" state lasts for 90 seconds 
 // Waiting 90 more seconds 
  digitalWrite(ledPin, HIGH); 
  delay (50); //small delay so that the sensor does not heat too much 
   // Reading Sensor 
 data.sensorValue = analogRead(sensorPin); 
  myRadio.write(&data, sizeof(data));


  Serial.print("\nPackage:");
  Serial.print(data.id);
  Serial.print("\n");
  Serial.println(data.text);
  Serial.println(data.sensorValue);
  data.id = data.id + 1;
  delay(1000);
}
LowPower.powerDown(SLEEP_3600S, ADC_OFF, BOD_OFF) ;
}

[/spoiler]

I keep getting an "exit status 1
'SLEEP_3600S' was not declared on this scope" error and i do not know what to do.

So, i would appreciate your help. Thanks!

I see this in the header:

enum period_t
{
	SLEEP_15MS,
	SLEEP_30MS,	
	SLEEP_60MS,
	SLEEP_120MS,
	SLEEP_250MS,
	SLEEP_500MS,
	SLEEP_1S,
	SLEEP_2S,
	SLEEP_4S,
	SLEEP_8S,
	SLEEP_FOREVER
};

Looks like eight seconds is the best you can do.

Aaah, i thought so too...So, is there a way to put the arduino to sleep mode for more than 8s? Maybe a timer circuit like this one here will do the trick.

gazp:
Aaah, i thought so too...So, is there a way to put the arduino to sleep mode for more than 8s? Maybe a timer circuit like this one here will do the trick.

Just put it to sleep for 8 seconds and repeat until an hour (or whatever sleep time you want) has elapsed. All you need is a count of the number of times you slept 8.

Tried that too and failed for some reason. I will keep trying though :slight_smile:

Nick Gammon has a page on his site about low power operations.

I finally managed to do what i wanted, thanks everyone!