Description:

In this IoT based project, we will learn how to make a Home Automation project using NodeMCU and Blynk App. The circuit is very simple, we just need a Nodemcu board and a relay module to control home appliances securely from the smartphone through the internet.
I have shared all the details like esp8266 NodeMCU pinout, circuit, Arduino sketch, Blynk App setup for this smart home project.

Home automation with NodeMCU and Blynk pic 1

Required Component For NodeMCU Project

Nodemcu and Relay module
  1. NodeMCU board
  2. Relay Module 5volt
  3. 5 volt DC supply

Circuit For NodeMCU Blynk Relay

NodeMCU Relay module circuit 1

The circuit for this home automation project is very simple. We just need a relay module and NodeMCU board for this circuit. And we can control different home appliances from Blynk App.

Here I have used a 2-channel relay module but you can also connect 4-channel or 6-channel relay module with node MCU. For that, you can use D1, D2, D5, D6, D7, D8 pins of NodeMCU.

I have shared all the GPIO details of the esp8622 NodeMCU board in the following picture.

NodeMCU input and output pins

Install Blynk App From Google Playstore

Blynk App download

After installing the Blynk app, enter the Email ID and set the password to Sign Up.

Create A Project In Blynk App

Blynk App set up for Node MCU

To Create a new project in the Blynk app you have to give the Project Name and Choose The Device. In this IoT project, I will use NodeMCU, so I have selected NodeMCU.

After that Blynk app will send an Auth Token to the registered email id. We need that Auth Token while programming the NodeMCU.

Code For NodeMCU Blynk WiFi Relay

Blynk example sketch for NODEMCU

For this smart home project, we need to install the Blynk Library before programming the NodeMCU board.

Click Here to download Latest Blynk Library.

Then to get this Blynk example sketch for Nodemcu go to
File–> Examples–> Blynk–>Boards WiFi –>NodeMCU

#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
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}

void loop()
{
  Blynk.run();
}

Then enter the following details in the code:

  1. Auth Token received in Email at “YourAuthToken”
  2. WiFi Network Name at “YourNetworkName”
  3. WiFi Password at “YourPassword”

Now select the NodeMCU board and PORT in Arduino IDE. Now click on the upload button to program the NodeMCU.

Create Switches In The Blynk App

Home automation with NodeMCU and Blynk pic 6

Now I have to create switches in the Blynk app to control the relay module.

Steps To Create A Switch In Blynk App:
Open the project in the Blynk AppClickon the “+” icon on the top.
select the Button
Click on that button and select the Output Pin –> D1 & Mode –> Switch

In similar way create switch with D2 Pin of NodeMCU

You can also refer the tutorial video for creating the switch in the Blynk App

Connect The Home Appliances

NodeMCU Relay module circuit 2

Here I have connected two AC lamps. You can connect any other home appliances with this wifi relay module.

And as I said before you can also connect 4 channel or 6 channel relay module with ESP8266 NodeMCU. For that, you can use D1, D2, D5, D6, D7, D8 as output pins of node MCU.

Now we can control these AC lamps or any other home appliances from the smartphone. So this a very simple but useful internet of things project where I can control home appliances from anywhere if I have an internet connection on my mobile.

I hope, you like this IoT based project with NodeMCU.

Von Sirko

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.