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.
- 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.
- 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)
| 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.
To achieve long-term autonomy on battery power, the firmware relies on a tightly controlled execution loop:
- 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.
- Telemetry Acquisition: Sensors (INA219, BMP280, AHT10) broadcast data to Home Assistant at 10-second intervals.
- 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 aDeep Sleep Disabledlog. - If
False, the device entersdeep_sleepfor 3565 seconds.
- If
- Battery Calibration: The
battery_percentagesensor uses a polynomial calibration map:4.19Vmaps to100.0%2.50Vmaps to0.0%- A lambda filter acts as a digital clamp, preventing values from exceeding 100% or dropping below 0%.
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.
- Clone this repository to your local machine.
- Create a
secrets.yamlfile based onsecrets.yaml.examplecontaining your Wi-Fi credentials and API encryption keys. - Compile and flash
watch-winder.yamlonto your Wemos D1 Mini using the ESPHome dashboard or CLI tool. - Discover and add the device in the Home Assistant Integrations panel.
This project is licensed under the GNU General Public License v3.0 (GPLv3).