Menu Close

Blynk for NodeMCU – Home automation

This tutorial of Robo India explains how to automate your home using Robo India Blynk board and Blynk app.

1. Introduction:

In this project we are going to build a simple home automation project allows you to control home appliance from anywhere. Blynk provides very good and attractive interface.

1.2 Hardware required

Blynk Board and NodeMCU is used in this example. Inset NodeMCU to the Blynk board as shown in the image ahead then connect NodeMCU to PC or Laptop through USB cable.

2. On Blynk App

You need to perform following steps on Blynk App.

2.1 Create a New Project in BLYNK app.Write Project name Simple Automation and Select NodeMCU from drop down.

2.2 An AUTH token will be sent to your registered email, note this down. Tap on the screen and add a 2 Button.

2.3 Tap on the Widget and select the respective Digital pins for switch (D1 for relay 1 and D2 for relay 2).

3. Code the NodeMCU with the following code.

Before uploading, make sure to paste your authorization token into the auth [] variable. Also make sure to load your Wifi network settings into the Blynk.begin(auth, “ssid”, “pass”) function.

Following code may be downloaded from here.

// Robo India Tutorial 
// Simple Home Automation 
// Hardware: NodeMCU Blynk Board


#define BLYNK_PRINT Serial


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


char auth[] ="Your Auth. Key";// You should get Auth Token in the Blynk App.
                              // Go to the Project Settings (nut icon).
const int R1  = 5;            // Output Relay 1 GPI0 05 (D1)
const int R2  = 4;            // Output Relay 2 GPI0 04 (D2)


char ssid[] = "Your Wifi Network name";     // Your WiFi credentials.
char pass[] = "Password of your network";   // Set password to "" for open networks.

void setup()
{
  Serial.begin(9600);         // Debug console
  Blynk.begin(auth, ssid, pass);
  pinMode(R1,OUTPUT);
  pinMode(R2,OUTPUT);
}

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


4. Output

After Uploading the Ardunio code IDE. Press the play button on blynk app .When we press the relay button on. You will see the output on NodeMCU blynk board the relay is on.

5. Where to Buy.

Buy Blynk Board on Amazon – 

Buy Blynk Board on Robo India – Buy here

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

Leave a Reply