Introduction: Control a Fan Via Wifi. Easy for Life
Today only with a phone, and a device connected to the internet. You can easily control any devices anywhere in the world. Today I will control a fan with a smartphone connected to the internet.
Step 1: All of Things You Need.
I use a MCU8266 control via wifi
A switch 5v
Power 5v
Case
Step 2: Diagram
Here is the diagram. How to connect all of these parts each other.
Step 3: Use Thin Solder to Solder All of Parts Each Other
Step 4: After Finish Put All of Parts to the Case
I use a drill to make two make two holds at the top and the bottom of the case.
Step 5: Use Some Tapes to Fix the Parts.
Step 6: Upload Code for MCU8266
Goto blynk.cc download library for MCU8266. I use blynk app to control MCU8266. Have alot of ways to control MCU8266. But I chose blynk app because It's so easy to setup for beginer.
After you download library. You should register an account. After that, you can receive an email to get auth key. Then you paste to the code below.
Three values you need to change. auth, ssid, pass
==============================================
#define BLYNK_PRINT Serial
#include #include
char auth[] = ""; //AuthToken
char ssid[] = ""; //Wifi ssid
char pass[] = ""; //Password Wifi
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
}
===============================================
Step 7: INSTALL BLYNK LIBRARY
Blynk library should be installed manually. Follow the instructions:
1. Download the latest release .zip file.Unzip it.
2. You will notice that archive contains several folders and several libraries.
3. Copy all these libraries to your_sketchbook_folder of Arduino IDE.
To find the location of your_sketchbook_folder, go to top menu in Arduino IDE: File -> Preferences (if you are using Mac OS - go to Arduino → Preferences)
The structure of your your_sketchbook_folder should now look like this, along with your other sketches (if you have them):
your_sketchbook_folder/libraries/Blynk
your_sketchbook_folder/libraries/BlynkESP8266_Lib ...
your_sketchbook_folder/tools/BlynkUpdater
your_sketchbook_folder/tools/BlynkUsbScript ...
☝️ Note that libraries should go to libraries and tools to tools. If you don't have tools folder you can create it by yourself.