# ESP32 Weather Station Power Analysis ## Power Consumption Analysis ### Component Power Requirements #### ESP32 Development Board - **Active Mode**: 160-260mA (typical 200mA) - **WiFi Transmission**: 200-250mA peaks - **Sleep Mode**: 10-150µA (deep sleep) - **Operating Voltage**: 3.3V - **Power**: ~0.66W (active), ~0.825W (WiFi peak) #### Sensors - **DHT11**: 1.5mA (measurement), 40µA (standby) - **BMP180**: 1mA (measurement), 5µA (standby) - **Rain Sensor Module**: 3-5mA (continuous) - **LDR Circuit**: ~0.3mA (with 10kΩ pull-down) #### LED Indicator - **LED**: 20mA (full brightness) - **With 220Ω resistor**: ~15mA @ 3.3V ### Total Power Consumption #### Active Operation (WiFi + All Sensors) ``` ESP32 (active): 200mA WiFi transmission: 250mA (peaks) DHT11: 1.5mA BMP180: 1mA Rain Sensor: 5mA LDR Circuit: 0.3mA LED: 15mA --------------------------- Total (typical): ~473mA Total (peak): ~523mA ``` #### Low Power Operation (WiFi Sleep) ``` ESP32 (modem sleep): 80mA DHT11 (standby): 0.04mA BMP180 (standby): 0.005mA Rain Sensor: 5mA LDR Circuit: 0.3mA LED (off): 0mA --------------------------- Total: ~90mA ``` #### Deep Sleep Mode ``` ESP32 (deep sleep): 0.01mA DHT11 (standby): 0.04mA BMP180 (standby): 0.005mA Rain Sensor: 0mA (if powered down) LDR Circuit: 0mA LED (off): 0mA --------------------------- Total: ~0.055mA ``` ## 18650 Battery Analysis ### 18650 Battery Specifications - **Capacity**: 2000-3500mAh (typical 2500mAh) - **Voltage**: 3.7V (nominal), 4.2V (full), 2.5V (empty) - **Energy**: ~9.25Wh (2500mAh × 3.7V) - **Discharge Rate**: 1C-2C typical (2.5A-5A for 2500mAh) ### Runtime Calculations #### Scenario 1: Continuous Active Operation - **Current Draw**: 473mA @ 3.7V - **Battery Capacity**: 2500mAh - **Runtime**: 2500mAh ÷ 473mA = **5.3 hours** #### Scenario 2: Intermittent Operation (Normal Use) - **Active (30%)**: 473mA × 0.3 = 141.9mA average - **Low Power (70%)**: 90mA × 0.7 = 63mA average - **Total Average**: 204.9mA - **Runtime**: 2500mAh ÷ 204.9mA = **12.2 hours** #### Scenario 3: Deep Sleep Strategy - **Active (5%)**: 473mA × 0.05 = 23.65mA - **Deep Sleep (95%)**: 0.055mA × 0.95 = 0.052mA - **Total Average**: 23.7mA - **Runtime**: 2500mAh ÷ 23.7mA = **105 hours (4.4 days)** #### Scenario 4: Optimized Operation - **Active (10%)**: 473mA × 0.1 = 47.3mA - **Moderate Sleep (90%)**: 80mA × 0.9 = 72mA - **Total Average**: 119.3mA - **Runtime**: 2500mAh ÷ 119.3mA = **20.9 hours** ## Power Management Recommendations ### Voltage Regulation Since ESP32 and sensors operate at 3.3V, but 18650 provides 3.7V: ``` 18650 (3.7V) → DC-DC Buck Converter → 3.3V ``` **Required Converter Specifications:** - **Input Voltage**: 2.5V-4.2V - **Output Voltage**: 3.3V - **Efficiency**: >90% - **Max Current**: >600mA - **Recommended**: TP4056 with protection + 3.3V LDO or buck converter ### Power Management Strategies #### 1. WiFi Sleep Mode ```cpp // Enable WiFi sleep between transmissions WiFi.setSleep(true); ``` #### 2. Deep Sleep with Timer ```cpp // Sleep for 5 minutes between readings esp_sleep_enable_timer_wakeup(5 * 60 * 1000000); esp_deep_sleep_start(); ``` #### 3. Sensor Power Management ```cpp // Power down sensors when not reading digitalWrite(SENSOR_POWER_PIN, LOW); ``` #### 4. LCD Backlight Control ```cpp // Turn off backlight when not needed lcd.noBacklight(); ``` ### Battery Monitoring #### Voltage Monitoring ```cpp // Monitor battery voltage float batteryVoltage = analogRead(BATTERY_PIN) * (3.3 / 4096.0) * 2.0; // Voltage divider if (batteryVoltage < 3.0) { // Low battery warning } ``` #### Battery Percentage ```cpp int batteryPercentage = map(batteryVoltage, 3.0, 4.2, 0, 100); ``` ## Power Optimization Code ### Optimized Loop Structure ```cpp void loop() { // Wake up sensors digitalWrite(SENSOR_POWER_PIN, HIGH); delay(100); // Read sensors readSensors(); // Update display briefly updateDisplay(); // Send MQTT data sendMQTTData(); // Power down sensors digitalWrite(SENSOR_POWER_PIN, LOW); lcd.noBacklight(); // Sleep for extended period esp_sleep_enable_timer_wakeup(300000000); // 5 minutes esp_deep_sleep_start(); } ``` ### Battery-Powered Configuration ```cpp // Power saving settings WiFi.setSleep(true); WiFi.setTxPower(WIFI_POWER_LOW); adc_set_cali_scheme(ADC_CALI_SCHEME_VER_CURVE); ``` ## Recommendations ### For Single 18650 Operation: 1. **Use Deep Sleep**: Essential for multi-day operation 2. **Optimize Reading Frequency**: 5-15 minute intervals 3. **Power Down Sensors**: Cut power when not reading 4. **Use Efficient Voltage Regulation**: Buck converter >90% efficiency 5. **Monitor Battery Voltage**: Prevent over-discharge ### Expected Runtime with Optimization: - **Conservative**: 3-4 days (5-minute readings) - **Aggressive**: 7-10 days (15-minute readings) - **Minimal**: 14+ days (30-minute readings) ### Hardware Requirements: - 18650 battery (2500mAh+ recommended) - Battery holder with protection circuit - 3.3V buck converter (high efficiency) - Battery voltage divider for monitoring - Optional: Solar panel for charging ## Conclusion **Yes, one 18650 can run this system**, but with important considerations: - **Continuous Operation**: ~5 hours (not practical) - **Optimized Operation**: 3-10 days (with deep sleep) - **Key Requirement**: Deep sleep implementation is essential - **Voltage Regulation**: Proper 3.3V regulation needed - **Battery Protection**: Prevent over-discharge below 3.0V For reliable long-term operation, implement deep sleep with periodic wake-up cycles for sensor readings.