Home Automation




Introduction: Home Automation

World is becoming the Digital World and the most emerging new thing is "Internet of the thing(IOT)". It's very exciting to control things around us and the most is very near our heart so the good idea is to convert our HOME in SMART HOME. The thought of the thing around me can talk to me and think smart fascinate me. To make my thought a reality i start to make Home Automation system and thought that may other person interested and share my work in this instructable. you can implement this home automation system with a very basic or no knowledge of programming or electronics. Just follow the steps mentioned here and enjoy the digital life.

After you follow all steps mentioned you can control your lights and fans through your mobile device. This system consist of two parts 1) Software part 2) Hardware part. For the software parts i had done most of the things and you do not have to worry about it. Although if you have a nice idea for to upgrade the system just mention in comment section and i would be more than happy to implement it. For the hardware part is available in the market and at a very low cost.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: The Controller - ESP8266

This home automation system needs to be smart so the brain of the system is a controller. I have used Low cost and most powerful controller available in market ESP8266. ESP8266 is the talk of the town from late 1 year and its equipped with the microcontroller, 4MB storage and a wifi connectivity which is sufficient to make your home smart.

NodeMcu is the development board for ESP8266. Most hobbyist uses this now a days. NodeMcu version 1.0 is the latest and combined package for programming and serial communication. You can get it from amazon or ebay. For your reference i have attached image of NodeMcu.

Step 2: The IDE

For those who is not familiar with IDE, IDE is "Integrated development environment". Basically IDE is a software for writing a program and upload it to hardware. I have used most popular Arduino IDE for this project. this the enough information to get start with our work

Step 3: Get Ready NodeMcu.

Till now i have informed you all the detail required for this project now its time to get the things to assemble and make it real.

As i have mentioned you have your NodeMcu development board.(get it from amazon or ebay). Which come with a small usb cable. your android mobile data cable also work.

1. Download IDE: Now that you have a controller in your hand, we need to put a piece code in it. to get it done first download the arduino IDE from the following link.


2. Install IDE: Now Install it on your PC.

3. RUN IDE: After installing run the software.

Now you have a IDE running on your PC we need to tell it that we want upload the program in NodeMcu(ESP8266) controller. To get this done there is a nice guide with picture at https://learn.sparkfun.com/tutorials/esp8266-thing...

after following the guide all your environment is prepared for this project.

Step 4: Programming the Controller

1. Get The Code: Download the attached file "Node_IO_v03.ino" This is the program to upload in the controller.

double click it and the program will open in arduino IDE. if its give the warning before just hit "OK".

2. Compile the code: Go to the sketch menu and select verify/compile. it will take 1 to 2 min to compile the code. It should compile the code successfully. There is a chance that you get an error if you dont have the required library available. To get all library Go to the sketch-->include library-->manage library. let it download the index automatically. after that search "ESP8266wifi" and the select the library from the result and install it. Repeat the step for all library. Total 7 library is required

1. ESP8266WiFi

2. PubSubClient

3. Arduino

4. WiFiClient

5. WebSocketsServer

6. Hash

7. Ticker

After getting install all library recompile the code.

3. Upload: Go to tools-->board-->NodeMcu 1.0 (ESP-12 module). Now you are ready for upload the program. Connect your NodeMcu to your PC with cable(Android datacable). and go to Sketch--> Upload.

it will compile and upload the code in your controller. Blue light will flash on NodeMcu module during upload.

Step 5: The App.

1. Install the app: Download the apk file attached here and install in your android mobile.

2. connect to the controller: at this time NodeMcu is running a wifi server like a router. Scan the wifi network in your mobile device and you can see wifi network with ssid "ESPadmin" connect to it with password "espadmin". Now that connection between your mobile and NodeMcu is established open the app and go to the setting tab inside the app. In setting tab add wifi ssid and password. this is the credential of your router ssid/pass or you can use your mobile hot spot ssid/pass. Nodemcu will connect to this wifi network and use the internet require for control lights and fans.

3. Add device: now that your controller is connected to wifi network go to the dashboard tab. Add new device enter your device name and inside the pin no. select nodeMcu pin. For now keep it D00. and save.

For the testing purpose D00 will control the onboard "ON" LED.

Step 6: Relay Control

Get the 4 channel relay board from amazon or ebay.

Power board with 12 v battery and short GND terminal with NodeMcu Gnd.

Connect node GPIO with Relay board terminal. And you are good to go for controlling AC appliance through Relay.I recommend to get the electrician to connect the relay board with your home switch board as it include the working with 230V.

Step 7: The End

This is a very simple project and if you stuck in any step or the things are not working as mentioned please give me a comment and i will guide you for the correction.

System is tested and working in my home so do try if you are really interested.

Be the First to Share


    • Toys and Games Challenge

      Toys and Games Challenge
    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge



    3 years ago


    When I compile the file I get this error:

    C:\Users\LORIS\Downloads\Node_IO_v03\Node_IO_v03.ino: In function 'void setup()':

    Node_IO_v03:191: error: 'class PubSubClient' has no member named 'setServer'

    client.setServer(mqtt_server, mqtt_port);


    Node_IO_v03:192: error: 'class PubSubClient' has no member named 'setCallback'



    exit status 1

    'class PubSubClient' has no member named 'setServer'

    you Can helpme