IoT Home automation using NodeMCU + MIT android app + Firebase

preview_player
Показать описание
In this IoT based project, we will learn how to do Home automation using NodeMCU and MIT App. This is a simple but useful home automation project with Nodemcu and a relay module where we can control home appliances securely from the smartphone.
During the video, I have shared the circuit diagram, NodeMcu sketch, Nodemcu example library for this internet of things project.

#include "ESP8266WiFi.h"
#include "FirebaseArduino.h"

#define FIREBASE_AUTH "H2wLIS7QTMxvgLJ33kURwJfGp2GSYgY26D8sTPfW"
#define WIFI_SSID "iPhone"//wifi ssid
#define WIFI_PASSWORD "16505123"//your wifi password

String Regulator1, relay1, relay2;
String Regulator2, relay3, relay4;

#define PWM_PIN1 D5
#define PWM_PIN2 D6
#define Light1 D0
#define Fan1 D1
#define Light2 D2
#define Fan2 D3
#define WifiLed D4

void setup()

// Debug console
pinMode(PWM_PIN1, OUTPUT);
pinMode(Light1,OUTPUT);
pinMode(Fan1,OUTPUT);
pinMode(PWM_PIN2, OUTPUT);
pinMode(Light2,OUTPUT);
pinMode(Fan2,OUTPUT);
pinMode(WifiLed,OUTPUT);

digitalWrite(Light1,LOW);
digitalWrite(Fan1,LOW);
digitalWrite(Light2,LOW);
digitalWrite(Fan2,LOW);

{
delay(500);
}



}

void loop()
{
{
digitalWrite(WifiLed,HIGH);
delay(1000);
digitalWrite(WifiLed,LOW);
delay(1000);
}



if(relay1 == "0")
{
digitalWrite(Light1,HIGH);
}
if(relay1 == "1")
{
digitalWrite(Light1,LOW);
}


delay(100);
delay(100);// delay of 100ms to reduce the hitcount.

}
Рекомендации по теме