0% found this document useful (0 votes)
3 views

Experiment-9

The document outlines an experiment for implementing a smart home automation system using NodeMCU, relay, and an AC bulb, controlled via an Android app. It includes hardware and software requirements, a theoretical overview of NodeMCU and relays, a step-by-step procedure for setup, and a code example for controlling devices through Firebase. Additionally, it provides a Tinkercad simulation link for further exploration.

Uploaded by

saurabhautade18
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Experiment-9

The document outlines an experiment for implementing a smart home automation system using NodeMCU, relay, and an AC bulb, controlled via an Android app. It includes hardware and software requirements, a theoretical overview of NodeMCU and relays, a step-by-step procedure for setup, and a code example for controlling devices through Firebase. Additionally, it provides a Tinkercad simulation link for further exploration.

Uploaded by

saurabhautade18
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

MIOT-Lab Manual

Experiment No. – 9

Title: Implement smart home automation system. The system automates home appliances
and controls them over internet from anywhere.

Hardware Requirements: NodeMCU, Relay, AC Bulb


Software Requirements: Arduino IDE, Google Firebase, Android App
Theory:
NodeMCU:
NodeMCU is Lua based firmware of ESP8266. Generally, ESPlorer IDE is referred for
writing Lua scripts for NodeMCU. It requires getting familiar with ESPlorer IDE and Lua
scripting language.
There is another way of developing NodeMCU with a well-known IDE i.e. Arduino IDE. We
can also develop NodeMCU applications using the Arduino development environment. This
makes things easy for Arduino developers than learning a new language and IDE for
NodeMCU.

Relay:

Department of Electronics & Telecommunication Engineering (2024-25)


MIOT-Lab Manual

A relay is an electrically operated switch. It consists of a set of input terminals for a single or
multiple control signals, and a set of operating contact terminals. The switch may have any
number of contacts in multiple contact forms, such as make contacts, break contacts, or
combinations thereof.

Fig.1 Circuit diagram of Home Automation System

Department of Electronics & Telecommunication Engineering (2024-25)


MIOT-Lab Manual

Fig.2 Actual Result

Procedure:

 Make the connection as per circuit diagram


 Open Arduino IDE
 Select the NodeMCU ESP8266
 Select the communication Port
 Write code in Editor Window and save file
 Compile the code
 Upload the code
 Open the Android app
 Control the appliances

Department of Electronics & Telecommunication Engineering (2024-25)


MIOT-Lab Manual

Conclusion:

Tinkercad Simulation Link:


https://www.tinkercad.com/dashboard?type=circuits&collection=designs

Department of Electronics & Telecommunication Engineering (2024-25)


MIOT-Lab Manual

Code:
#include <FirebaseESP8266.h>
#include <ESP8266WiFi.h>
#define ssid "RAHULSHIMPI" //WiFi SSID
#define password "12345678#" //WiFi Password
#define FIREBASE_HOST "ehas-1234-default-rtdb.firebaseio.com"
#define FIREBASE_AUTH "o8ctQwHRzCTPRVyjMeeiqJSm3v3RSYJAB96pAQsJ"
//If using Relay Module
int Device_1 = D0; //initialize D6 Pin
void setup()
{
Serial.begin(9600);
WiFi.begin (ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println ("");
Serial.println ("WiFi Connected!");
Firebase.begin(FIREBASE_HOST,FIREBASE_AUTH);
pinMode(Device_1,OUTPUT);//initialize the Device OUTPUT
}
void loop()
{
if (Firebase.get(firebaseData,"/D1")) {
if (firebaseData.dataType() == "string") {
String De1 = firebaseData.stringData();
if (De1=="1"){
digitalWrite(Device_1,HIGH); //Device1 is ON
}
else if (De1=="0"){
digitalWrite(Device_1,LOW);//Device1 if OFF
}}}
}

Department of Electronics & Telecommunication Engineering (2024-25)

You might also like