In this tutorial we will show how to build WiFi fan controller. Fan controller is connected to internet and EasyIoT Cloud over WiFi. For this purpose we will use ESP8266. Controller can monitor temperature and in case of temperature increase power on the fan.

 

Main ESP8266 fan controller features:

  • WiFi connected
  • 12V fan output
  • temperature monitor
  • set fan switch on temperature
  • WEB and mobile application
  • Connected to EasyIoT Cloud
  • ESP8266 WEB configuration page

 

 

 

 

 

Materials

 

-ESP8266 WiFi module

ESP8266 Lua Nodemcu WIFI Network Development BoardESP8266 Lua Nodemcu WIFI Network Development Board
$7.43
$2.65

  

-DS18B20 Dallas temperature sensor

DS18B20 DALLAS Temperature SensorDS18B20 DALLAS Temperature Sensor
$0.99
$0.79

 

-12V 3Pin DC Brushless PC Computer Case Cooling Fan

12V 3Pin DC Brushless PC Computer Case Cooling Fan12V 3Pin DC Brushless PC Computer Case Cooling Fan
$1.3
$2.42

 

-N-Channel MOSFET (IRLZ44N)

N-Channel MOSFET (IRLZ44N)N-Channel MOSFET (IRLZ44N)
$0.99
$0.18

 

-Resistors 220M, 4.4K, 1K 

400X 0.25w 1/4w Metal Film Resistor Pack Kit 1% 20 Value Each 20 Pcs 10 ~ 1M ohm400X 0.25w 1/4w Metal Film Resistor Pack Kit 1% 20 Value Each 20 Pcs 10 ~ 1M ohm
$1.88
$5.50

 

-Prototype PCB

10Pcs 5 x 7 cm DIY Prototype Paper PCB10Pcs 5 x 7 cm DIY Prototype Paper PCB
$1.46
$1.27

 

-AMS1117-3.3V regulator

10Pcs AMS1117-3.3 LM1117 3.3V 1A SOT-223 Voltage Regulator10Pcs AMS1117-3.3 LM1117 3.3V 1A SOT-223 Voltage Regulator
$0.99
$1.22

 

-220uF capacitor

210Pcs 25 Value 0.1uF-220uF Electrolytic Capacitors Assortment Kit Set210Pcs 25 Value 0.1uF-220uF Electrolytic Capacitors Assortment Kit Set
$3.36
$6.52

 

-12V 1A/2A Transformer Travel Power Supply Adapter US EU UK Plug

12V 1A/2A Transformer Travel Power Supply Adapter US EU UK Plug12V 1A/2A Transformer Travel Power Supply Adapter US EU UK Plug
$1.38
$3.23

 

See buying guide at the end for details and please shop in our store to support EasyIoT framework.

 

Build

For simplicity reasons we will use ESP8266 NODE MCU, but you can use any other type of ESP8266.

Connections

Power supply

ESP8266 uses 3.3V power supply, computer fan 12V. In our case we will use 12V power supply and add additional 3.3V AMS1117 regulator to step down voltage to 3.3 V.  See power supply in our store.

 

 

We connect GND and 3.3V output of regulator to ESP8266 GND and 3.3V pin.

DS18B20 Dallas temperature sensor

DS18B20 is powered by 3.3V, digital output is connected to ESP8266 D2 pin. We also use 4.7K pull up resistor.

 

Computer fan

Computer fan is powered by 12V AC. There are 3 and 4 pin connection versions. In our case we will use only 2 pins GND and 12V VCC. Fan is controlled by MOSFET IRLZ44N connected to ESP8266 D1 pin.

 

IRLZ44N pinout

 

 

Computer fan pinout

 

 

Source Code

Additional libraries are here: lib.

ESP8266 source program 

ESP8266 source code can be found at GitHub. Upload program with ESP8266 Arduino IDE.

 

Before you upload program to ESP8266 it's recommended to change those lines:

 

#define AP_SSID "xxx"
#define AP_PASSWORD "xxx"
#define EIOTCLOUD_USERNAME "xxx"
#define EIOTCLOUD_PASSWORD "xxx" 

 

If you forget to change those settings you can press FLASH button non ESP8266 NODE MCU module. ESP8266 will go in config mode. This means it works as access point with configuration server. After you press FLASH button use mobile phone and search or AP (access points) available nearby. Connect to access point with name Device xx-xx-xx-xx-xx. xx-xx-xx-xx-xx are some random letters. After you connect to AP open web browser and enter IP address 192.168.1.4. If you done everything correct browser opens config page:

ESP8266 config page
ESP8266 config page

 

After you enter correct data press submit button and ESP8266 will restart with new settings.

 

Configure EasyIoT Cloud

No manual configuration is needed. Program will automatically add new module to EasyIoT Cloud. First you need to register to EasyIoT Cloud.

See more tutorials at ​http://iot-playground.com/build​

 

Buying guide

 

To support this site and EasyIoT framework development please buy in our store.

 

ESP8266 Lua Nodemcu WIFI Network Development Board

ESP8266 Lua Nodemcu WIFI Network Development Board

DS18B20 DALLAS Temperature Sensor

The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements.

12V 3Pin DC Brushless PC Computer Case Cooling Fan

12V 3Pin DC Brushless PC Computer Case Cooling Fan

N-Channel MOSFET (IRLZ44N)

55V Single N-Channel HEXFET Power MOSFET in a TO-220AB package

400X 0.25w 1/4w Metal Film Resistor Pack Kit 1% 20 Value Each 20 Pcs 10 ~ 1M ohm

10Pcs 5 x 7 cm DIY Prototype Paper PCB

10Pcs AMS1117-3.3 LM1117 3.3V 1A SOT-223 Voltage Regulator

3.3V voltage regulator,

210Pcs 25 Value 0.1uF-220uF Electrolytic Capacitors Assortment Kit Set

12V 1A/2A Transformer Travel Power Supply Adapter US EU UK Plug

12V 1A/2A Transformer Travel Power Supply


Comments   

#1 Massimiliano 2021-02-22 09:51
Hi,
is possible to adjust fan start-stop on more than one sensor? I mean, i have 2 sensors: one close the ceiling and one close the floor. when difference is more than X, fan is ON until difference is less than X (+1minute or similar). Any hints on to doing that? Actually i'm uploading T&RH with ESP8266MOD (ESP-12E) + SHTC3 and ideally i'll use a sonoff to power on/off but i'm not sure how manage more than one source. Thanks in advance.

You have no rights to post comments

Forum latest

  • No posts to display.