
In this article we are showing how you can control your home appliances from anywhere in world using Internet. In our daily life we always forget to switch off Lights, TV, AC, Fan and other appliances and unnecessary we waste electricity and money of course, which is very precious for us.
So we have created a very simple video that you can follow and convert your normal home to Smart Home and you can control from anywhere in world.
Components Required :-
- 1 x Arduino uno board
- 1 x USB cable
- 1 x ESP8266 WiFi Module
- 1 x Relay Board
- 1 x Jumper wire (Male to Male)
- 9 x Jumper wire (Male to Female)
- 1 x Breadboard
- 1 x Yellow Bulb
- 1 x Red Bulb
Connection :-
Source Code :-
#include "SoftwareSerial.h" String ssid ="WIFI_NAME"; String password="WIFI_PASSWORD"; SoftwareSerial esp(3, 2);// RX, TX String server = "www.iotboys.com"; //Your Host String uri = "/YOUR_API"; // Your URI int RED_BULB=5; int YELLOW_BULB=6; void setup() { pinMode(RED_BULB, OUTPUT); pinMode(YELLOW_BULB, OUTPUT); digitalWrite(RED_BULB, HIGH); digitalWrite(YELLOW_BULB, HIGH); esp.begin(9600); Serial.begin(9600); connectWifi(); httpget(); delay(1000); } void connectWifi() { String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\""; esp.println(cmd); delay(4000); if(esp.find("OK")) { Serial.println("Connected!"); } else { Serial.println("Cannot connect to wifi ! Connecting again..."); } connectWifi(); } /////////////////////////////GET METHOD/////////////////////////////// void httpget() { esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection. if( esp.find("OK")) { Serial.println("TCP connection ready"); } delay(1000); String getRequest = "GET " + uri + " HTTP/1.0\r\n" + "Host: " + server + "\r\n" + "Accept: *" + "/" + "*\r\n" + "Content-Type: application/json\r\n" + "\r\n"; String sendCmd = "AT+CIPSEND="; esp.print(sendCmd); esp.println(getRequest.length() ); delay(500); if(esp.find(">")) { Serial.println("Sending.."); esp.print(getRequest); if( esp.find("SEND OK")) { Serial.println("Packet sent"); while (esp.available()) { String response = esp.readString(); int RED_BULB_ON = response.indexOf("RED_BULB>TRUE")>0?1:0; int YELLOW_BULB_ON = response.indexOf("YELLOW_BULB>TRUE")>0?1:0; if(RED_BULB_ON==1) { digitalWrite(RED_BULB, LOW); } else { digitalWrite(RED_BULB, HIGH); } if(YELLOW_BULB_ON==1) { digitalWrite(YELLOW_BULB, LOW); } else { digitalWrite(YELLOW_BULB, HIGH); } } esp.println("AT+CIPCLOSE"); } } } void loop() { httpget(); }
- 62 Comments
- Arduino
- Arduino Projects to Control Your Home
- Arduino Wifi Module
- Control Your Home from Android
- Control Your Home using internet
- ESP8266 Wifi Module
- Home automation in arduino
- Home Automation System
- Home Automation System From Internet and Arduino
- Home automation system using IoT
- How To Use ESP8266 Wifi
- IoTBoys
Alex
An impressive share! I’ve just forwarded this
onto a colleague who has been doing a little research on this.
And he in fact bought me lunch simply because I stumbled
upon it for him… lol. So allow me to reword this…. Thank YOU for the meal!!
But yeah, thanks for spending time to discuss this subject here on your website.
IoT Boys
Dear User,
Thanks for your appreciation and keep share our articles and videos, that will be reward for us.
Saddar Uddin Memon
Salam, bro my esp8266 can not connect to my system and no any AT command work what I do plz give your ideas. Thnkx
Saddar Uddin Memon
Salam, bro my esp8266 can not connect to my system and no any AT command work what I do plz give your ideas. Thnkx
IoT Boys
Hello Saddar,
You need to check that is your ESP-8266 has not burned or check your wiring connection.
Usually AT Command should work.
Also have a look at https://randomnerdtutorials.com/esp8266-troubleshooting-guide/ link.
Best Regards,
IoTBoys
zikrifuaad
how can i get into the cloud
IoT Boys
Hi Zikifuaad,
You can go with AWS or Azure if you have knowledge of API development, we have used Web API in this project.
Other than that you can use MQTT also.
H VABEIZAWZI BEIA
could u please provide this part.. i was so confused.. please help me out
Roma
I love it when folks cⲟme together and
ѕhare opіnions. Great website, keep it up!
IoT Boys
Thank you for your appreciation.
Best Regards,
IoTBoys
Rishabh
provide also the web page code to understand the request.
IoT Boys
Hello Rishabh,
Thanks for reaching us.
That page is only having HTML and Angular code where we are calling a web API that we have developed in ASP.NET Web API.
Let us know if you still need this.
Best Regards,
IoTBoys
Rishabh
yes i need that code kindly provide me as soon as possible
Rishabh
what amount of time needed to provide html code ?
IoT Boys
Hi Rishabh, Sorry for delay. Kindly check your mail.
Shah
Hey can you please send me html code ?
Vijay
Can you forward me the mail web page code sent iot boys for home automation using arduino and esp8266..
Vijay
My mail id is surya.chandra06486@gmail.com
Can i know your id
micheal
Hi
I want to tryit
if you can send me HTML code
and I have a question
what do you mean about:
String uri = “/YOUR_API”; // Your URI
I wait your reply
my mail
eng.mikelseha@gmail.com
Mohd Saif
Hey Rishabh,
Please forward that html code to saifnafees55@gmail.com
Fahad Ahmed
hey rishab please forward me that html code
dhaval
please send me too that html page
Andrey
Can you forward me the mail web page code sent iot boys for home automation using arduino and esp8266
Prabath
Hello, I am also trying to develop the web page for this project. Could you please send me the code for the web page too.
Narendra
please send mee too and one thing its good for iot students
and my mail id r141046@rguktrkv.ac.in
somnath panja
my have no String server = “www.iotboys.com”; //Your Host
String uri = “/YOUR_API”; // Your URI.. so please give me host server or html code or web page code
please give me step by step description of this project ,as soon as.
IoT Boys
Hi Somnath, Thanks for reaching us. Kindly check video carefully and if you have problem in any step kindly send us private message on facebook page.
http://www.facebook.com/iotboys
Thanks & Regard
IoTBoys
deepak yadav m
i have connected and programmed the arduino but how to use the switch button through your website,please reply fast
Shah
Can you please provide the server side html code ?
Alireza
Thanks for your tutorial.Could you please send me the html file? I dont know anything about html programming or API.
IoT Boys
Hi Alireza,
To accomplish this project better to have knowledge about Web API and HTML because this is just a demo project lot of other things you need to do apart from this video.
You must have a web server enabled IIS so that you can host our middleware code there and can make request. Once you are able to host the application let us know will provide the html source code.
Best Regards,
IoTBoys
Alireza
I got a free host with iis server from somee.com and learned how to upload files on the server.Could you please send me the html source code?
Danish
Hello ! CAN you tell me how to connect ESP8266 WiFi Module with internet, I have connected each and every thing according to your diagram and have uploaded the same code to my arduino uno that you have provided, please help me out in this. Please
IoT Boys
Hi Danish,
Thanks for reaching us, now you must have a web server enabled IIS so that you can host our middleware code there and can make request.
For quick response connect out official Facebook page https://facebook.com/iotboys
Best Regards,
IoTBoys
Sunbun
This design is spectacular! You obviously know how to keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent job. I really loved what you had to say, and more than that, how you presented it. Too cool!
IoT Boys
Hi Sunbun, Thanks for your appreciation.
keep visit and share our articles and video.
Aditya
Nice Project Really Impressive. Can I please get the server side code? It would be a great help.
Vijay
Please provide also the web page code to understand the request as soon as possible. Can I add one more device in that
Gracia Ortenzio
I really can’t believe how great this site is. Keep up the good work. I’m going to tell all my friends about this place.
IoT Boys
Hey Gracia, Thanks for your appreciation. keep visit and share our articles.
Shery Sick
That sure is one pretty site you have there. Can I ask you a very simple question? What kind of fertilizer do you use to make it grow so wonderfully?
shubham
my boards manager file for esp8266 is not downloading its showing me error downloading https://github.com/esp8266/arduino/releases/download/2.4.1/esp8266-2.4.1.zip
Muhammad Hassan
Its superb !!! but i need Web page API and Source Code my email sheikhhassandj@gmail.com Please send me Thank you
Muhammad Hassan
Its superb !!! but i need Web page Source Code my email sheikhhassandj@gmail.com Please send me Thank you
Aman Kumar
Could you please provide me with HTML webpage code?
Vishnu
in the video at last you have directly gone to the site of controlling. can you please explain how to open the site and its address
Rachana Bobade
which app u have used for controlling the system
plzz could u mail the datails or help em with that
Md.Mehedi hasan
Hi…
Great works.. I need web api code..
narendra
your api means is it read api key or write api key
Kelly Chevalier
Hey there! I’ve been reading your website for some time
now and finally got the bravery to go ahead and give you a
shout out from Lubbock Tx! Just wanted to say keep up the good job!
Prakash Sanyasi
Great Job IoTBoys!!
I am very thankful for your tutorial. We are doing similar project for a module in college. But i am stuck in between not knowing how to write API in back-end as I am beginner. We will be thankful if you could share your API or make tutorial for write API for similar project.
THANK YOU
رمزيات حب
Hello, yes this article is in fact good and I have learned lot of things from it on the topic of blogging.
thanks.
michelle
Hello, I found this helpful. We are going to create smart home lighting controlled by Android Smartphone using WiFi. Is this project okay to do with android application? because I’ve watched the video you controlled the lights using laptop.. do you have any tutorial, for controlling by using android smartphone or android app?
Michelle
Can you please kindly reply on my message soon as you read it 🙂 We’re planning to buy arduino device soon, because we only have 1 and half week for our sembreak.. I just needed the list of hardware components for now we’re writing documentation for our capstone. Thank You IoT Boys ^_^ btw, I already have use HTML, JAVA, PHP language.. what was the language will be used in this project ? because I am new to this kind of project.
randhir
plz send html code for wifi automation also discibe when number of relay is more than that.
Uzair Ahmad
sir plzzz provide me the WEB code…..uzair.ahmad6645@gmail.com
supravo jana
sir can you provide me the html code for calling the api
phani krishna
hello sir ,
i need the html and api code for the following project in arduino beacause we need to develop the apk frontend and some more brief about the project. thanks in advance
Abbas
Do i have to configure my ESP8266 also or i just have to put the code in arduino??
secondly how can i conncet to a link like you have show in your video a website from where you switch on and off the bulbs
Ankit mandal
Hey can you give me html code for home automation pls
rop
interesting. Please also explain how to setup the website with the switches.
thx.
Syed Furqan
Please send me the html code on this email
syedfurru@gmail.com