This project is inspired by ESP 32 fan controller with MQTT support by KlausMu. I have no need to use MQTT or a TFT Display so i went with a web interface. Here we are using the ESP32 to setup a simple web page to controll 4 pin cooling fans by the room temperature
- Setting minimum and maximum fan speed and temperature
- Fan is reacting to the change of temperature
- Disabling / enabling via webpage
- Showing current temperature on the web page
- Simple API readout -> easy to integrate in Home Assistant
- Secured with a random 32 char API-Key to prevent manipulation
- Mobile device friendly interface
- Get all your components from the parts list
- Setup the wiring accoring to the wiring diagram
- Follow the steps for PlatformIO (VS-Code) or Adruino IDE
- Check the terminal or your router to get the ESP32 IP-Address
- Open a browser, navigate to the IP-Address and setup your API-Key
| Function | Parts | Remarks | approx. price |
|---|---|---|---|
| microcontroller | ESP32 | e.g. from AZ-Delivery | 8 EUR |
| fans | 4 pin fan (4 pin means pwm controlled), 12V | tested with standard CPU fans like ARCTIC P8 and P10 e.g from Amazon |
27 EUR for 5pcs |
| power supply | 12V for fan (depending on fan) and step down module |
e.g. with 5.5×2.5 mm coaxial power connector | 12 EUR |
| voltage regulator | LM2596S DC-DC step down | e.g. from AR-Delivery | 5 EUR |
| temperature sensor | - BMP180 - 2 pullup resistors 3.3 kΩ (for I2C) |
e.g. from AZ-Delivery | 5 EUR |
| Function | Parts | Remarks | approx. price |
|---|---|---|---|
| measuring tacho signal of fan | - pullup resistor 10 kΩ - RC circuit: resistor 3.3 kΩ; ceramic capacitor 100 pF |
< 1 EUR | |
| duepon connectors | 1x1 and 2x1 female | e.g. Set from Amazon | 10 EUR for 620pcs |
There is a quide for installing PlatformIO
- Open the project folder in VSCode and locate main.cpp
- Change the WiFi name and password to your data (maybe hostname too)
- Select your board type and COM port
- Flash to your board
- In the serial terminal there will be the address of your ESPs web side
ToDo
Simply open a browser window and navigate to the IP-address thats given in the serial terminal. The first time you will get your API-Key displayed here too.
You can also use programs like curl so interact with the webserver.
E.g. curl http://YOUR_IP/YOUR_API_KEY/json to read out current temperature and fan speed.
The response sould look something like this: {"temperature": "28.40","speed": 120}
- Add flashing with Arduino IDE instructions
- Supprot for BME280 over SPI
- Receive JSON commands via simple API



