This project demonstrates how to use Arduino sleep modes to significantly reduce power consumption in battery-powered or continuously running devices. By implementing sleep modes, you can nearly double the runtime of your Arduino projects. The project showcases a weather station using DHT11 sensor that periodically wakes up to read temperature and humidity data, then goes back to sleep to conserve power.
- Multiple Sleep Modes: Demonstrates Idle sleep mode with ATmega328P
- Periodic Wake-Up: Arduino wakes every 8 seconds to read sensor data
- Power Consumption Monitoring: Uses USB ammeter to measure actual power savings
- Temperature & Humidity Monitoring: Integrates DHT11 sensor for weather data
- LED Indicator: Built-in LED shows active/sleep status
- Significant Power Savings: Reduces active time to only 24 seconds per minute
The ATmega328P (used in Arduino UNO, Nano, and Pro Mini) supports six sleep modes:
- Idle Mode - Stops CPU, keeps peripherals running
- ADC Noise Reduction Mode - Optimized for analog readings
- Power-Down Mode - Stops all clocks except async modules
- Power-Save Mode - Like Power-Down but keeps Timer/Counter running
- Standby Mode - Like Power-Down but keeps external oscillator running
- Extended Standby Mode - Like Power-Save but keeps external oscillator running
This project uses Idle Mode which stops the CPU while allowing peripherals to operate, achieving substantial power savings with easy wake-up capabilities.
| Component | Quantity | Description |
|---|---|---|
| Arduino UNO | 1 | Main microcontroller board |
| DHT11 Sensor | 1 | Temperature and humidity sensor |
| USB Ammeter | 1 | For measuring power consumption |
| Breadboard | 1 | For prototyping |
| Connecting Wires | As needed | Jumper wires |
- VCC → Arduino 5V
- GND → Arduino GND
- DATA → Arduino Digital Pin 2
- Arduino plugged into USB Ammeter
- USB Ammeter plugged into laptop/power source USB port
-
DHT Library - For DHT11 sensor interface
Download from Arduino Library Manager or GitHub -
LowPower Library - For sleep mode control
https://github.com/rocketscream/Low-Power
- Download and install both libraries in Arduino IDE
- Go to Sketch → Include Library → Add .ZIP Library
- Select the downloaded library files
#include <dht.h>
#include <LowPower.h>
#define dataPin 2
dht DHT;
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
}
void loop() {
Serial.println("Get Data From DHT11");
delay(1000);
// Turn on LED and read sensor
digitalWrite(LED_BUILTIN, HIGH);
int readData = DHT.read11(dataPin);
float t = DHT.temperature;
float h = DHT.humidity;
Serial.print("Temperature = ");
Serial.print(t);
Serial.print(" C | ");
Serial.print("Humidity = ");
Serial.print(h);
Serial.println(" % ");
delay(2000);
// Enter sleep mode
Serial.println("Arduino:- I am going for a Nap");
delay(200);
digitalWrite(LED_BUILTIN, LOW);
// Sleep for 8 seconds
LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF,
TIMER0_OFF, SPI_OFF, USART0_OFF, TWI_OFF);
Serial.println("Arduino:- Hey I just Woke up");
Serial.println("");
delay(2000);
}#include <dht.h>
#define dataPin 2
dht DHT;
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
int readData = DHT.read11(dataPin);
float t = DHT.temperature;
float h = DHT.humidity;
Serial.print("Temperature = ");
Serial.print(t);
Serial.print(" C | ");
Serial.print("Humidity = ");
Serial.print(h);
Serial.println(" % ");
delay(2000);
}-
Active Phase (24 seconds/minute):
- Wake up from sleep
- Turn ON built-in LED
- Read temperature and humidity from DHT11
- Print data to Serial Monitor
- Turn OFF LED
-
Sleep Phase (36 seconds/minute):
- Enter Idle sleep mode for 8 seconds
- CPU stops, peripherals turned off
- Minimal power consumption
- Automatic wake-up after timeout
The code enables Idle sleep mode using:
LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF,
TIMER0_OFF, SPI_OFF, USART0_OFF, TWI_OFF);This command:
- Sets sleep duration to 8 seconds
- Turns OFF ADC (Analog to Digital Converter)
- Disables all timers (TIMER0, TIMER1, TIMER2)
- Disables SPI communication
- Disables USART (Serial)
- Disables TWI (I2C/Two-Wire Interface)
The USB ammeter is used to measure real-time power consumption:
- Voltage Range: 3.5V to 7V
- Current Rating: Up to 3A
- Display: 4-digit seven-segment display
- Update Rate: Values update every 3 seconds
- Measurement: Voltage and current consumption
By implementing sleep modes, the Arduino:
- Active Time: Only 24 seconds per minute
- Sleep Time: 36 seconds per minute
- Power Savings: Approximately 50% reduction
- Battery Life: Nearly doubles device runtime
- Upload Code: Load the sleep mode code to Arduino via Arduino IDE
- Connect USB Ammeter: Plug Arduino into USB ammeter
- Connect Power: Plug USB ammeter into laptop/power source
- Monitor Serial: Open Serial Monitor at 9600 baud rate
- Observe LED: Watch built-in LED for active/sleep indication
- Read Ammeter: Note current consumption during active vs sleep phases
Arduino can be woken from sleep using:
- Timer Overflow - Automatic wake after set duration
- External Interrupts - Pin change interrupts
- Internal Interrupts - Watchdog timer
- Hardware Reset - Reset button
- Brown-Out Detection - Voltage monitoring
void loop() {
// Attach interrupt to wake up
attachInterrupt(0, wakeUp, LOW);
// Sleep indefinitely until interrupt
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
// Detach interrupt after wake
detachInterrupt(0);
// Resume operations
}| Sleep Mode | CPU | Flash | Timers | ADC | USART | Wake-Up Time |
|---|---|---|---|---|---|---|
| Idle | OFF | OFF | ON | ON | ON | Fast |
| ADC Noise | OFF | OFF | ON | ON | ON | Fast |
| Power-Down | OFF | OFF | OFF | OFF | OFF | 6 cycles |
| Power-Save | OFF | OFF | Timer2* | OFF | OFF | 6 cycles |
| Standby | OFF | OFF | OFF | OFF | OFF | 6 cycles |
| Ext. Standby | OFF | OFF | Timer2* | OFF | OFF | 6 cycles |
*Timer2 continues running in Power-Save and Extended Standby modes
- Battery-Powered Weather Stations
- Remote Sensor Nodes
- IoT Devices with Periodic Data Transmission
- Solar-Powered Arduino Projects
- Long-Term Environmental Monitoring
- Wildlife Tracking Devices
✓ Significant power savings (up to 50% or more)
✓ Extended battery life for portable projects
✓ Reduced heat generation
✓ Suitable for solar/battery operation
✓ Easy implementation with LowPower library
✓ Flexible wake-up options
- Use Power-Down Mode when possible (lowest consumption)
- Disable BOD (Brown-Out Detection) during sleep
- Turn OFF unused LEDs including power LED
- Use efficient voltage regulators (LDO regulators)
- Optimize sleep/wake cycles based on application needs
- Remove USB-Serial chip for ultra-low power (Pro Mini)
- Use external interrupts for event-driven wake-up
| Issue | Solution |
|---|---|
| Serial Monitor not working after sleep | USART is disabled in sleep - data lost during sleep |
| Timer functions not working | Timers disabled in Idle mode - use different sleep mode |
| Can't wake from Power-Down | Ensure external interrupt or watchdog is configured |
| High power consumption | Check for active peripherals, disable unused modules |
- ESP8266 Deep Sleep Mode Programming
- Arduino Interrupt Tutorial
- Using DHT11 with Arduino
- Serial Communication Protocols
- Arduino Projects
This project is open-source and available for educational and commercial use.
Project Tutorial: CircuitDigest
Note: For detailed circuit diagrams, component specifications, and video demonstration, visit the full tutorial.
