ESP-01S is a cheap and easy to use wireless solution. By combining with other sensors and actuator, remote monitoring and control can be realized conveniently.
In this project, I am going to built a smart switch to control the Fan by the ESP-01S Relay module via Android app.
Step 1: Flashing Your ESP With NodeMCU
In this tutorial we are going to use the NodeMCU. You have to flash your ESP with NodeMCU firmare.
· RX -> TX
· TX -> RX
· CH_PD -> 3.3V
· VCC -> 3.3V
· GND -> GND
2.Downloading the NodeMCU Flasher for windows.
Win32 Windows Flasher
Win64 Windows Flasher
You can click here to find all the information about NodeMCU flasher.
3.Flashing your ESP8266 using Windows
Open the flasher that you just downloaded and a window should appear.
Press the button “Flash” and it should start the flashing process immediately (You might have to change some of the settings on the Advanced tab). After finishing this process, it should appear a green circle with a check icon.
Step 2: Uploading Code
Click here to download LuaLoader
2.Schematics (3.3V USB- UART Convertor)
The schematics for this project are very straight forward. You only need to establish a serial communication between your USB- UART Convertor and your ESP8266.
Select your USB-UART Conventor port
Click ''Connect'' ,
Upload the file: init.lua(the ESP-01 Relay v4.0.lua)
Step 3: Hardware Connection
After upload the code, Connect the power and Fan to the ESP-01 Relay board.
Step 4: Installed the ESP8266 Controller to Your Android Phone
1.Click here to download the .apk file
2.Unzip the folder
3.Move the .apk file to your Android phone
4.Run the .apk file to install the app
Step 5: Relay Control
Run the ESP8266 Controller, Click the button “Set IP Address” on the bottom of the screen and type your IP address (in my case 192.168.1.1).
Now you can turn the GPIO0 high and low with your smartphone.
GPIO0 ON : Open the fan
GPIO0 OFF: Close the fan