⚠️ DEVELOPMENT STATUS: This project is currently in development and has not been fully tested. Use at your own risk.
An ESP32-based IoT device that automatically controls a GPIO pin based on weather forecasts. The device fetches weather data from Open-Meteo API and activates a control pin when sunny weather is predicted for the next day.
- Weather Forecast Integration: Fetches weather data from Open-Meteo API
- Smart Scheduling: Checks weather at 4 PM daily and controls pin the next morning if sunny
- Real-Time Clock Support: Uses DS3231 RTC module for accurate timekeeping
- Low Power Design: Utilizes ESP32 deep sleep mode to conserve battery
- WiFi Connectivity: Connects to WiFi for weather data retrieval
- Configurable Location: Easy to configure for any geographic location
- ESP32 development board
- DS3231 Real-Time Clock module
- Connecting wires
- Optional: External components to control (relay, LED, etc.)
Default pins (configurable in hardware_config.h):
- GPIO 13: Control pin output
- GPIO 5, 6, 7, 15, 16: LED pins (cloud cover visualization)
- GPIO 1: I2C SDA (DS3231)
- GPIO 2: I2C SCL (DS3231)
- GPIO 48: RGB LED (optional status indicator)
Note: All pins can be customized by editing components/hardware_config/include/hardware_config.h
- ESP-IDF (Espressif IoT Development Framework)
- Compatible ESP32 development board
- USB cable for flashing and monitoring
This project uses a simple configuration system based on two header files.
Copy the example config file and edit it with your WiFi credentials:
# Create config.h from template
cp components/hardware_config/include/config.h.example components/hardware_config/include/config.h
# Edit config.h with your WiFi credentials and optional location
# (Use your preferred text editor)In components/hardware_config/include/config.h, configure:
WIFI_SSID- Your WiFi network nameWIFI_PASSWORD- Your WiFi passwordLATITUDE/LONGITUDE- (Optional) Override default locationREMOTE_LOG_SERVER_URL- (Optional) Remote logging server URL
Note: config.h is gitignored and will not be committed to the repository.
All hardware pins and behavior settings are configured in:
components/hardware_config/include/hardware_config.h
Available settings:
- GPIO pin assignments (control pin, LEDs, I2C)
- Cloud cover ranges and pin-off hours
- Weather check schedule (default: 4 PM)
- Default location (latitude/longitude)
- Remote logging settings
- RGB LED configuration
Edit this file directly and rebuild the project to apply changes.
-
Set up ESP-IDF environment:
# macOS/Linux . $HOME/esp/esp-idf/export.sh # Windows %userprofile%\esp\esp-idf\export.bat
-
Build the project:
idf.py set-target esp32 idf.py build
-
Flash and monitor:
idf.py flash monitor
- Daily Weather Check: At 4 PM each day, the ESP32 wakes up and connects to WiFi
- API Request: Fetches tomorrow's weather forecast from Open-Meteo API
- Decision Logic: Determines if tomorrow will be sunny based on weather data
- Deep Sleep: Goes back to sleep until the next check or control time
- Morning Control: If sunny weather was predicted, activates the control pin at 8 AM
- Repeat Cycle: Returns to deep sleep and repeats the process
This project uses the Open-Meteo API which provides:
- Free weather forecasts
- No API key required
- Global coverage
- Reliable service
The device is designed for low power consumption:
- Deep sleep mode between operations
- RTC module maintains time during sleep
- Weather data stored in RTC memory
- Typical power consumption: ~10µA in sleep mode
- Build Issues: Run
idf.py cleanand rebuild - WiFi Connection: Verify SSID and password in configuration
- Time Issues: Check DS3231 RTC module connections
- Weather Data: Ensure internet connectivity and valid coordinates
This project is open source. See the project files for more details.
Feel free to submit issues and enhancement requests!