An ESP32-based smart attic fan controller that automatically manages fan operation based on temperature thresholds.
This project is a fork of AtticFan with modifications for attic fan control.
- Temperature-based automatic fan control
- Web interface for monitoring and control
- Real-time temperature, humidity, and pressure monitoring
- 30-second update intervals to prevent rapid cycling
- Automatic and manual operation modes
- OTA (Over-The-Air) updates supported
- ESP32-S2-SAOLA-1 Development Board - ESP32-S2 board with built-in USB programming
- BME280 Temperature/Humidity/Pressure Sensor - I2C interface sensor module
- 5V Relay Module - Single channel relay with optocoupler isolation
- 2A Circuit Breaker - Manual reset thermal circuit breaker for overload protection
- Standard USB 5V wall adapter - Any USB power supply that can provide at least 1A
- I2C Interface:
- SDA: GPIO9
- SCL: GPIO7
- Relay Control:
- Signal: GPIO5 (inverted logic)
- VCC: 5V
- GND: GND
ESP32-S2-SAOLA-1 Pinout:
┌─────────────────────────────────────────────┐
│ │
│ USB-C Port │
│ ┌─────────────────────────────────────┐ │
│ │ │ │
│ │ │ │
│ └─────────────────────────────────────┘ │
│ │
│ GPIO Pins: │
│ ┌─────┬─────┬─────┬─────┬─────┬─────┐ │
│ │ 5V │ GND │ 3V3 │ EN │ 7 │ 8 │ │
│ ├─────┼─────┼─────┼─────┼─────┼─────┤ │
│ │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ │
│ ├─────┼─────┼─────┼─────┼─────┼─────┤ │
│ │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ │
│ └─────┴─────┴─────┴─────┴─────┴─────┘ │
│ │
└─────────────────────────────────────────────┘
Power Supply (5V USB) ───────┐
│
▼
┌─────────────────────────────────────────────┐
│ ESP32-S2-SAOLA-1 │
│ │
│ 5V ────────────────────────────────────────┐│
│ GND ───────────────────────────────────────┐│
│ GPIO5 ─────────────────────────────────────┐│
│ GPIO7 (SCL) ──────────────────────────────┐│
│ GPIO9 (SDA) ──────────────────────────────┐│
└─────────────────────────────────────────────┘
│ │ │ │ │
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
┌─────────────────────────────────────────────┐
│ BME280 Sensor │
│ │
│ VCC ────────────────────────────────────────┘
│ GND ────────────────────────────────────────┘
│ SCL ────────────────────────────────────────┘
│ SDA ────────────────────────────────────────┘
└─────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ 5V Relay Module │
│ │
│ VCC ────────────────────────────────────────┘
│ GND ────────────────────────────────────────┘
│ IN ────────────────────────────────────────┘
│ │
│ NO ────────────────────────────────────────┐
│ COM ───────────────────────────────────────┐
└─────────────────────────────────────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────┐
│ Attic Fan │
│ │
│ Hot ────────────────────────────────────────┘
│ Neutral ────────────────────────────────────┘
└─────────────────────────────────────────────┘
- Input: 100-240V AC
- Output: 5V DC, 2.5A
- Power consumption: < 500mA typical
# Key configuration settings:
esphome:
name: attic-fan
friendly_name: attic-fan
# Temperature threshold settings
number:
- platform: template
name: "Temperature Threshold"
min_value: 75
max_value: 120
step: 1
unit_of_measurement: "°F"
initial_value: 100
# Sensor update interval
sensor:
- platform: bme280_i2c
update_interval: 30s- Install ESPHome
- Copy the configuration file
- Create a
secrets.yamlfile with your sensitive credentials:# WiFi credentials wifi_ssid: "your_wifi_ssid" wifi_password: "your_wifi_password" # Web interface credentials web_username: "your_web_username" web_password: "your_web_password" # API and OTA credentials api_encryption_key: "your_api_encryption_key" ota_password: "your_ota_password" # Access Point credentials ap_password: "your_ap_password"
IMPORTANT: Never commit your
secrets.yamlfile to version control. Keep it secure and local to your installation. - Flash to ESP32:
- For ESP32-S2-SAOLA-1: Use the Adafruit WebSerial ESPTool (https://adafruit.github.io/Adafruit_WebSerial_ESPTool/) as the web-based flashing method may not work
- Steps for manual flashing:
- Connect the ESP32 to your computer via USB
- Open the Adafruit WebSerial ESPTool in your browser
- Select the correct port
- Upload the generated .bin file
- Wait for the flashing process to complete
- Access web interface at attic-fan.local
- Current temperature display in °F
- Current humidity and pressure readings
- Temperature threshold adjustment
- Automatic/Manual mode toggle
- Real-time fan status
Based on ESPHome 2025.3.3. Feel free to submit issues or pull requests.
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material
Under the following terms:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made
- NonCommercial — You may not use the material for commercial purposes
For more information about the license, visit: https://creativecommons.org/licenses/by-nc/4.0/
