Skip to content

Power Management and Deep Sleep

Albin Varghese edited this page Nov 18, 2024 · 2 revisions

HydroLink Plus Power Management and Deep Sleep Documentation

Table of Contents

  1. Introduction
  2. Key Features
  3. Power Management Architecture
  4. Deep Sleep Mode
  5. Solar Charging and Battery Regulation
  6. Implementation Details
  7. Diagrams and Workflow
  8. Testing and Validation
  9. Conclusion

Introduction

Efficient power management is essential for HydroLink Plus, ensuring the system operates reliably using solar power and battery storage. By integrating dynamic power regulation and ESP32's Deep Sleep Mode, the system achieves optimal energy efficiency, extending battery life and minimizing power wastage.


Key Features

  1. Dynamic Power Regulation:
    • Monitors battery and solar panel inputs to prioritize critical functions.
  2. Deep Sleep Mode:
    • Reduces power consumption during idle periods.
  3. Wake Triggers:
    • Wakes the system only for sensor readings, data transmission, or external events.
  4. Solar Energy Utilization:
    • Uses MPPT (Maximum Power Point Tracking) for efficient solar charging.
  5. Low-Power Hardware:
    • Selects low-power components like the ESP32, Mini 360 Buck Converter, and efficient sensors.

Power Management Architecture

graph TD;
    A[Solar Panel] -->|5V Input| B[MPPT Charger];
    B -->|12V Output| C[Li-ion Battery];
    C -->|12V Input| D[Mini 360 Buck Converter];
    D -->|3.3V/5V Output| E[ESP32];
    E -->|Power Control| F[Sensors and Peripherals];
    E --> G[Motorized Valve];
Loading

Components:

  1. Solar Panel:
    • 5V, 2W solar panel for renewable energy input.
  2. MPPT Charger (CN3791):
    • Optimizes solar energy usage for charging the 12V Li-ion battery.
  3. Mini 360 Buck Converter:
    • Regulates voltage from 12V to 3.3V or 5V for the ESP32 and sensors.

Deep Sleep Mode

The Deep Sleep Mode on the ESP32 minimizes power consumption by shutting down most peripherals and retaining only essential operations in RTC memory.

Features:

  1. Power Consumption:
    • ~10 µA in Deep Sleep, compared to ~100 mA in active mode.
  2. RTC Memory:
    • Stores essential data like timestamps and wake triggers.

Wake Triggers

  1. Timer-Based Wake-Up:
    • Wakes the ESP32 periodically (e.g., every 30 minutes) for sensor readings and data transmission.
  2. External Interrupts:
    • Wakes on events like tampering detection or valve commands.
  3. Sensor Alerts:
    • Configurable wake triggers for specific water quality thresholds.

Power Consumption Profile

Mode Power Consumption
Active Mode ~100 mA
Deep Sleep ~10 µA
Sensor Reading ~50 mA
Valve Control ~150 mA

Solar Charging and Battery Regulation

Solar Panel Integration

  • The 5V, 2W solar panel connects to the CN3791 MPPT charger module, which optimizes energy harvesting under varying sunlight conditions.

Battery Regulation

  1. Battery Type:
    • 12V 2200mAh Li-ion battery.
  2. Voltage Monitoring:
    • Regularly checks battery levels to decide operational priorities.
  3. Critical Power Mode:
    • Disables non-critical functions when battery levels are low.

Implementation Details

ESP32 Configuration

Deep Sleep Setup

  1. Enable Deep Sleep Mode in the firmware:
    esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
    esp_deep_sleep_start();
  2. Configure wake-up sources:
    esp_sleep_enable_ext0_wakeup(GPIO_NUM_0, 1); // Wake on button press
    esp_sleep_enable_ext1_wakeup(GPIO_SEL_35, ESP_EXT1_WAKEUP_ANY_HIGH); // Wake on sensor alert

RTC Memory

Store critical variables in RTC memory:

RTC_DATA_ATTR int boot_count = 0;
boot_count++;

Voltage Regulation

  1. Use the Mini 360 Buck Converter to step down from 12V (battery) to 3.3V (ESP32 supply).
  2. Include capacitors (e.g., 10 µF and 100 µF) for voltage smoothing.

Diagrams and Workflow

Deep Sleep Workflow

graph TD;
    A[Active Mode] --> B{Idle Period?};
    B -->|Yes| C[Enter Deep Sleep];
    B -->|No| D[Continue Operations];
    C --> E[Wake Event?];
    E -->|Yes| A;
    E -->|No| C;
Loading

Power Flow Diagram

graph TD;
    A[Solar Panel] -->|Power Input| B[MPPT Charger];
    B -->|Battery Output| C[Li-ion Battery];
    C -->|Regulated Output| D[ESP32 and Peripherals];
Loading

Testing and Validation

Deep Sleep Testing

  1. Use an ammeter to measure power draw in Deep Sleep Mode.
  2. Verify wake triggers by simulating:
    • Timer wake-ups.
    • External GPIO interrupts.

Solar Charging Test

  1. Test solar panel performance under direct sunlight and cloudy conditions.
  2. Verify battery charging levels using a multimeter.

Voltage Stability Test

  1. Monitor voltage levels from the buck converter during high load (e.g., valve operation).
  2. Ensure no significant voltage drops during transitions.
HydroLink Plus ©2024

Clone this wiki locally