How to Build IOT Based Home Automation Project Using Blynk and Esp8266

Written by Ammar

The Internet of Things is the concept of everyday objects – from industrial machines to wearables – using built-in sensors to collect data and act on this data over the network.

For example, a new building development project could be fitted with sensors to automatically adjust heating and lighting. Or production equipment that alert maintenance personnel of impending failure. In short, the Internet of Things is the future of technology that can make our lives more efficient.

For decades we have been fascinated by small-scale gadgets (think of spy movie types) – but only in the last few years have we seen the true potential of the Internet of Things. As the wireless Internet becomes more popular, embedded sensors become more and more complex, and people are beginning to realize that technology can be a personal tool and even a professional tool.

The term “Internet of Things” was coined by entrepreneur Kevin Ashton in the late 1990s. Ashton is one of the founders of the MIT Auto-ID Center, a member of a team that discovered how to link objects to the Internet via RFID tags. He said that he used the term “Internet of Things” for the first time in a 1999 speech – the word has been around since then.

Everyone wanted to build an internet of things project, as IOT project required programming skills. But don’t worry about this project I will be using a user-friendly tutorial so everyone can easily develop an example IOT project. In this tutorial, I will describe how to build an IoT based home automation system using a nodemcu and an Android/IOS app called Blynk. As I said before no programming skills will be necessary for this IOT project.


So, without wasting more time let’s get started.

Collect the Gear

Configure the Blynk app

Simply download the app and follow the below step as I mention below, just sign-up into your Facebook account and create your account on  Blynk. After this create a new project and give the name to your project as I did “Home Automation”. Select the device as NodeMCU because we are using NodeMCU module. In the third option select Wi-Fi.

Add a simple on-off button and select the pin 2 in the digital or select the other pin according to your hardware wiring. you can also choose other pins for more than 1 switches Please go through NODEMCU Pinouts.

Nodmcu Pinout

Arduino IDE Configuration

First of all download and install the Arduino IDE, Also your ArduinoIDE needs to know that you want to use this NodeMcu module. That is, you need to select the right board. Confused?

Well, it’s very simple!

Go to File> Preferences

add this URL in the additional  URL manager

as i mention below in the image.

After this go to, Tools > Board > Boards Manager, and search for the esp8266

After the installation is done add the blynk library, Download the blynk library and simply unzip the library file into Desktop\Documents\Arduino\libraries folder or you can follow the step below.

Download the library of Blynk

After downloading, just add the library file into Arduino ide.

In the next step, we will connect the nodemcu module to the computer using micro USB and upload the code.
follow these steps for uploading the code

Tools>Board> Select “Nodemcu 0.9”

in the next step select your Com port and upload the code.


Upload the code

Simply copy and paste the below code, change the SSID and PASS with your Wifi Credentials and hit to upload button

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “YourAuthToken”;

// Your WiFi credentials.
// Set password to “” for open networks.
char ssid[] = “YourNetworkName”;
char pass[] = “YourPassword”;

void setup()
// Debug console

Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, “”, 8442);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);

void loop()


Now just wire up everything as mention below in the fritzing diagram and voila, things will start working smoothly.


(Visited 11 times, 4 visits today)

About the author


Leave a Comment

Comments Protected by WP-SpamShield Spam Plugin