home automation with esp8266 - Esp8266 projects

esp8266 projects

ESP8266 Home Automation with new Blynk 2.0

In this video you will learn about ESP8266 based Home Automation with Blynk 2.0 IOT projects. We are going to control Light bulb with smartphone. To program the esp8266 board I'm using Arduino IDE.  #mrpopprojects

Component requirements:
 1. NodeMCU ESP8266 board.
 2. 4 Channel Relay.
 3. Light Bulb x 4.
 4. Bulb holder x 4.
 5. Breadboard.
 6. Jumper wire.
 7. AC plug.

Circuit Diagram:
home automation with esp8266 circuit diagram

Pin connection:
1. First take a breadboard and attach the esp8266 board to it.
2. Now, take a four-channel relay module.
  • Connect Relay IN1 Pin to esp8266 D1 pin.
  • Connect Relay IN2 Pin to esp8266 D2 pin.
  • Connect Relay IN3 Pin to esp8266 D5 pin.
  • Connect Relay IN4 Pin to esp8266 D6 pin.
3. Esp8266 VIN pin is connected to breadboard positive side.
4. Esp8266 GND pin is connected to breadboard GND side.
5. Connect Relay VCC Pin to breadboard positive side and Connect Relay GND Pin to breadboard GND side.
6. Now, take a bulb holder and connect a yellow electric wire to holder pin and secure it with the help of secure.
7. Take a red electric wire and connect it with the holder another pin.
8. Bulb holder connection to the relay module.
  • Connect the yellow wire to relay NO pin and secure it with the screw.
  • Connect the green wire to relay the COM pin. 
9. Take another bulb holder and connect the yellow wire to relay NO pin.
10. Take a red wire and attach it to the first holders red wire.
11. Now, connect the red wire to second bulb holder pin.
12. Take another green wire and attach it to the relay green wire and then connect it to the second relay COM pin.
13. Follow the same process for other bulb holder and relays.

Connection between relay and Bulb holder

14. Now, Provide the AC power supply to the bulb. 
AC plug wire is connected to red wire and another one to green Wire. 
15. Now, Circuit is completed, after that attach the bulb to the bulb holder.
16. Upload the code and setup the new blynk 2.0 Iot platform.

// Fill-in information from your Blynk Template here
//#define BLYNK_TEMPLATE_ID           "TMPLxxxxxx"
//#define BLYNK_DEVICE_NAME           "Device"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"

int RelayPin1 = 5;
int RelayPin2 = 4;
int RelayPin3 = 14;
int RelayPin4 = 12;

BLYNK_WRITE(V0) { //Button Widget is writing to pin V0
  int pinValue = param.asInt();
  digitalWrite(RelayPin1, pinValue);

BLYNK_WRITE(V1) { //Button Widget is writing to pin V1
  int pinValue = param.asInt();
  digitalWrite(RelayPin2, pinValue);
BLYNK_WRITE(V2) { //Button Widget is writing to pin V2
  int pinValue = param.asInt();
  digitalWrite(RelayPin3, pinValue);
BLYNK_WRITE(V3) { //Button Widget is writing to pin V3
  int pinValue = param.asInt();
  digitalWrite(RelayPin4, pinValue);

void setup()
  pinMode(RelayPin1, OUTPUT);
  pinMode(RelayPin2, OUTPUT);
  pinMode(RelayPin3, OUTPUT);
  pinMode(RelayPin4, OUTPUT);

  //TURN OFF all Relays on Start 
  digitalWrite(RelayPin1, HIGH);
  digitalWrite(RelayPin2, HIGH);
  digitalWrite(RelayPin3, HIGH);
  digitalWrite(RelayPin4, HIGH);

void loop() {

 Watch This Tutorial: 

esp8266 how to program, esp8266 projects, esp8266 for arduino, home automation with esp8266, esp8266 home automation code

Post a Comment


Post a Comment