OC
OceanRemote
Low-code IoT platform
← Back to Course

Deep Sleep for Battery Operation

🔋 Deep Sleep Power Saving

ESP8266 deep sleep reduces power to 20μA - perfect for solar-powered sensors!

📖 Deep Sleep Code:

#include 

const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";

void setup() {
    Serial.begin(115200);
    
    // Connect and send data
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) delay(500);
    
    // Send sensor data here
    Serial.println("Sending data...");
    
    Serial.println("Going to deep sleep for 5 minutes");
    ESP.deepSleep(5 * 60 * 1000000);  // 5 minutes in microseconds
}

void loop() {
    // Empty - never runs
}
    

🔋 Battery Life Calculation:

  • Wake time: 3 seconds @ 70mA = 0.058mAh per cycle
  • Sleep time: 5 minutes @ 0.02mA = 0.0017mAh per cycle
  • Total per 5 minutes: ~0.06mAh
  • Daily consumption: 0.06 × 288 = 17mAh
  • 2000mAh battery lasts: 2000 ÷ 17 = 117 days!
💡 Important:

Connect GPIO16 to RST pin for deep sleep wake-up! Without this connection, ESP8266 won't wake.

💡 Key Takeaways:
  • Apply these concepts directly to your farm or project.
  • Take notes on important details for the quiz.
  • Use the button below to track your progress.