Explorar el Código

Update power_analysis to Wemos

svalavuo hace 1 mes
padre
commit
e0d61aed59
Se han modificado 1 ficheros con 93 adiciones y 61 borrados
  1. 93 61
      power_analysis.md

+ 93 - 61
power_analysis.md

@@ -1,15 +1,16 @@
-# ESP32 Weather Station Power Analysis
+# Wemos D1 Mini 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)
+#### Wemos D1 Mini Development Board
+- **Active Mode**: 70-200mA (typical 150mA)
+- **WiFi Transmission**: 150-200mA peaks
+- **Deep Sleep Mode**: 10-20µA
+- **Modem Sleep**: 80mA
 - **Operating Voltage**: 3.3V
-- **Power**: ~0.66W (active), ~0.825W (WiFi peak)
+- **Power**: ~0.5W (active), ~0.66W (WiFi peak)
 
 #### Sensors
 - **DHT11**: 1.5mA (measurement), 40µA (standby)
@@ -21,44 +22,51 @@
 - **LED**: 20mA (full brightness)
 - **With 220Ω resistor**: ~15mA @ 3.3V
 
+#### Battery Monitoring
+- **Voltage Divider**: ~0.1mA (100kΩ + 100kΩ)
+- **ADC Reading**: Minimal additional current
+
 ### Total Power Consumption
 
 #### Active Operation (WiFi + All Sensors)
 ```
-ESP32 (active):        200mA
-WiFi transmission:     250mA (peaks)
+Wemos D1 Mini (active): 150mA
+WiFi transmission:     200mA (peaks)
 DHT11:                 1.5mA
 BMP180:                1mA
 Rain Sensor:           5mA
 LDR Circuit:           0.3mA
 LED:                   15mA
+Battery Monitor:       0.1mA
 ---------------------------
-Total (typical):       ~473mA
-Total (peak):          ~523mA
+Total (typical):       ~172mA
+Total (peak):          ~222mA
 ```
 
 #### 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
+Wemos D1 Mini (modem sleep): 80mA
+DHT11 (standby):              0.04mA
+BMP180 (standby):             0.005mA
+Rain Sensor:                  5mA
+LDR Circuit:                  0.3mA
+LED (off):                    0mA
+Battery Monitor:              0.1mA
+-------------------------------
+Total:                        ~85mA
 ```
 
 #### 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
+Wemos D1 Mini (deep sleep): 0.02mA
+DHT11 (standby):             0.04mA
+BMP180 (standby):            0.005mA
+Rain Sensor:                0mA (if powered down)
+LDR Circuit:                 0mA
+LED (off):                   0mA
+Battery Monitor:             0.1mA
+-------------------------------
+Total:                       ~0.165mA
 ```
 
 ## 18650 Battery Analysis
@@ -72,32 +80,40 @@ Total:                 ~0.055mA
 ### Runtime Calculations
 
 #### Scenario 1: Continuous Active Operation
-- **Current Draw**: 473mA @ 3.7V
+- **Current Draw**: 172mA @ 3.7V
 - **Battery Capacity**: 2500mAh
-- **Runtime**: 2500mAh ÷ 473mA = **5.3 hours**
+- **Runtime**: 2500mAh ÷ 172mA = **14.5 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**
+- **Active (30%)**: 172mA × 0.3 = 51.6mA average
+- **Low Power (70%)**: 85mA × 0.7 = 59.5mA average
+- **Total Average**: 111.1mA
+- **Runtime**: 2500mAh ÷ 111.1mA = **22.5 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)**
+- **Active (5%)**: 172mA × 0.05 = 8.6mA
+- **Deep Sleep (95%)**: 0.165mA × 0.95 = 0.157mA
+- **Total Average**: 8.76mA
+- **Runtime**: 2500mAh ÷ 8.76mA = **285 hours (11.9 days)**
 
 #### Scenario 4: Optimized Operation
-- **Active (10%)**: 473mA × 0.1 = 47.3mA
+- **Active (10%)**: 172mA × 0.1 = 17.2mA
 - **Moderate Sleep (90%)**: 80mA × 0.9 = 72mA
-- **Total Average**: 119.3mA
-- **Runtime**: 2500mAh ÷ 119.3mA = **20.9 hours**
+- **Total Average**: 89.2mA
+- **Runtime**: 2500mAh ÷ 89.2mA = **28.0 hours**
+
+#### Scenario 5: Solar-Assisted Operation
+- **Active (30%)**: 172mA × 0.3 = 51.6mA average
+- **Low Power (70%)**: 85mA × 0.7 = 59.5mA average
+- **Total Average**: 111.1mA
+- **Solar Input**: 6V 2W panel provides ~333mA @ 3.3V
+- **Net Consumption**: 111.1mA - 333mA = -222mA (charging)
+- **Runtime**: **Continuous operation with battery charging**
 
 ## Power Management Recommendations
 
 ### Voltage Regulation
-Since ESP32 and sensors operate at 3.3V, but 18650 provides 3.7V:
+Since Wemos D1 Mini and sensors operate at 3.3V, but 18650 provides 3.7V:
 
 ```
 18650 (3.7V) → DC-DC Buck Converter → 3.3V
@@ -107,8 +123,8 @@ Since ESP32 and sensors operate at 3.3V, but 18650 provides 3.7V:
 - **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
+- **Max Current**: >200mA (Wemos D1 Mini requirement)
+- **Recommended**: TP4056 with protection + 3.3V buck converter
 
 ### Power Management Strategies
 
@@ -121,8 +137,7 @@ 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();
+ESP.deepSleep(5 * 60 * 1000000); // Wemos D1 Mini
 ```
 
 #### 3. Sensor Power Management
@@ -131,18 +146,18 @@ esp_deep_sleep_start();
 digitalWrite(SENSOR_POWER_PIN, LOW);
 ```
 
-#### 4. LCD Backlight Control
+#### 4. LED Power Management
 ```cpp
-// Turn off backlight when not needed
-lcd.noBacklight();
+// Turn off LED when not needed
+digitalWrite(LED_PIN, LOW);
 ```
 
 ### Battery Monitoring
 
 #### Voltage Monitoring
 ```cpp
-// Monitor battery voltage
-float batteryVoltage = analogRead(BATTERY_PIN) * (3.3 / 4096.0) * 2.0; // Voltage divider
+// Monitor battery voltage (Wemos D1 Mini - 10-bit ADC)
+float batteryVoltage = analogRead(BATTERY_PIN) * (3.3 / 1023.0) * 2.0; // Voltage divider
 if (batteryVoltage < 3.0) {
   // Low battery warning
 }
@@ -183,10 +198,9 @@ void loop() {
 
 ### Battery-Powered Configuration
 ```cpp
-// Power saving settings
+// Power saving settings (Wemos D1 Mini)
 WiFi.setSleep(true);
-WiFi.setTxPower(WIFI_POWER_LOW);
-adc_set_cali_scheme(ADC_CALI_SCHEME_VER_CURVE);
+WiFi.setSleepMode(WIFI_LIGHT_SLEEP);
 ```
 
 ## Recommendations
@@ -199,25 +213,43 @@ adc_set_cali_scheme(ADC_CALI_SCHEME_VER_CURVE);
 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)
+- **Conservative**: 7-10 days (5-minute readings)
+- **Aggressive**: 14-21 days (15-minute readings)
+- **Minimal**: 28+ days (30-minute readings)
+- **Solar-Assisted**: Continuous operation with battery charging
 
 ### 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
+- 6V 2W solar panel for continuous operation
+
+## Power Consumption Comparison
+
+### ESP32 vs Wemos D1 Mini
+| Feature | ESP32 | Wemos D1 Mini | Improvement |
+|---------|-------|---------------|-------------|
+| **Active Current** | 200mA | 150mA | 25% less |
+| **WiFi Peak** | 250mA | 200mA | 20% less |
+| **Deep Sleep** | 0.01mA | 0.02mA | Similar |
+| **Battery Runtime** | 5.3 hours | 14.5 hours | 174% better |
+| **Deep Sleep Runtime** | 105 hours | 285 hours | 171% better |
+
+### Solar Panel Requirements
+- **ESP32 System**: 6V 3W panel recommended
+- **Wemos D1 Mini System**: 6V 2W panel sufficient
+- **Power Margin**: Wemos D1 Mini has 33% more solar margin
 
 ## Conclusion
 
-**Yes, one 18650 can run this system**, but with important considerations:
+**Yes, one 18650 can run this system exceptionally well**, with significant advantages:
 
-- **Continuous Operation**: ~5 hours (not practical)
-- **Optimized Operation**: 3-10 days (with deep sleep)
-- **Key Requirement**: Deep sleep implementation is essential
+- **Continuous Operation**: 14.5 hours (practical for daily use)
+- **Optimized Operation**: 7-21 days (with deep sleep)
+- **Solar-Assisted**: Continuous operation with battery charging
+- **Key Advantage**: Wemos D1 Mini's lower power consumption
 - **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.
+The Wemos D1 Mini provides superior battery life compared to ESP32, making it ideal for battery-powered weather station applications. With solar panel integration, truly autonomous operation is achievable.