You are on page 1of 46

The Internet of Things

The Internet of Things (IoT) is a system of interrelated computing devices,


mechanical and digital machines, objects, animals or people that are provided with
unique identifiers and the ability to transfer data over a network without requiring
human-to-human or human-to-computer interaction.

DESCRIPTION

➢ In this project the LED was operated using Node Mcu and Moblie, through
an App (Application) developed with the help of MIT App Inventor.

➢ By installing this App in your Android Phone you can able to control the
LED.

Overview
➢ ESP8266 WiFi Module has been a main figure in the IoT market.

➢ There are several flavours of ESP8266 like ESP-01 by AiThinker,


NodeMCU and so forth but the intention and the job are the same.

➢ There are several IoT Projects based on ESP8266 WiFi Module but Home
Automation i.e. controlling different electrical appliances through WiFi (or
Internet) has always been a trending and in demand project.

➢ So, in this project, We’ll show you how to interface a LED to the ESP8266
WiFi Module and also how control a LED on&off state’s using ESP8266.

➢ For this project, We’ll also create an Android App using which you can use
for controlling purpose.
Hardware Components Required
➢ NodeMCU
➢ LED
➢ Resistor (220K)
➢ Breadboard
➢ Connecting wires

Software Components Required


➢ Arduino IDE
➢ Firebase
➢ Android application(MIT APP INVENTOR)

Hardware Component Description

• NodeMCU

▪ NodeMCU is an open source LUA based firmware developed for


ESP8266 wifi chip. By exploring functionality with ESP8266 chip,
NodeMCU firmware comes with ESP8266 Development board/kit
i.e. NodeMCU Development board.
▪ Since NodeMCU is open source platform, their hardware design is
open for edit/modify/build.
▪ NodeMCU Dev Kit/board consist of ESP8266 wifi enabled chip.
The ESP8266 is a low-cost Wi-Fi chip developed by Espressif
Systems with TCP/IP protocol.
▪ NodeMCU Dev Kit has Arduino like Analog (i.e. A0) and Digital
(D0- D8) pins on its board.
▪ It supports serial communication protocols i.e. UART, SPI, I2C
etc.
▪ Using such serial protocols we can connect it with serial devices
like I2C enabled LCD display, Magnetometer HMC5883, MPU-
6050 Gyro meter +Accelerometer, RTC chips, GPS modules, touch
screen displays, SD cards etc.
• LED
▪ A light-emitting diode (LED) is a two-lead semiconductor light
source.
▪ It is a p–n junction diode that emits light when activated.
▪ When a suitable current is applied to the leads, electrons are able to
recombine with electron holes within the device, releasing energy in
the form of photons. This effect is called electroluminescence.
• Resistor
▪ A resistor is a passive two-terminal electrical component that
implements electrical resistance as a circuit element.
▪ In electronic circuits, resistors are used to reduce current flow, adjust
signal levels, to divide voltages, bias active elements, and terminate
transmission lines, among other uses.
Software Component Description

• Arduino IDE
▪ The Arduino integrated development environment (IDE) is a cross-
platform application (for Windows, macOS, Linux) that is written in
the programming language Java. ... The Arduino IDE supplies a
software library from the Wiring project, which provides many
common input and output procedures.

• Firebase
▪ Firebase is a mobile and web application development platform
developed by Firebase, Inc. in 2011, then acquired by Google in 2014.
As of October 2018, the Firebase platform has 18 products which are
used by 1.5 million apps.

• MIT App Inventor


▪ App Inventor for Android is an open-source web application originally
provided by Google, and now maintained by the Massachusetts Institute
of Technology.
▪ It allows newcomers to computer programming to create software
applications for the Android operating system.
CONCEPT

BLOCK DIAGRAM
CIRCUIT DIAGRAM

HARDWARE CONNECTIONS

▪ LED Anode pin(+) is connected with Node Mcu (D0) pin via
Resister(220k).

▪ LED Cathode(-) pin is connected to Node Mcu (GND) pin.

▪ Node Mcu is Powerd by computer via USB-C Cable.


SOFTWARE

1.Open Firebase console.


2.Create new project.

3. Enter the project name & Select india in Ananlytics


location.
4.Create New Database in Firebase.
STEP 1:

STEP 2:
STEP 3:

5. Select the real-time database port.


6. Select the rules section in the database & change the
read and write line false into true.

7. After changing the read and write line publish the


database.
8. Take the copy of url &save it into the notepad.

9. Go to project setting &select the service acccount.


10. After selecting the service account ,click the
database secrets option then take the copy of secret
code&save it into the notepad.
MIT APP INVENTOR
1. Click the create apps! option in the mit app inventor.

2.Start New Project in The Mit App Inventor.

3. Give the project name without any space.


4. Select the button from the palette & drag it into the
screen.

5. After select the two button’s change the button’s


name as on and off.
6. Select the firebase from the palette & drag it into the
screen,also let’s make the firebase token & firebase url
boxes as empty.

7. Copy the url from the notepad & paste to firebase url
box,also copy the secret code & paste to firebase token
box.
8. After this process go to block window.

9. Select the button1 & button2 block’s as per the


below step.
10. Select the firebase block as per the below step.also
merge the firebase block ‘s to the button block’s like
puzzle.

11. Select the math block as per the below the step.
12. Merge the math block with firebase block &
change the (tag) name and (value to store)name as per
the below step.

13. Select the build option as per below step.


14. QR code was generated for this project.scan the qr
code and download the file via browser .after download
process install the app in mobile phone.

ARGUING IDE
1.Go to tools and select the Node mcu1.0
(ESP8266module) board.
2.Copy the below program paste it into the Arduino.

#include <Firebase.h>
#include <FirebaseArduino.h>
#include <FirebaseError.h>
#include <FirebaseHttpClient.h>
#include <FirebaseCloudMessaging.h>
#include <FirebaseObject.h>
#include <ESP8266WiFi.h>

#define FIREBASE_HOST " *********"//<<paste the Firebase URL.


#define FIREBASE_AUTH "********"//<paste the Firebase secret key.
#define WIFI_SSID "*******"// <<Your mobile hotspot name.
#define WIFI_PASSWORD "*******"// <<password.

void setup()
{
pinMode (D0,OUTPUT);
Serial.begin(115200);

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
Firebase.set("LED STATUS",0);
}

void firebasereconnect()
{
Serial.print("Trying to reconnect");
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}

void loop()
{
int LED;
if (Firebase.failed())
{
Serial.print("setting number failed:");
Serial.print(Firebase.error());
firebasereconnect();
return;
}
LED=Firebase.getString("LED STATUS").toInt();
if(LED==0)
{
digitalWrite(D0,0);
Serial.println("LED OFF");
}

else if(LED==1)
{
digitalWrite(D0,1);
Serial.println("LED ON");
}
3.Compile the program.

4.Before uploading process Select the right port for


communication.

4.Upload the program in Node Mcu board via USB-C


Cable.
5. After uploading process Open the app & Firebase
Database.
6. If we press the on button in the app,then the led status
was changed as “1” in the database & LED was gone to
“ON” condition.

7. If we press the off button in the app,then the led status


was changed as “0” in the database & LED was gone to
“OFF” condition.
TEMPERATURE SENSOR INTERFACE
DESCRIPTION

➢ In this project the we monitor the temperature using temperature sensor &
ESP8266 and mobile through an App (Application) developed by the help of
MIT App Inventor.
➢ By installing this App in your Android Phone, you can able to monitor the
temperature of atmosphere .

Hardware Components Required


➢ NodeMCU
➢ LM35
➢ Breadboard
➢ Connecting wires

Software Components Required


➢ Arduino IDE
➢ Firebase
➢ Android application(MIT APP INVENTOR)

Hardware Component Description

• Lm35
▪ LM35 is a 3 pin temperature sensor which requires a VCC and GND
and in return the remaining third pin gives us an analog output.
▪ This output is then provided to the ADCs present in AtMega 16 IC
which according to a formula calculate the temperature in °C format.
▪ The LM35 series are precision integrated-circuit temperature sensors,
whose output voltage is linearly proportional to the Celsius
(Centigrade) temperature.
▪ The LM35 thus has an advantage over linear temperature sensors
calibrated in ° Kelvin.

❖ Other components are we already discussed in above project.


Block Diagram

Circuit Diagram
HARDWARE CONNECTIONS

▪ Node Mcu (A0) pin is connected to Lm35 Output pin(+).

▪ Lm35 (Gnd) pin is connected to Node Mcu (GND) pin.

▪ Lm35 (Vcc) pin is connected to Node Mcu(Vin) pin.

▪ Node Mcu is Powerd by computer via USB-C Cable.

SOFTWARE

1.Open Firebase console.


2.Create new project.

3. Enter the project name & Select india in Ananlytics


location.
4.Create New Database in Firebase.
STEP 1:

STEP 2:
STEP 3:

5. Select the real-time database port.


6. Select the rules section in the database & change the
read and write line false into true.

7. After changing the read and write line publish the


database.
8. Take the copy of url &save it into the notepad.

9. Go to project setting & select the service acccount.


10. After selecting the service account ,click the
database secrets option then take the copy of secret
code&save it into the notepad.
MIT APP INVENTOR
1. Click the create apps! option in the mit app inventor.

2.

2.Start New Project in The Mit App Inventor.

3. Give the name for project.


4.Select the Label from the palette&drag it into the
screen.

5.Clear the label name in the properties


6.Change the label size in the properties.As per the
below value(Height-10)&(Width-30).

7.Select the firebase from the palette&drag it into the


screen,also let’s make the firebase token & firebase url
boxes as empty.
8. Copy the url from the notepad & paste to firebase
url box,also copy the secret code & paste to firebase
token box.

9. After this process go to block window


10.Select the Firebase block’s as per the below step.

11.Select the Label block as per the below step.


12.Set the Label block’s as per the below step.

13.Click the tag then select the “get tag block”.


14.Set the block’s as per the below step.

15. Click the Value then select the “get value block”.
16.Set the block’s as per the below step.

17. Select the build option as per below step.


18. QR code was generated for this project.scan the qr
code and download the file via browser .after download
process install the app in mobile phone.

Arduino IDE
1.Open the Arduino IDE & Select the Node Mcu
board write the below program.
#include <Firebase.h>
#include <FirebaseArduino.h>
#include <FirebaseError.h>
#include <FirebaseHttpClient.h>
#include <FirebaseCloudMessaging.h>
#include <FirebaseObject.h>
#include <ESP8266WiFi.h>

#define FIREBASE_HOST "*********"


#define FIREBASE_AUTH "***********"
#define WIFI_SSID "*******"
#define WIFI_PASSWORD "********"

void setup()
{
pinMode(A0,INPUT);
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
Firebase.set("Temperature",0);
}

void firebasereconnect()
{
Serial.print("Trying to reconnect");
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}

void loop()
{
float n;
Serial.println("in void loop");
if (Firebase.failed())
{
Serial.print("setting number failed:");
Serial.print(Firebase.error());
firebasereconnect();
return;
}
n=analogRead(A0);
float mv = ( n/1024.0)*5000;
float cel = mv/10;
Firebase.set("Temperature",cel);
Serial.print("Temperature=");
Serial.println(cel);
}

2.Compile the program&select the port properly.After


compiling process Upload the program in Node Mcu.
3.If any changes are presented in temperature, then app
will show the value of the temperature . Also Firebase
show that value.

You might also like