Introduction: ESP 8266 Wifi Controlled Home Automation

Picture of ESP 8266 Wifi Controlled Home Automation

ESP8266 is a great thing for starting to Wifi And IOT

It is also cheap and be used for making cool projects connected to the Internet .Learn how to make a simple IOT Project with it .The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor. Each ESP8266 module comes pre-programmed with an AT command set firmware, meaning, you can simply hook this up to your Arduino device and get about as much WiFi-ability as a WiFi Shield offers (and that’s just out of the box)! The ESP8266 module is an extremely cost effective board with a huge, and ever growing, community.

Update : I made a iot home control box to control home appliances

Step 1: Components and Connection

Picture of Components and Connection

Thing we will need

ESP8266 Pinouts

Vcc -power supply 3.3 v

Gnd - Ground

RST- reset

CH-PD-Chip power Down- Connected to 3.3V


Tx - Transmit

GPIO 0- Normal mode for HIGH Programming Mode for LOW

GPIO 2 General purpose 2

Step 2: Making the Esp 8266 Bread Board Friendly

Picture of Making the Esp 8266 Bread Board Friendly

Esp 8266 esp 1 is badly famous for being rude to the Bread board .

Here is a small hack to make it convert into a DIP pack.

You only want a 4x 4holes perf section with 4 rows of copper track of length four holes.

see the photos and you'd understand what I mean by that.

Cut two Strips of 4 Male Header pins each.

Cut two Strips of 4 Female Header pins each.

Push the 4-Pin Female header pins

Solder the Female Header (4-Pins each)

Push the 4 pin male all the way down until they are invisible in one side of the plastic frame.

Solder the male Header (4-Pins each) and join female together with it


Vcc and ch_pd to vcc

Gnd to gnd

Rst to button 1

GPIO0 to button 2

Note While uploading Program press reset once while holding GPIO Button as long as the program uploads

Step 3: Setting Up the Arduino Environment

Picture of Setting Up the Arduino Environment

You need to download the core if your Arduino is below 1.6

Installing with Boards Manager for Arduino

Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).

  • Install Arduino 1.6.8 from the Arduino website.Start Arduino and open Preferences window.
  • Enter into Additional Board Manager URLs field.
  • You can add multiple URLs, separating them with commas.
  • Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).

Boards manager link:

Step 4: Trying the Blink Sketch

Picture of Trying the Blink Sketch


The led is connected to the GPIO 2

Tx is connected to Rx

Rx is connected to Tx

Vcc to 3.3v

gnd to gnd

Ch_pd to 3.3v

GPIO 0 to gnd while programing

int ledPin=2;

void setup() {
pinMode(ledPin, OUTPUT);

void loop() {
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

Step 5: Making a Web Controlled Home Automation

Picture of Making a Web Controlled Home Automation


The led is connected to the GPIO 2

Tx is connected to Rx
Rx is connected to Tx

Vcc to 3.3v gnd to gnd

Ch_pd to 3.3v

GPIO 0 to gnd while programing

<p>#include <ESP8266WiFi.h><br></p><p>const char* ssid = "dlink";
const char* password = "ilovechips";</p><p>int ledPin = 2; // GPIO2
WiFiServer server(80);</p><p>void setup() {
delay(10);</p><p>pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);</p><p>// Connect to WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);</p><p>WiFi.begin(ssid, password);</p><p>while (WiFi.status() != WL_CONNECTED) {
Serial.println("WiFi connected");</p><p>// Start the server
Serial.println("Server started");</p><p>// Print the IP address
Serial.print("Use this URL to connect: ");
Serial.println("/");</p><p>}</p><p>void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
}</p><p>// Wait until the client sends some data
Serial.println("new client");
}</p><p>// Read the first line of the request
String request = client.readStringUntil('\r');
client.flush();</p><p>// Match the request</p><p>int value = LOW;
if (request.indexOf("/LED=ON") != -1) {
digitalWrite(ledPin, HIGH);
value = HIGH;
if (request.indexOf("/LED=OFF") != -1) {
digitalWrite(ledPin, LOW);
value = LOW;
}</p><p>// Set ledPin according to the request
//digitalWrite(ledPin, value);</p><p>// Return the response
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println(""); // do not forget this one
");</p><p>client.print("Led pin is now: ");</p><p>if(value == HIGH) {
} else {
client.println("Click <a>here</a> turn the LED on pin 2 ON<br>");
client.println("Click <a>here</a> turn the LED on pin 2 OFF<br>");
Serial.println("Client disonnected");


TheDarkTitan (author)2017-10-18


the code supplied is not compiling.what can be done regarding this?


zoha imran (author)2017-03-07

Aoa sir my project is remote control of home appliance with arduino through webpage for interfacing arduino with webpage i am using esp8266 esp project i am using master slave technique ...which means webpage will interface with master arduino through esp8266 then that master arduino will send signal to slave arduino through rf module ..and this slave will now light up the main issue is i have made webpage communication between master slave has been done ...but interfacing of arduino with webpage is making problem code is correct connections are correct but the code is not burning in wifi module it is giving error "
Error : failed to open com6
Error: espcom_open failed
Error: espcom_upload_mem failed "
Do you have some idea about it ?
Moreover sir i wana ask we have to remove arduino chip when we are buring code in esp8266 ?
Or we have to write the code in the same arduino file which we have developed while communication between master and slave ?

Techminer (author)zoha imran2017-04-10

When you connect your esp to computer, go to Tools>Ports and change port from COM1 to available ports like COM4 or COM7

ShubhamS261 (author)2017-03-29

How did you program esp01??.. Please explain.. thank you!!

MurraliK (author)2017-02-17


im occuring a problem with my arduino board... while im connecting my arduino uno board to my laptop the port is availablein IDE.. but whenever i connect esp8266 to my arduino uno.. the port is getting unavailable.. by clicking the serial monitor im getting '' Board at COM4 is not available ''.

so how can i clear this problem.. plss help me...

kartik_2593 (author)2016-12-03


can we use this set up for a permamanet fixture in the house? or do we need to add some components to make it suitable for home in the long run??

WilliamB211 made it! (author)kartik_25932017-01-15

sure you can!

WilliamB211 (author)2017-01-15

flidget (author)2016-05-07

Thanks for this, but it's a breadboard implementation. Are you able to take it into the real world? I guess you need to squeeze it into a housing with a battery of some type? After that step it's a killer project.

WilliamB211 (author)flidget2017-01-15

geekrex (author)flidget2016-05-07

I kept it for appetizer :P
Comming soon

mubashir hanif (author)2016-05-27

warning: espcomm_sync failed

error: espcomm_open failed
error: espcomm_upload_mem failed

I am continuously receiving this error. Please help me finding the solution. Connection and everything seems fine but whenever i upload the code, it gives error.

I am using esp-01 with arduino mega2560. i've also tried PL2303 but got the same error. Waiting for your reply. Thank you

abhinnkp (author)mubashir hanif2016-12-07

You need to make EN pin high by shorting it to 3V3 pin and short the IO0 to GND. After that you need to upload the NodeMCU firmware on the module. You can find the same on GITHUB :

After this process this error on your arduino IDE will be solved.

UjjwalA7 (author)mubashir hanif2016-11-26

I am also getting same error .Did you get how to solve it.

AydinY1 (author)mubashir hanif2016-07-03

Hi Mubashir,

I just resolved the same problem just yesterday night.

You need to pull down the REST pin of your ESP while you see 'Uploading' on Arduino IDE, then quickly you must pull up the REST pin and leave it as it is. Using a 10K resistor is the good way to do so.

I highly recommend the schematics in here:

Since my FTDI didn't have RTS pin, I had to do Reseting (REST) of ESP manually...

raghavenderlomte (author)2016-08-30

my arduino is unable to compile the above code,if i erase all those '<p>' then only it is able to compile, but if i do so i am not getting the button in the web page

ArturP15 (author)2016-07-18

ESP8266 is amazing! Especially the new ESP8266-12e, which packs I/O thus rendering arduino not necessary.

I made a Smarthome setup from these chips: - see demo video here. It packs IFTTT , Siri integration, lights control, power switches and much more. Everything open source

kumaran512 (author)2016-06-11

Have u tried the relay module on inductive load? Any obsurd resets by esp-01?

colin.riddel (author)2016-05-05

Can you please post a proper circuit drawing as the above drawing does not make sense. there appears to be connections missing


MagnusR2 (author)colin.riddel2016-05-14

Yes, a circuit would be good. Looking at:

I suspect that the voltage regulator should be connected with pin1 to ground, with pin 2 to the ESP8266 and pin 3 to the FTDI (VCC)?

Palms (author)colin.riddel2016-05-13

I agree. The circuit diagram appears a bit faulty, and photos don't help to understand the connections, a circuit scheme is really appreciated/needed!

ed.darby (author)2016-05-07

Great introduction to this wonderful chip :)

I've designed a small PCB to utilise the esp8266 for a variety of applications, I have one connected to a DHT22 temperature sensor and one connected to a string in WS2812B LEDs (here is a link to one in action - )

It takes 5V input, steps it dopwn to 3.3V for the ESP and then outputs 5V for the sensor or lights on a 3.5mm Stereo jack socket (just because I had some lying around ;)

If anyone wants the fritzing files to make it themselves I am more than happy to share, just message me and I'll send them across :)

Raphango (author)2016-05-06

Great! =D

Just a tip: Give more instructions about what to do with all this HTML code. Keep in mind that not everyone knows it.. ;)

geekrex (author)Raphango2016-05-07

ya i know i will be comming with much simpler version

SabinS2 (author)2016-05-05

You only want a fourxfourholes perf section with four rows of copper track of length four holes.follow see the photos andyou'd understand what I mean by that.Now cut that half victimisation the metal saw blade and at last cut smaller components victimisation (victimisation?:) the edge tool.The edge tool works higher to straighten the sides.Now cut four copper tracks at the center as I actually havedone.Cut 2 Strips of 4Male Header pins every.Cut 2 Strips of four feminine Header pins every (what?).Push the 4-Pin Male header pins all the manner down till they're invisible in one facet of the plastic frame.

Please modify text like the above to make it readable. I was really interested to see what this project achieves, but I can't even get past the introduction to understand what I'm going to make.

geekrex (author)SabinS22016-05-05

i am sorry for my carelessness is it understandable now ?

SabinS2 (author)geekrex2016-05-06

Yup. It's great now. Nu more victimisation :) I guess your Autotext app was set to "Human Rights" or something like that instead of "Electronics Tutorial" :)

The ESP8266 looks really cool. I'll be sure to make some time to try it out in the future.

geekrex (author)SabinS22016-05-06

lol , who knows it was my first time :D

ericCycles (author)2016-05-05

your introductory page seems to have the text "Associate in Nursing" embedded in it a few times, some sort of global search and replace with the keyboard focus?

geekrex (author)ericCycles2016-05-05

while writing i did some take some ,and was trying a new app which improves writing but that was a blunder .thanks for pointing me

monguin (author)2016-05-05

Thanks for the instructable! Maybe you could add something about home automation?

geekrex (author)monguin2016-05-05

ya sure coming soon

About This Instructable




Bio: So basically i am a crazy person, who loves to think the most odd way ever possible,who makes what he thinks and also let ... More »
More by geekrex:DIY 3D Printed Desk Lamp$200 DIY 3D Printer Build$1 DIY Fidget Toy
Add instructable to: