Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

ESPHome Autonomous Solar Weather Station

An ultra-low-power, solar-charged weather station and environmental telemetry node built on the ESP8266 (NodeMCU v2) and ESPHome. Designed for native integration with Home Assistant, this project features a dual-bus I2C architecture to support remote sensor deployment, dynamic deep sleep management, and a fully autonomous solar power system with bidirectional energy profiling.

Key Features

  • Autonomous Solar Power System: Integrates a DFRobot Solar Power Manager (5V) to harvest solar energy and safely charge a parallel bank of two 18650 lithium-ion cells, enabling continuous off-grid operation.
  • Bidirectional Power Profiling: Utilizes an INA219 sensor to monitor bus voltage and net current. Current readings map the system's energy flow: positive values indicate active power consumption by the ESP8266, while negative values indicate active solar charging of the battery bank.
  • Dual I2C Bus Architecture: Implements two independent software I2C buses. A short bus handles local power telemetry, while a secondary long bus connects to the external environmental sensors. This physical separation provides fault isolation, ensuring that a hardware failure, short circuit, or lock-up on one device does not disrupt the entire I2C network and the other devices remain operational.
  • Dynamic Deep Sleep Management: Operates on an aggressive ~1-hour sleep cycle (3565 seconds) to maximize battery autonomy. Features a remote Home Assistant override (disable_deep_sleep) to keep the microcontroller awake for OTA updates and maintenance.
  • High-Precision Telemetry: Collects redundant environmental data (temperature, humidity, atmospheric pressure) utilizing external BMP280 and AHT10 sensors.

Hardware Requirements

  • Microcontroller: NodeMCU v2 (ESP8266)
  • Power Manager: DFRobot Solar Power Manager 5V
  • Solar Panel: Compatible 5V/6V Solar Panel
  • Battery: 2x 18650 Lithium-Ion cells (wired in parallel, 3.7V nominal)
  • Power Sensor: INA219 (I2C, Address: 0x40, with 0.1 Ohm shunt)
  • THP Sensor 1: BMP280 (I2C, Address: 0x77)
  • TH Sensor 2: AHT10 (I2C)

Pinout and Bus Configuration

NodeMCU v2 Pin ESP8266 GPIO Connected Peripheral
D2 GPIO4 INA219 (SDA)
D1 GPIO5 INA219 (SCL)
D3 GPIO0 BMP280 / AHT10 (SDA)
D7 GPIO13 BMP280 / AHT10 (SCL)
D0 GPIO16 RST (Reset)

Note: For the deep sleep function to work, a physical jumper wire must connect pin D0 (GPIO16) to the RST (Reset) pin. When the sleep timer expires, the ESP8266's internal Real-Time Clock (RTC) sends a low pulse through GPIO16 to reset and wake up the microcontroller. Without this physical connection, the device will enter deep sleep but will never wake up.

Software & Operational Logic

Deep Sleep Lifecycle

To achieve long-term autonomy on battery power, the firmware relies on a tightly controlled execution loop:

  1. Boot & Network Acquisition (Priority 500): Upon waking, the ESP8266 attempts a Wi-Fi connection. If connection fails within 15 seconds, it aborts the cycle and returns to deep sleep to conserve power.
  2. Telemetry Acquisition: Sensors (INA219, BMP280, AHT10) broadcast data to Home Assistant at 10-second intervals.
  3. Sleep Evaluation (Priority -100): After 40 seconds of uptime, a queued script evaluates the Home Assistant helper flag (input_boolean.disable_deep_sleep).
    • If True, the device remains awake, broadcasting a Deep Sleep Disabled log.
    • If False, the device enters deep_sleep for 3565 seconds.

Post-Processing & Filters

  • Battery Calibration: The battery_percentage sensor uses a polynomial calibration map:
    • 4.19V maps to 100.0%
    • 2.50V maps to 0.0%
    • A lambda filter acts as a digital clamp, preventing values from exceeding 100% or dropping below 0%.

Home Assistant Integration

For seamless operation, configure the following helper entity in your Home Assistant instance:

  • Entity Type: Toggle (Input Boolean)
  • Entity ID: input_boolean.disable_deep_sleep
  • Purpose: Allows to remotely suspend the deep sleep cycle for OTA firmware flashes or live debugging.

Installation & Setup

  1. Clone this repository to your local machine.
  2. Create a secrets.yaml file based on secrets.yaml.example containing your Wi-Fi credentials and API encryption keys.
  3. Compile and flash watch-winder.yaml onto your Wemos D1 Mini using the ESPHome dashboard or CLI tool.
  4. Discover and add the device in the Home Assistant Integrations panel.

License

This project is licensed under the GNU General Public License v3.0 (GPLv3).

About

An ultra-low-power, solar-charged ESP8266 weather station. Features native Home Assistant integration, dual I2C buses for hardware fault isolation, deep sleep management, and bidirectional INA219 power profiling with a DFRobot Solar Power Manager 5V.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors