sai madhav
Published

IoT Home Using NodeMCU and Blynk Cloud

The aim of this project is to control and monitor our home appliances through the internet from anywhere in the world.

IntermediateShowcase (no instructions)8 hours3,448
IoT Home Using NodeMCU and Blynk Cloud

Things used in this project

Hardware components

4-CHANNEL RELAY CONTROLLER FOR I2C
ControlEverything.com 4-CHANNEL RELAY CONTROLLER FOR I2C
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
LED Light Bulb, Frosted GLS
LED Light Bulb, Frosted GLS
×2
DC motor (generic)
×2
9V battery (generic)
9V battery (generic)
×4
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1

Software apps and online services

Blynk
Blynk

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
10 Pc. Jumper Wire Kit, 5 cm Long
10 Pc. Jumper Wire Kit, 5 cm Long

Story

Read more

Schematics

IOT HOME

Code

IOT HOME

Arduino
We can control our home appliances using the internet from anywhere in the world.
#define BLYNK_PRINT Serial       // THESE 3 LIBRARIES FOR USING BLYNK CLOUD
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>           
#include <SPI.h>
#include<Servo.h>    // SERVO MOTOR LIBRARY
#include <ESP8266WiFi.h>   //NODEMCU WIFI MODULE LIBRARY

#include <DHT.h>

char auth[] = "mswM-7r5JXmiRFHoFYWYKmxOsglX4rL1";  //AUTHENTICATION KEY PROVIDED BY BLYNK CLOUD
char ssid[] = "naani";   //WIFI SSID
char pass[] = "12345677";  //WIFI PASSWORD

#define DHTPIN 2         //DHT 11 - TEMPERATURE AND HUMIDITY SENSOR  
#define DHTTYPE DHT11 
DHT dht(DHTPIN, DHTTYPE);

SimpleTimer timer;  //SIMPLE TIMER

void Sensor()
{
  int h = dht.readHumidity();
  int t = dht.readTemperature(); 
  if (isnan(h) || isnan(t))
  {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  Serial.println(h);   //TO PRINT HUMIDITY VALUES ON SERIAL MONITOR
  
  Serial.println(t);   //TO PRINT TEMPERATURE VALUES ON SERIAL MONITOR
  
   Blynk.virtualWrite(V7,h); //TO PUBLISH HUMIDITY VALUES TO BLYNK CLOUD
   
  Blynk.virtualWrite(V8,t); //TO PUBLISH TEMPERATURE VALUES TO BLYNK CLOUD 
}

Servo servo; //TO DECLARE SERVO


void setup()
{
  Serial.begin(9600);  //TO BEGIN SERIAL MONITOR
  
  Blynk.begin(auth, ssid, pass);//TO BEGIN BLYNK CLOUD CONNECTION
  
  dht.begin();    // TO BEGIN DHT11 SENSOR 
  
  timer.setInterval(1000L,Sensor);  //TO EXECUTE THE FUNTION Sensor FOR EVERY SECOND
  
  servo.attach(D8); //TO DECLARE THAT THE SERVO IS CONNECTED TO PIN D8
  servo.write(0);
}


void loop()
{ 
  Blynk.run();  //TO START PUBLISHING DATA TO BLYNK CLOUD
  timer.run();  //TO START TIMER

}

BLYNK_WRITE(V1) //THIS FUNCTION IS TO WRITE THE VALUES OF SERVO FROM BLYNK MOBILE INTERFACE
{
   servo.write(param.asInt());
}

Credits

sai madhav
1 project • 1 follower

Comments