solar_battery_system.md 6.9 KB

Solar + 18650 Battery Power System

System Overview

Complete solar-powered weather station with 18650 battery backup for continuous operation.

Power System Components

Battery System

  • 18650 Battery: 2500-3500mAh, 3.7V
  • Battery Holder: 1x18650 with protection circuit
  • TP4056 Charging Module: USB charging with protection
  • Battery Management System (BMS): Overcharge/discharge protection

Solar System

  • Solar Panel: 5V-6V, 1-2W (recommended 6V 2W)
  • Solar Charge Controller: TP4056 or dedicated solar controller
  • Diode: Schottky diode for reverse polarity protection
  • Mounting: Adjustable angle for optimal sun exposure

Power Regulation

  • 3.3V Buck Converter: High efficiency (>90%)
  • Voltage Divider: For battery monitoring
  • Power Switch: Manual power control
  • LED Indicators: Charging status, battery level

Circuit Design

Solar Charging Circuit

Solar Panel (6V 2W)
    │
    ├───[Schottky Diode]───┐
    │                      │
    ▼                      ▼
TP4056 Charging Module    18650 Battery
    │                      │
    ├───[Protection]──────┘
    │
    ▼
3.3V Buck Converter
    │
    ▼
Wemos D1 Mini + Sensors

Battery Monitoring Circuit

Battery (3.0V-4.2V)
    │
    ├───[100kΩ]───┐
    │             │
    ▼             ▼
   GND          A0 (Wemos)
    │             │
    └───[100kΩ]───┘

Power Consumption Analysis

Wemos D1 Mini Power Requirements

  • Active Mode: 150mA @ 3.3V
  • WiFi Transmission: 200mA peaks
  • Deep Sleep: 0.02mA
  • Sensors: 10mA total
  • Total Active: ~160mA

Solar Panel Requirements

  • Daily Energy Need: 160mA × 24h = 3840mAh
  • Solar Efficiency: ~70% (cloudy days, angle)
  • Required Solar: 3840mAh ÷ 0.7 ÷ 6h = 914mAh
  • Recommended Panel: 6V 2W (333mA @ 6V)

Battery Runtime

  • Battery Capacity: 2500mAh
  • Continuous Runtime: 2500mAh ÷ 160mA = 15.6 hours
  • With Solar: Continuous operation
  • Deep Sleep Runtime: 2500mAh ÷ 0.02mA = 125,000 hours (~14 years)

Hardware Components

Required Parts

  1. 18650 Battery (2500mAh+) - 1x
  2. TP4056 Charging Module - 1x
  3. Solar Panel (6V 2W) - 1x
  4. 3.3V Buck Converter - 1x
  5. Schottky Diode (1N5817) - 1x
  6. Resistors (100kΩ × 2) - 2x
  7. Battery Holder (1x18650) - 1x
  8. Power Switch - 1x
  9. LEDs (red/green) - 2x
  10. 330Ω Resistors (for LEDs) - 2x

Optional Parts

  • Solar Charge Controller (MPPT for better efficiency)
  • Battery Level Indicator (LED bar graph)
  • Weatherproof Enclosure
  • Solar Panel Mount

Assembly Instructions

Step 1: Battery System

  1. Connect 18650 to TP4056 module
  2. Verify protection circuit is working
  3. Test charging with USB power
  4. Check battery voltage (3.0V-4.2V range)

Step 2: Solar Integration

  1. Connect solar panel to TP4056 input
  2. Add Schottky diode for reverse protection
  3. Test solar charging in sunlight
  4. Verify charging LED operation

Step 3: Power Regulation

  1. Connect battery output to 3.3V buck converter
  2. Set output voltage to 3.3V
  3. Test with load (Wemos D1 Mini)
  4. Verify efficiency (>90%)

Step 4: Battery Monitoring

  1. Build voltage divider (100kΩ + 100kΩ)
  2. Connect to A0 pin
  3. Calibrate reading with known voltage
  4. Implement battery percentage calculation

Step 5: System Integration

  1. Connect all components
  2. Add power switch
  3. Add status LEDs
  4. Test complete system

Code Implementation

Battery Monitoring

#define BATTERY_PIN A0
#define BATTERY_VOLTAGE_DIVIDER 2.0

float getBatteryVoltage() {
  int adcValue = analogRead(BATTERY_PIN);
  float voltage = adcValue * (3.3 / 1023.0) * BATTERY_VOLTAGE_DIVIDER;
  return voltage;
}

int getBatteryPercentage() {
  float voltage = getBatteryVoltage();
  // Map 3.0V (0%) to 4.2V (100%)
  int percentage = map(voltage * 100, 300, 420, 0, 100);
  return constrain(percentage, 0, 100);
}

Power Management

void managePower() {
  int batteryLevel = getBatteryPercentage();
  
  // Low battery warning
  if (batteryLevel < 20) {
    // Enter deep sleep to conserve power
    Serial.println("Low battery - entering deep sleep");
    esp_sleep_enable_timer_wakeup(300000000); // 5 minutes
    esp_deep_sleep_start();
  }
  
  // Send battery status via MQTT
  String batteryPayload = "{\"battery\":" + String(batteryLevel) + "}";
  client.publish("weather/battery", batteryPayload.c_str());
}

Solar Panel Sizing

Location-Based Sizing

Location Peak Sun Hours Recommended Panel
Sunny 6+ hours 6V 1W
Moderate 4-6 hours 6V 2W
Cloudy 2-4 hours 6V 3W

Panel Specifications

  • Voltage: 6V nominal (5V-7V operating)
  • Current: 167mA-500mA (1W-3W)
  • Efficiency: >17% (monocrystalline)
  • Size: 100mm x 70mm (1W) to 200mm x 140mm (3W)

Battery Management

Charging Stages

  1. Bulk Charge: Constant current until 4.2V
  2. Absorption Charge: Constant voltage at 4.2V
  3. Float Charge: Maintenance at 4.0V

Protection Features

  • Overcharge Protection: Cuts off at 4.2V
  • Over-discharge Protection: Cuts off at 2.5V
  • Short Circuit Protection: Current limiting
  • Temperature Protection: Thermal cutoff

Battery Life Optimization

  • Depth of Discharge: Keep above 20%
  • Temperature: Operate 0°C-45°C
  • Charging: Avoid overcharging
  • Storage: Charge to 40% for long-term storage

Expected Performance

Daily Operation

  • Sunny Day: Solar provides 100% of power needs
  • Cloudy Day: Battery supplements solar power
  • Night Operation: Battery provides 100% of power needs
  • Continuous Operation: 24/7 operation possible

Battery Life

  • Cycle Life: 500-1000 cycles (2-3 years)
  • Calendar Life: 3-5 years
  • Self-Discharge: <2% per month
  • Temperature Impact: High temperature reduces life

Troubleshooting

Common Issues

  • No Charging: Check solar panel connection and sunlight
  • Low Battery: Verify panel size and sun exposure
  • System Resets: Check power supply stability
  • Inaccurate Reading: Calibrate voltage divider

Testing Procedures

  1. Solar Output: Measure panel voltage in sunlight
  2. Charging Current: Measure current to battery
  3. System Load: Measure current draw
  4. Battery Voltage: Verify monitoring accuracy

Maintenance

Regular Checks

  • Clean solar panel surface
  • Check battery connections
  • Verify charging status
  • Monitor battery health

Seasonal Adjustments

  • Adjust panel angle for sun position
  • Increase panel size for winter months
  • Check for weather damage
  • Verify waterproofing

This solar + battery system enables truly autonomous weather station operation with minimal maintenance requirements.