
Fan Controller
PROFan Controller
License
:CC BY-SA 3.0
Description
Overview
This project implements a universal fan control system based on an ESP8266-12F module. It supports both 4-wire PWM fans and 2/3-wire voltage-controlled fans. The system is designed for automatic fan type detection and dynamically adapts the control method accordingly. RPM feedback is monitored via the fan tachometer signal, and the system includes mechanisms to ensure correct operation even in case of ESP failure (fail-safe design).
Features
-
Automatic Fan Type Detection at startup:
-
PWM-capable fans are driven via dedicated 25 kHz PWM signal.
-
Voltage-controlled fans are driven via a high-side P-MOSFET.
-
-
Real-time RPM Monitoring using the fan tachometer output.
-
Fail-Safe Design:
-
Fans continue running at 100% in the event of ESP8266 failure.
-
High-side switching with pull-down protection on the MOSFET gate.
-
-
Web Server and API Integration for remote monitoring and control (Home Assistant compatible via ESPHome API).
-
Manual Speed Control via UI slider.
-
Lüftermodus ("Fan Mode") status as a text sensor.
-
OTA Updates and local fallback AP mode.
Hardware
-
ESP8266-12F Microcontroller.
-
IRF9540N P-Channel MOSFET for high-side voltage control).
Software (ESPHome)
-
PWM Output: 25 kHz frequency via
esp8266_pwm
platform. -
Voltage Output: MOSFET controlled via PWM simulation.
-
Pulse Counter Sensors for fan RPM with a 3-second update interval.
-
Global Variables:
-
use_pwm_mode
: Boolean switch for current control mode. -
fan_speed_level
: 0.0–1.0 float for desired fan speed.
-
-
Startup Script:
-
Set MOSFET to full ON (12 V) and PWM to 100%.
-
Check RPM feedback after 2 seconds.
- Set MOSFET to full ON (12 V) and PWM to 50%.
-
Check RPM feedback after 2 seconds.
- If RPM is now lower→ enable PWM mode.
-
Otherwise → switch to Voltage mode (MOSFET control).
-
-
Template Number Component for manual fan speed adjustment (0–100%).
-
Template Text Sensor for current control mode display.
-
Web Server for local access and manual control.
Special Considerations
-
High-Side Switching is critical to maintaining a valid tachometer signal.
-
Pull-down Resistor on the Gate ensures the MOSFET is ON if the ESP is unpowered or in reset.
Design Drawing

BOM


Project Members

Comment