In the previous post , we worked on a home automation project and Android mobile application & controlled devices locally .ie., over Local Area Network.

In this post we will see how to make the home automation project to control from anywhere in the world. IOT CLOUD Platform BLYNK is used for implementing this.BLYNK is the most popular IoT platform to connect your devices to the cloud,

BLYNK  is a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets.It supports a wide range of Hardware including Arduino,Nodemcu,Raspberry PI & others.

First  install BLYNK on your mobile phone by signing up with your EMAIL ID.

Open BLYNK application.Touch on NEW PROJECT.


Provide a name to the project & select hardware.Here Im using NODEMCU.




Connection type is WIFI .

Touch on CREATE button.



An authorized token ID will be sent to your registered EMAIL.



Now we shall see the WIDGET BOX to add some elements.Each element of WIDGET BOX has got an ENERGY LEVEL.

While starting up you will be provided a free energy level of 2000.According to the usage of widgets this energy level will be deducted.



For e.g , add a BUTTON to your project.


An energy level of 200 will be deducted.If you want you can BUY Energy level by touching on the ADD button.





Add 2 buttons as shown below.



To set the properties of first button , touch on that button.




Provide a name to the button 1.

Touch on PIN to select pin.As we control a dc fan through relay board which is connected to D2 of Nodemcu , select DIGITAL PIN D2.

There are also VIRTUAL PINS Upto 255 , which are specific to BLYNK firmware. These virtual pins are NOT Physical pins , but are handy to send data or message to them and then control physical pins from within code.


Slide the MODE setting to SWITCH which makes the button at as ON or OFF.



Similarly for the Button 2 set the PIN to digital D4 where we control an AC load through the relay board.





Now touch on the Back arrow to go to the start up page.

On touching the PLAY Icon , a message indication stating Not yet online is displayed.As we are yet to upload code on to Nodemcu , the setting is OFF line for now,

From your PC side , open the Arduino IDE.

For setting NODEMCU to Arduino core ,open File & under Preferences paste this json link


Image 5

Then open Tools –> Boards Manager , search for ESP8266 & install.

Image 29

Also from Sketch – > Manage Libraries –> Library

search fro BLYNK & install the library.

Image 31

Once the library is installed you can see under Examples —> Blynk

Open the NodemCU Example code.


You need to replace with your Authorized token ID which you received in Email while creating the Blynk project.

Provide your WiFi credentials ,SSID & password of Router to which Nodemcu will be connected.

Also under setup() make the digital pins D2 & D4 HIGH.

This step is to make the loads connected to relays initially OFF.

As the relay board we are using is a LOW ENABLED , a LOW at input energizes the Relay and a HIGH makes it OFF.


We make use of MB102 PSU board on a MB102 bread board.This MB102 board has got jumper settings to make one rail as 5v & the other rail as 3.3v.

A jumper seen at he relay board can be removed.

Connect Vcc to 3.3v & JD-Vcc to 5v rail of bread board.

Image 32

The loads can be connected as shown below.Always connect the power source  on which the load operates to the POLE pin.Actual load is connected to Normally Open contact.

Image 37

Connect NODEMCU to PC , from ARDUINO IDE select the board as NODEMCU & select the port allotted.For this you must have already installed driver for CP2102.

Upload the code & then disconnect USB cable.

Provide 12v 1amp or 9v 1amp adapter to MB102 PSU board.

Allow some time for NODEMCU to join the SSID mentioned in the code.

While using AC load ,take care not to touch the relay board and insulate properly the relay board inside a plastic box.

Image 38

Now open the BLYNK Application and touch on the project you created.On top right corner touch on the PLAY Icon.

Once you see ONLINE indication , you can touch on the buttons created to control the loads.

video tutorial :