Control Electric Fan with Nodemcu thru Wifi Internet Browser

Nowadays, more and more devices are being connected to internet. It allows us to smart control. On this project I will show how you can control your electric fan using an internet browser on you phone or PC. This is very simple project you can build.

This is how you will connect the relay board to the electric fan. You basically connect it to the level switch to the relay board. The color coding may not be standard and might be different on your electric fan. There are usually a wiring diagram beneath the electric fan itself. you might want to check it first.

About the Circuit

The circuit uses a very popular and cheap nodemcu. This board is based on ESP8266 wifi module which is very powerful. It is a low cost open source IOT platform.

NODEMCU

nodemcu board
This is the nodemcu board which is hugely popular for IOT projects
This is the 4 channel relay board module you can buy at a cheap price. It is mostly used on arduino projects. You need to short the JD-VCC pin header.
This is how you will connect the relay board to the electric fan. You basically connect it to the level switch to the relay board. The color coding may not be standard and might be different on your electric fan. There are usually a wiring diagram beneath the electric fan itself. you might want to check it first.
Here is the version that I made because I have no relay board module. The transistor can be any general purpose NPN transistor. Check that the relay I am using is 12V so I power it with 12V. If you will be using a 5V relay, you will just need to power your circuit with 5V. No other changes needed to make it work.

First things first…

Download first the arduino IDE on arduino.cc website if you do not have it yet installed. If this is your first time working with nodemcu, then you need to do this setup first on your arduino IDE to make it work with nodemcu:

Under the preferences, put this url on the “additional boards manager URLs” box.
http:arduino.esp8266.com/stable/package_esp8266com_index.json
install the esp8266 library on boards manager

After doing those setups, download the arduino source code on my download page to start. Change the wifi name and password on the code with your own wifi name and password:

Open then serial monitor of Arduino and set the baud rate to 115200.

After uploading the source code, you should see this on the serial monitor. Copy the ip address displayed and enter it into the internet browser of your phone or PC. Take note that they should be connected in same wifi router.

Reference:

This project is based on:
https://www.electronics-lab.com/project/nodemcu-esp8266-webserver-tutorial/