4 Step Home automation using Node MCU and Blynk App

Components Required:

  1. Arduino IDE
  2. NodeMCU (Esp8266)
  3. 4 Channel Relay to connect 4 appliances
  4. Jumper wires
  5. Smartphone to operate home appliances using Blynk App

Step 1: Setting up Arduino Uno and Blynk App

  1. Adding NodeMcu board: Click on tools -> Board -> Board Manager -> search for esp8266 -> click Install.
Once installed close the window.

2. Click on File -> Preferences -> add Url as shown -> Click Ok

URL — http://arduino.esp8266.com/stable/package_esp8266com_index.json

3. Download the Blynk App on your smartphone through the Play Store. Create an account and then click New Project.

Give a name to your project, select NodeMcu as Device and WIfi as connection Type.

Blynk App will send you a mail containing Auth token and Blynk libraries. Click Blynk libraries and they will get downloaded. Extract the folder from Zip file. Folders named libraries and tools will get extracted. Add the folder to C:\Users\HP\Documents\Arduino.

Step 2: Create a project in Blynk App

Now, add 4 buttons from Widget box as we are using 4 channel relay.

Click on the button -> change its name -> change PIN to digital pin say D3 depending upon your connection. Repeat process for 4 relays. I am using D1 for relay 1, D2 for relay 2, D3 for relay 3 and D4 for relay 4.

Now, Blunk is all set!

Step 3: Writing code in Arduino Uno

    #define BLYNK_PRINT Serial
    #include <ESP8266WiFi.h>
    #include <BlynkSimpleEsp8266.h>
    char auth[] = “GdC7VOPVuwK7Rj6koOeiHR0xeMBnKGu8”; // the auth code that   you got on your gmail
    char ssid[] = “wifi_username”; // username or ssid of your WI-FI
    char pass[] = “password”; // password of your Wi-Fi
    void setup()
    {
        // Debug console
        Serial.begin(9600);
        pinMode(D1,OUTPUT); //extend these to D8 if you are using a 8 pin            relay
        pinMode(D2,OUTPUT);
        pinMode(D3,OUTPUT);
        pinMode(D4,OUTPUT);
        digitalWrite(D1,HIGH); // Make it low if you want everything to go off
        digitalWrite(D2,HIGH); // in case of a power cut
        digitalWrite(D3,HIGH);
        digitalWrite(D4,HIGH);
        Blynk.begin(auth, ssid, pass);
    }
    void loop()
    {
        Blynk.run();
    }

Step 4: Prepare Electrical Connection

Now, connect NodeMcu to Relay using jumper wires. The Connection points are shown below.

connections

Connect Relay’s Comm(Common) and NO(open) to switch.

Now, repeat the process for every relay.

Connections are all set!

Run your Blynk App and control home appliances.

Click the highlighted button to run the app.

Hurray!! You created your own automation device.

Thank You 🙂

Write a comment