rajeshjiet
Published © CERN-OHL

Home automation using iot

In this project, we will learn about the application of Arduino IoT Cloud with AR D1. Recently the Arduino Community launched their IoT plat

IntermediateFull instructions provided110
Home automation using iot

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Relay Module (Generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
LED Light Bulb, Frosted GLS
LED Light Bulb, Frosted GLS
×1
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
×1

Software apps and online services

Blynk
Blynk

Story

Read more

Schematics

Home Automation Circuit Diagram

Code

Code for Arduino

Arduino
#define BLYNK_TEMPLATE_ID "# Your template id"
#define BLYNK_DEVICE_NAME "# Your Dvice Name"
#define BLYNK_AUTH_TOKEN "# Your Auth token"

#define BLYNK_PRINT Serial

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

char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "# Your SSid";
char pass[] = "Your SSid Password";

BLYNK_WRITE(V0)
{
  int value = param.asInt();
  Serial.println(value);
  if(value == 1)
  {
    digitalWrite(D5, LOW);
    Serial.println("LED ON");
  }
  if(value == 0)
  {
     digitalWrite(D5, HIGH);
     Serial.println("LED OFF");
  }
}

BLYNK_WRITE(V1)
{
  int value = param.asInt();
  Serial.println(value);
  if(value == 1)
  {
    digitalWrite(D6, LOW);
    Serial.println("LED ON");
  }
  if(value == 0)
  {
     digitalWrite(D6, HIGH);
     Serial.println("LED OFF");
  }
}

BLYNK_WRITE(V2)
{
  int value = param.asInt();
  Serial.println(value);
  if(value == 1)
  {
    digitalWrite(D7, LOW);
    Serial.println("LED ON");
  }
  if(value == 0)
  {
     digitalWrite(D7, HIGH);
     Serial.println("LED OFF");
  }
}

BLYNK_WRITE(V3)
{
  int value = param.asInt();
  Serial.println(value);
  if(value == 1)
  {
    digitalWrite(D8, LOW);
    Serial.println("LED ON");
  }
  if(value == 0)
  {
     digitalWrite(D8, HIGH);
     Serial.println("LED OFF");
  }
}


void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  pinMode(D5,OUTPUT);
  pinMode(D6,OUTPUT);
  pinMode(D7,OUTPUT);
  pinMode(D8,OUTPUT);
}

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

Credits

rajeshjiet

rajeshjiet

3 projects • 0 followers

Comments

Add projectSign up / Login