0% found this document useful (0 votes)
70 views28 pages

IU1841220050 Palash Shah All Practical's IOT IT 6th Sem

The document discusses practicals performed with an Arduino board and ESP8266. It describes connecting LEDs and a switch to an Arduino, interfacing sensors like a PIR motion sensor and temperature sensor. It also provides information on the ESP8266 microcontroller board including its specifications and using it as a web server.

Uploaded by

Palash Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views28 pages

IU1841220050 Palash Shah All Practical's IOT IT 6th Sem

The document discusses practicals performed with an Arduino board and ESP8266. It describes connecting LEDs and a switch to an Arduino, interfacing sensors like a PIR motion sensor and temperature sensor. It also provides information on the ESP8266 microcontroller board including its specifications and using it as a web server.

Uploaded by

Palash Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

IU1841220050 Palash Shah

Name:- Palash Shah


Branch:- IT
Semester:-6th
Enrollment no:-IU1841220050
INTERNET OF THINGS Practicals

INTERNET OF THINGS

Practical 1: Introduction of Arduino board

Arduino:

Arduino is an open source programmable circuit board that can be


integrated into a wide variety of maker space projects both simple and
complex. This board contains a microcontroller which is able to be
programmed to sense and control objects in the physical world. By
responding to sensors and inputs, the Arduino is able to interact with a
large array of outputs such as LEDs, motors and displays.

IT 6th Sem
IU1841220050 Palash Shah

1. Reset Button – This will restart any code that is loaded to the Arduino board

2. AREF – Stands for “Analog Reference” and is used to set an external reference
voltage

3. Ground Pin – There are a few ground pins on the Arduino and they all work the
same

4. Digital Input / Output – Pins 0-13 can be used for digital input or output

5. PWM – The pins marked with the (~) symbol can simulate analog output

IT 6th Sem
IU1841220050 Palash Shah

6. USB Connection – Used for powering up your Arduino and uploading sketches

7. TX/RX – Transmit and receive data indication LEDs

8. ATmega Microcontroller – This is the brains and is where the programs are
stored

9. Power LED Indicator – This LED lights up anytime the board is plugged in a
power source

10. Voltage Regulator – This controls the amount of voltage going into the Arduino
board

11. DC Power Barrel Jack – This is used for powering your Arduino with a power
supply

12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects

13. 5V Pin – This pin supplies 5 volts of power to your projects

14. Ground Pins – There are a few ground pins on the Arduino and they all work the
same
15. Analog Pins – These pins can read the signal from an analog sensor and convert
it to digital

IT 6th Sem
IU1841220050 Palash Shah

IT 6th Sem
IU1841220050 Palash Shah

TINKERCAD

Code blocks is a new beta addition to Tinker cad. It’s allows the creation of
3D designs using visual programming.
Code blocks includes the creation and use of variables. Values of variables
can be changed to easily create designs of different sizes.

As it is a free cloud-based Computer Aided Design (CAD) environment.

It works best using the Google’s Chrome browser. Other browsers may be
suitable.
\

IT 6th Sem
IU1841220050 Palash Shah

IT 6th Sem
IU1841220050 Palash Shah

Practical 2 : Arduino I/O Interfacing (LED & SWITCH)

Code:
void setup()

pinMode(13, OUTPUT); pinMode(12,

OUTPUT); pinMode(9,OUTPUT);

void loop()

{
digitalWrite(13, HIGH); delay(1000); // Wait for 1000

millisecond(s) digitalWrite(13, LOW);

delay(1000); // Wait for 1000 millisecond(s)

digitalWrite(12, HIGH); delay(1000); // Wait for 1000 millisecond(s) digitalWrite


(12, LOW);
delay(1000); // Wait for 1000 millisecond(s)

digitalWrite(9, HIGH); delay(1000); // Wait for 1000

millisecond(s) digitalWrite(9, LOW); delay(1000); //

Wait for 1000 millisecond(s)

IT 6th Sem
IU1841220050 Palash Shah

Screenshot:

IT 6th Sem
IU1841220050 Palash Shah

IT 6th Sem
IU1841220050 Palash Shah

IT 6th Sem
IU1841220050 Palash Shah

PRACTICAL-3 : Interface analog sensor (PIR Sensor/


temperature sensor and ultrasonic )

O PIR SENSOR:

• PIR sensors allow you to sense motion, almost always used to detect whether a
human has moved in or out of the sensors range.
• They are small, inexpensive, low-power, easy to use and don't wear out. For that
reason they are commonly found in appliances and gadgets used in homes or
businesses.
• They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR
motion" sensors.
• Size: Rectangular
• Output: Digital pulse high (3V) when triggered (motion detected) digital low when
idle (no motion detected). Pulse lengths are determined by resistors and
capacitors on the PCB and differ from sensor to sensor.
• Sensitivity range: up to 20 feet (6 meters) 110° x 70° detection range
Power supply: 5V-12V input voltage for most modules (they have a 3.3V regulator),
but 5V is ideal in case the regulator has different specs.

IT 6th Sem
IU1841220050 Palash Shah

IT 6th Sem
IU1841220050 Palash Shah

Screenshot:

IT 6th Sem
IU1841220050 Palash Shah

Interfacing Temperature Sensor :


• In this post, we will learn how to interface Digital Temperature Sensor (LM35)
with arduino in proteus software .

• In order to display data received from temperature sensor, can use virtual
terminal in proteus window like serial monitor.

• Before going to start the simulation, we should know the basic information about
the temperature sensors.

• The temperature sensor in Arduino converts the surrounding temperature to


voltage. It further converts the voltage to Celsius, , and prints the temperature on
the monitor screen.

Features:
• Minimum and Maximum Input Voltage is 35V and -2V respectively. Typically 5V.

• Can measure temperature ranging from -55°C to 150.C

• Output voltage is directly proportional (Linear) to temperature (i.e.) there will be a


rise of 10mV (0.01V) for every 1°C rise in temperature.

• ±0.5°C Accuracy

• Drain current is less than 60uA

• Low cost temperature sensor

• Small and hence suitable for remote applications

• Available in TO-92, TO-220, TO-CAN and SOIC package

IT 6th Sem
IU1841220050 Palash Shah

Screenshot:

IT 6th Sem
IU1841220050 Palash Shah

IT 6th Sem
IU1841220050 Palash Shah

PRACTICAL-4 : Introduction Of ESP8266

Brief About NodeMCU ESP8266:

1. The NodeMCU ESP8266 development board comes with the ESP- 12E
module containing ESP8266 chip having Tensilica Xtensa 32-bit LX106
RISC microprocessor.

2. This microprocessor supports RTOS and operates at 80MHz to 160 MHz


adjustable clock frequency.

3. NodeMCU has 128 KB RAM and 4MB of Flash memory to store data and
programs.

4. Its high processing power with in-built Wi-Fi / Bluetooth and Deep Sleep
Operating features make it ideal for IoT projects.

IT 6th Sem
IU1841220050 Palash Shah

Pin Name Description


C category
Power Micro-USB, Micro-USB: NodeMCU can be powered through the
3.3V, GND, Vin USB port

3.3V: Regulated 3.3V can be supplied to this pin to


power the board

GND: Ground pins

Vin: External Power Supply


Control Pins EN, RST The pin and the button resets the microcontroller

Analog Pin A0 Used to measure analog voltage in the range of 0-


3.3V
GPIO Pins GPIO1 to NodeMCU has 16 general purpose input-output pins
GPIO16 on its board
SPI Pins SD1, CMD, NodeMCU has four pins available for SPI
SD0, CLK communication.
UART TXD0, RXD0,
NodeMCU has two UART interfaces, UART0 (RXD0
Pins TXD2, & TXD0) and UART1 (RXD1 & TXD1). UART1 is
RXD2 used to upload the firmware/program.
I2C Pins NodeMCU has I2C functionality support but due to
the internal functionality of these pins, you have
to find which pin is I2C.

IT 6th Sem
IU1841220050 Palash Shah

NodeMCU Development Board Pinout Configuration

NodeMCU ESP8266 Specifications & Features:

• Microcontroller: Tensilica 32-bit RISC CPU Xtensa LX106


• Operating Voltage: 3.3V
• Input Voltage: 7-12V
• Digital I/O Pins (DIO): 16
• Analog Input Pins (ADC): 1
• UARTs: 1
• SPIs: 1
• I2Cs: 1
• Flash Memory: 4 MB
• SRAM: 64 KB
• Clock Speed: 80 MHz
• USB-TTL based on CP2102 is included onboard, Enabling Plug n Play
• PCB Antenna

IT 6th Sem
IU1841220050 Palash Shah

Applications of NodeMCU:

• Prototyping of IoT devices


• Low power battery operated applications
• Network projects
• Projects requiring multiple I/O interfaces with Wi-Fi and Bluetooth
functionalities

IT 6th Sem
IU1841220050 Palash Shah

PRACTICAL-5 : ESP8266 As Web Server

One of the greatest features ESP8266 provides is that it cannot


only connect to an existing wifi network and act as a Web
Server, but it can also set up a network of its own, allowing
other devices to connect directly to it and access web pages.

This is possible because ESP8266 can operate in three different


modes: Station mode, Soft Access Point mode, and both at the
same time. This provides possibility of building mesh network.

ESP8266 as HTTP Server using WiFi


As the heading suggests, this example demonstrates how to turn
the ESP8266 into an access point (AP), and serve up web pages to
any connected client. To start with, plug your ESP8266 NodeMCU
into your computer.

Code:-
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

/* Put your SSID & Password */


const char* ssid = "NodeMCU"; // Enter SSID here
const char* password = "12345678"; //Enter Password here

/* Put IP Address details */


IPAddress local_ip(192,168,1,1);
IPAddress gateway(192,168,1,1);
IPAddress subnet(255,255,255,0);

ESP8266WebServer server(80);

uint8_t LED1pin = D7;


bool LED1status = LOW;
IT 6th Sem
IU1841220050 Palash Shah

uint8_t LED2pin = D6;


bool LED2status = LOW;

void setup() { Serial.begin(115200);


pinMode(LED1pin, OUTPUT);
pinMode(LED2pin, OUTPUT);

WiFi.softAP(ssid, password);
WiFi.softAPConfig(local_ip, gateway, subnet); delay(100);

server.on("/", handle_OnConnect); server.on("/led1on",


handle_led1on); server.on("/led1off", handle_led1off);
server.on("/led2on", handle_led2on); server.on("/led2off",
handle_led2off); server.onNotFound(handle_NotFound);

server.begin();
Serial.println("HTTP server started");
}
void loop() { server.handleClient();
if(LED1status)
{digitalWrite(LED1pin, HIGH);} else
{digitalWrite(LED1pin, LOW);}

if(LED2status)
{digitalWrite(LED2pin, HIGH);} else
{digitalWrite(LED2pin, LOW);}
}

void handle_OnConnect() {
LED1status = LOW;
LED2status = LOW;
Serial.println("GPIO7 Status: OFF | GPIO6 Status: OFF");
server.send(200, "text/html", SendHTML(LED1status,LED2status));
}

void handle_led1on() {
LED1status = HIGH;
Serial.println("GPIO7 Status: ON");
server.send(200, "text/html", SendHTML(true,LED2status));
IT 6th Sem
IU1841220050 Palash Shah

void handle_led1off() {
LED1status = LOW;
Serial.println("GPIO7 Status: OFF");
server.send(200, "text/html", SendHTML(false,LED2status));
}

void handle_led2on() {
LED2status = HIGH;
Serial.println("GPIO6 Status: ON");
server.send(200, "text/html", SendHTML(LED1status,true));
}

void handle_led2off() {
LED2status = LOW;
Serial.println("GPIO6 Status: OFF");
server.send(200, "text/html", SendHTML(LED1status,false));
}

void handle_NotFound(){
server.send(404, "text/plain", "Not found");
}

String SendHTML(uint8_t led1stat,uint8_t led2stat){ String ptr =


"<!DOCTYPE html> <html>\n";
ptr +="<head><meta name=\"viewport\" content=\"width=devicewidth, initial-
scale=1.0, user-scalable=no\">\n"; ptr +="<title>LED Control</title>\n";
ptr +="<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto;
text-align: center;}\n";
ptr +="body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;} h3
{color: #444444;margin-bottom: 50px;}\n"; ptr +=".button {display: block;width:
80px;background-color: #1abc9c;border: none;color: white;padding: 13px
30px;textdecoration: none;font-size: 25px;margin: 0px auto 35px;cursor:
pointer;border-radius: 4px;}\n"; ptr +=".button-on {background-color:
#1abc9c;}\n"; ptr +=".button-on:active {background-color: #16a085;}\n"; ptr
+=".button-off {background-color: #34495e;}\n"; ptr +=".button-off:active
{background-color: #2c3e50;}\n"; ptr +="p {font-size: 14px;color:
#888;margin-bottom: 10px;}\n"; ptr +="</style>\n"; ptr +="</head>\n"; ptr

IT 6th Sem
IU1841220050 Palash Shah

+="<body>\n"; ptr +="<h1>ESP8266 Web Server</h1>\n"; ptr +="<h3>Using


Access Point(AP) Mode</h3>\n";

if(led1stat)
{ptr +="<p>LED1 Status: ON</p><a class=\"button button-off\"
href=\"/led1off\">OFF</a>\n";}
else
{ptr +="<p>LED1 Status: OFF</p><a class=\"button button-on\"
href=\"/led1on\">ON</a>\n";}

if(led2stat)
{ptr +="<p>LED2 Status: ON</p><a class=\"button button-off\"
href=\"/led2off\">OFF</a>\n";}
else
{ptr +="<p>LED2 Status: OFF</p><a class=\"button button-on\"
href=\"/led2on\">ON</a>\n";}

ptr +="</body>\n"; ptr


+="</html>\n"; return ptr;
}

IT 6th Sem
IU1841220050 Palash Shah

Now,

Now, click the button to turn LED1 ON while keeping an eye on the URL. Once you click
the button, the ESP8266 receives a request for /led1on URL. It then turns the LED1
ON and serves a web page with status of LED updated. It also prints the status of
GPIO pin on the serial monitor.

IT 6th Sem
IU1841220050 Palash Shah

PRACTICAL-6 : Intro To IoT Protocol’s MQTT And


Adafruit Broker Platform.
What is MQTT?
Message Queuing Telemetry Transport (MQTT) is a communication
protocol widely used in both IoT and IoT deployments. MQTT is a
publish-subscribe protocol that facilitates one-to-many
communication mediated by brokers. Clients can publish messages
to a broker and/or subscribe to a broker to receive certain
messages. Messages are organized by topics, which essentially are
“labels” that act as a system for dispatching messages to
subscribers.

The following table compares different features and shows the strengths and
debilities of each protocol:

IT 6th Sem
IU1841220050 Palash Shah

What is Adafruit broker platform?

Adafruit IO is a system that makes data useful. Our focus is on ease of use, and
allowing simple data connections with little programming required. IO includes
client libraries that wrap our REST and MQTT APIs. IO is built on Ruby on Rails,
and Node.

IT 6th Sem
IU1841220050 Palash Shah

What is adafruit used for ?

Adafruit IO is an easy-to-use IoT platform that is useful for storing data, viewing
data, and controlling devices.

IoT developers prefer Adafruit IO over other IoT cloud providers


for the following reasons:

•Powerful API - Provides us libraries for various programming


languages, which also provides the built-in user interface
support.
• Dashboard - Understanding data via charts and graphs enables

us to make better decisions.


• Privacy - Data is secured in the cloud platform with better

encryption algorithms.
• Documentation & Community - Many blogs with amazing
community support allows continuous developments of the
products.

IT 6th Sem

You might also like