Nick Koumaris
Published © CC BY-NC-SA

ESP32 Deep Sleep Tutorial

Have you imagined your project to last on regular AA batteries for almost 5 years? This is possible with the ESP32 chip.

BeginnerFull instructions provided1 hour50,405
ESP32 Deep Sleep Tutorial

Things used in this project

Hardware components

ESP32S
Espressif ESP32S
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Code snippet #3

Plain text
void setup(){  pinMode(GREEN_LED_PIN,OUTPUT);
  pinMode(YELLOW_LED_PIN,OUTPUT);
  delay(500);
  
  if(bootCount == 0) //Run this only the first time
  {
      digitalWrite(YELLOW_LED_PIN,HIGH);
      bootCount = bootCount+1;
  }else
  {
      digitalWrite(GREEN_LED_PIN,HIGH);
  }
  
  delay(3000);  digitalWrite(GREEN_LED_PIN,LOW);
  digitalWrite(YELLOW_LED_PIN,LOW);  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
  esp_deep_sleep_start();
}

Credits

Nick Koumaris

Nick Koumaris

13 projects • 310 followers
My name is Nick Koumaris and I am a software engineer from Sparta, Greece. I love building projects and share them with the world!

Comments