This Project is to Create Home Automation Prototype using the ESP8266 WiFi transceiver. As ESP8266-01 has only two GPIOs, here we are using that Two pins to control Two LED which can be connected to the relay to control home Appliances.
You can go through “Getting started with ESP8266” if you are new to this. Before continuing with this project you have to flash ESPs with NodeMCU firmware and go through Getting Started with the ESPlorer IDE.
Circuit Connection:
Here we are using USB to TTL converter for connecting the Module with the PC. The 3.3V output of the converter is used to power the module.
The connection details are as below:
ESP8266 |
USB-TTL
|
Vcc |
3.3v |
Gnd |
Gnd |
TX |
RX |
RX |
TX |
CH_PD |
Connected to 3.3v to enable chip firmware boot |
Fig. 1: Table showing pin connections between USB to TTL Converter and ESP8266 Module for making Home Automation System
Don’t forget to pull up CH_PD HIGH, you won’t get a response from the module if it is not done.
You can also use Arduino for the connection. For more details refer here.
The connection details are as below:
ESP8266 |
Arduino UNO
|
Vcc |
3.3v |
Gnd |
Gnd |
TX |
TX |
RX |
RX |
CH_PD |
Connected to 3.3v to enable chip firmware boot |
Fig. 2: Table showing pin connections for connecting ESP8266 Module with the PC through Arduino UNO for making Home Automation System
Connect Two LEDs two GPIO 1 and GPIO2.
Downloading ESPlorer:
It’s recommended to use the ESPlorer program to open and save Lua files into your ESP8266.
Follow these instructions:
-
Download ESPlorer.
-
Unzip that folder.
-
Run ESPlorer.jar. It’s a JAVA program, make sure that JAVA is installed on your computer.
-
Open the ESPlorer.
Uploading Your Lua Script:
Follow these steps to send code to your ESP8266:
-
Connect your FTDI programmer and select your FTDI COM Port.
-
Set baud rate at 9600
-
Select NodeMCU+MicroPtyhon tab
-
Copy the your Lua script into ESPlorer and save your file with the name “init.lua”.
-
Upload to the ESP and Run on ESP.
Don’t forgot to change the SSID and Password to your Home WiFi Network.
Working:
In this project when the Client request is established from any device, Esp8266 will respond to it in real time with HTML lines which will be displayed as a web page.
Fig. 3: Screenshot of the webpage controlling ESP8266 based Internet controlled Home Automation System
Click the approximate button to turn on the Corresponding LEDs.
For Connecting the GPIO’s of the ESP8266 to the Home Appliances you can refer Home Automation using Android Project.
Fig. 4: Prototype of ESP8266 based Internet Controlled Home Automation System
Project Source Code
###
wifi.setmode(wifi.STATION)wifi.sta.config("Your SSID","Your Password")print(wifi.sta.getip())led1 = 3led2 = 4gpio.mode(led1, gpio.OUTPUT)gpio.mode(led2, gpio.OUTPUT)srv=net.createServer(net.TCP)srv:listen(80,function(conn)conn:on("receive", function(client,request)local buf = "";local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");if(method == nil)then_, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");endlocal _GET = {}if (vars ~= nil)thenfor k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do_GET[k] = vendendbuf = buf.."Home Automation Using ESP8266
";local _on,_off = "",""if(_GET.pin == "ON1")thengpio.write(led1, gpio.HIGH);elseif(_GET.pin == "OFF1")thengpio.write(led1, gpio.LOW);elseif(_GET.pin == "ON2")thengpio.write(led2, gpio.HIGH);elseif(_GET.pin == "OFF2")thengpio.write(led2, gpio.LOW);endclient:send(buf);client:close();collectgarbage();end)end)###
Project Video
Filed Under: Featured Contributions
Filed Under: Featured Contributions
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.