Close Menu
Circuit of Things
  • Home
  • Projects
    • Raspberry Pi Projects
    • Arduino Projects
    • ESP8266 Projects
    • ESP32 Projects
    • IoT Tutorials
    • Sensors & Modules
    • IoT Basics
  • About Us
  • Get In Touch
  • 3D Print
  • Shop Now !
  • Electro Calc

Stay in the Loop!

Subscribe to get the latest IoT tutorials, Arduino projects, and electronics guides delivered straight to your inbox.

Instagram WhatsApp
  • Terms and Conditions
  • Disclaimer
  • Privacy Policy
Circuit of Things Circuit of Things
  • Home
  • Projects
    • Raspberry Pi Projects
    • Arduino Projects
    • ESP8266 Projects
    • ESP32 Projects
    • IoT Tutorials
    • Sensors & Modules
    • IoT Basics
  • About Us
  • Get In Touch
  • 3D Print
  • Shop Now !
  • Electro Calc
Hire us
Circuit of Things
Home»ESP32 Projects»ESP32 Deep Sleep Mode: Extend Battery Life in IoT Projects
ESP32 Projects

ESP32 Deep Sleep Mode: Extend Battery Life in IoT Projects

Sai Preetham KoyyalaBy Sai Preetham KoyyalaMay 4, 2026No Comments1 Min Read
Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
Share
Facebook Twitter LinkedIn Pinterest Email
Contents
  • Introduction
  • Power Modes Comparison
  • Project 1: Timer Wake-Up (Most Common)
  • Project 2: Wake on Button Press
  • RTC Memory Explained
  • Real Battery Life Example
  • Conclusion

Introduction

The ESP32 draws ~240mA at full speed — draining a battery in hours. Deep Sleep drops this to as low as 10 microamperes, extending battery life from hours to weeks. This tutorial covers every deep sleep technique.

Power Modes Comparison

Mode Current CPU
Active ~240mA ON
Light Sleep ~0.8mA Paused
Deep Sleep ~10µA OFF

Project 1: Timer Wake-Up (Most Common)

#define SLEEP_SECS 30
RTC_DATA_ATTR int bootCount = 0; // Survives deep sleep!
void setup() {
  Serial.begin(115200);
  bootCount++;
  Serial.println("Boot #" + String(bootCount));
  // Do your work here: read sensor, send data...
  esp_sleep_enable_timer_wakeup(SLEEP_SECS * 1000000ULL);
  esp_deep_sleep_start();
}
void loop() {}

Project 2: Wake on Button Press

#define BUTTON GPIO_NUM_33
void setup() {
  Serial.begin(115200);
  esp_sleep_enable_ext0_wakeup(BUTTON, 1);
  auto cause = esp_sleep_get_wakeup_cause();
  if (cause == ESP_SLEEP_WAKEUP_EXT0) Serial.println("Woke from button!");
  else Serial.println("Normal boot");
  delay(2000);
  esp_deep_sleep_start();
}
void loop() {}

RTC Memory Explained

Variables declared with RTC_DATA_ATTR are stored in RTC memory (8KB) and survive sleep cycles. Use this for counters, timestamps, or flags between wake cycles.

Real Battery Life Example

  • Active always: 3000mAh / 240mA = ~12.5 hours
  • Sleep 29s, active 1s every 30s: avg ~8mA = ~375 hours (15 days)!

Conclusion

Deep sleep is the single most impactful optimization for battery-powered IoT devices. A simple 30-second sleep cycle can extend battery life from hours to weeks.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous ArticleRaspberry Pi Pico W: Getting Started with MicroPython and Wi-Fi
Next Article ESP8266 NodeMCU Web Server: Control LEDs from Any Browser
Sai Preetham Koyyala
  • Website
  • Facebook
  • X (Twitter)
  • Instagram
  • LinkedIn

Hello, I am Sai Preetham Koyyala. I'm an electronics engineer by profession, a DIY enthusiast by passion. ESP32 and Arduino are the main topics of my work.

Related Posts

ESP32 Projects

ESP32 Firebase Realtime Database: Send and Receive Data from the Cloud

May 4, 2026
ESP32 Projects

ESP32 OTA Updates: Program Your Board Over Wi-Fi with Arduino IDE

May 4, 2026
ESP32 Projects

ESP32 Bluetooth Tutorial: Wireless Serial Communication with Arduino IDE

May 4, 2026
Add A Comment
Leave A Reply Cancel Reply


KSP Electronics
✓ Trusted Store
Everything for Your
Next IoT Build
Boards, sensors, modules & kits delivered fast across India.
ESP32 Arduino Sensors Modules DIY Kits
500+
Products
Fast
Delivery
★★★★★
Rated
🛒 Shop Now →
kspelectronics.in
💻
● Available for Projects
Hire Me for
IoT Projects
ESP32, LoRaWAN, cloud dashboards & custom hardware — end-to-end IoT solutions for your needs.
ESP32 LoRaWAN MQTT Arduino Cloud PCB Design
3+
Yrs Exp
20+
Projects
★★★★★
Rated
💬 Chat on WhatsApp
View services →
Top Posts

Raspberry Pi: How to Control a DC Motor with L298N and PWN on a Web Server

July 14, 2023

Relay Module with Arduino: Control High Voltage Appliances Safely

May 4, 2026

Esp8266 / NodeMCU Pinout: A Comprehensive Guide for Beginners

June 25, 2023
Follow Us
  • Telegram

Stay in the Loop!

Subscribe to get the latest IoT tutorials, Arduino projects, and electronics guides delivered straight to your inbox.

Most Popular

Raspberry Pi: How to Control a DC Motor with L298N and PWN on a Web Server

July 14, 2023

Relay Module with Arduino: Control High Voltage Appliances Safely

May 4, 2026

Esp8266 / NodeMCU Pinout: A Comprehensive Guide for Beginners

June 25, 2023
Our Picks

Relay Module with Arduino: Control High Voltage Appliances Safely

May 4, 2026

NodeMCU ESP8266 Sensor Data to ThingSpeak IoT Platform

May 4, 2026

ESP32 Firebase Realtime Database: Send and Receive Data from the Cloud

May 4, 2026

Stay in the Loop!

Subscribe to get the latest IoT tutorials, Arduino projects, and electronics guides delivered straight to your inbox.

© 2026 Circuit of Things. All Rights Reserved. Built with ❤️ for the Maker Community.

  • About
  • Privacy
X (Twitter) Instagram YouTube WhatsApp
  • Book an Appointment
  • My Bookings
  • Support Us
© 2026 Circuit of Things. Designed by Sai Preetham Koyyala.

Type above and press Enter to search. Press Esc to cancel.