Devansh IOT Exp 1-Merged
Devansh IOT Exp 1-Merged
Devansh IOT Exp 1-Merged
EXPERIMENT-1
THEORY: Internet of Things (IoT) is a network of physical objects or people called "things “that are embedded
with software, electronics, network, and sensors that allows these objects to collect and exchange data. The
thing in IoT can also be a person with a diabetes monitor implant, an animal with tracking devices, etc.
Components of IOT:
1) Sensors/Devices: Sensors or devices are a key component that helps you to collective data from the
surrounding environment. A device may have various types of sensors which performs multiple tasks apart from
sensing. Example, A mobile phone is a device which has multiple sensors like GPS, camera but your
smartphone is notable to sense these things.
2) Connectivity: All the collected data is sent to a cloud infrastructure. The sensors should be connected to
the cloud using various mediums of communications. These communication mediums include mobile or
satellite networks, Bluetooth, WI-FI,WAN, etc.
3) Data Processing: Once that data is collected, and it gets to the cloud, the software performs processing on
the gathered data. This process can be just checking the temperature, reading on devices like AC or heaters.
However, it can sometimes also be very complex like identifying objects, using computer vision on video.
4) User Interface: The information needs to be available to the end-user in some way which can be achieved
by triggering alarms on their phones or sending them notification through email or text message. The
user sometimes might need an interface which actively checks their IoT system. For example, the user has a
camera installed in his home. He wants to access video recording and all the feeds with the help of a web
server.
5) Depending on the IoT application and complexity of the system, the user may also be able to perform an
action which may create cascading effects.
6) For example, if a user detects any changes in the temperature of the refrigerator, with the help of IoT
technology the user should able to adjust the temperature with the help of their mobile phone.
Devansh Goyal (20EEAEC012)
Features of IOT
The most important features of IoT on which it works are connectivity, analyzing, integrating, active
engagement, and many more. Some of them are listed below: Connectivity: Connectivity refers to establish a
proper connection between all the things of IoT to IoT platform it may be server or cloud. After connecting the
IoT devices, it needs a high speed messaging between the devices and cloud to enable reliable, secure
and bi-directional communication.
Analyzing: After connecting all the relevant things, it comes to real-time analyzing the data collected and use
them to build effective business intelligence. If we have a good insight into data gathered from all these
things, then we call our system has a smart system.
Integrating: IoT integrating the various models to improve the user experience as well.
Artificial Intelligence: IoT makes things smart and enhances life through the use of data. For example, if we
have a coffee machine whose beans have going to end, then the coffee machine itself order the coffee
beans of your choice from the retailer.
Sensing: The sensor devices used in IoT technologies detect and measure any change in the environment and
report on their status. IoT technology brings passive networks to active networks. Without sensors, there could
not hold an effective or true IoT environment.
Active Engagement: IoT makes the connected technology, product, or services to active engagement between
each other.
Endpoint Management: It is important to be the endpoint management of all the IoT system otherwise, it
makes the complete failure of the system. For example, if a coffee machine itself order the coffee beans when
it goes to end but what happens when it orders the beans from retailer and we are not present at home for a
few days, it leads to the failure of the IoT system. So, there must be a need for endpoint management.
IoT Protocols
Devansh Goyal (20EEAEC012)
CoAP is an internet utility protocol for constrained gadgets. It is designed to enable simple, constrained devices
to join IoT through constrained networks having low bandwidth availability. This protocol is primarily used for
machine-to-machine (M2M) communication and is particularly designed for IoT systems that are based on
HTTP protocols.
CoAP makes use of the UDP protocol for lightweight implementation. It also uses restful architecture, which
is just like the HTTP protocol. It makes use of dtls for the cozy switch of statistics within the slipping layer.
MQTT (Message Queue Telemetry Transport) is a messaging protocol developed with the aid of Andy
Stanford-Clark of IBM and Arlen Nipper of Arcom in 1999 and is designed for M2M communication.
It‘s normally used for faraway tracking in IoT. Its primary challenge is to gather statistics from many gadgets
and delivery of its infrastructure. MQTT connects gadgets and networks with packages and middleware. All the
devices hook up with facts concentrator servers like IBM‘s new message sight appliance. MQTT protocols
paintings on top of TCP to offer easy and dependable streams of information. These IoT protocols include 3
foremost additives: subscriber, publisher, and dealer. The writer generates the information and transmits the
facts to subscribers through the dealer. The dealer guarantees safety by means of move-checking the
authorization of publishers and subscribers.
Devansh Goyal (20EEAEC012)
This was evolved by John O‘Hara at JP Morgan Chase in London. AMQP is a software layer protocol for
message-oriented middleware environment. It supports reliable verbal exchange through message transport
warranty primitives like at-most-once, at least once and exactly as soon as shipping. The AMQP – IoT
protocols consist of hard and fast components that route and save messages within a broker carrier, with a set
of policies for wiring the components together. The AMQP protocol enables patron programs to talk to the
dealer and engage with the AMQP m odel .This version has the following three additives, which might link
into processing chains in the server to create the favoured capabilities.
Exchange: Receives messages from publisher primarily based programs and routes them to ‗message
queues‘.
Message Queue: Stores messages until they may thoroughly process via the eating client software.
Binding: States the connection between the message queue and the change.
It enables a scalable, real-time, reliable, excessive-overall performance and interoperable statistics change
via the submit-subscribe technique. DDS makes use of multicasting to convey high-quality QoS to
applications.
DDS is deployed in platforms ranging from low-footprint devices to the cloud and supports green bandwidth
usage in addition to the agile orchestration of system additives. The DDS – IoT protocols have fundamental
layers: facts centric submit-subscribe (dcps) and statistics-local reconstruction layer (dlrl).
Dcps plays the task of handing over the facts to subscribers, and the dlrl layer presents an interface to dcps
functionalities, permitting the sharing of distributed data amongst IoT enabled objects.
Devansh Goyal (20EEAEC012)
I. Thing
Thing‖ in IOT is the asset that you want to control or monitor or measure, that is, observe closely. In many
IoT products, the ―thing‖ gets fully incorporated into a smart device. For example, think of products like a
smart refrigerator or an automatic vehicle. These products control and monitor themselves. There are
sometimes many other applications where the thing stands as an alone device, and a separate product is
connected to ensure it possesses smart capabilities.
IoT Sensors
The most important IoT hardware might be its sensors. These devices consist of a variety of modules such as
energy modules, RF modules, power management modules, and sensing modules.
Basic Devices
The day to day devices that we use such as desktop, cell phones and tablets remain integral parts of IoT
system.
The desktop provides the user with a very high level of control over the system and its settings.
The tablet acts as a remote and provides access to the key features of the system.
Cell phone allows remote functionality and some essential settings modification other key connected devices
include standard network devices like routers and switches.
IoT Software
Embedded systems have less storage and processing power, their language needs are different. The
most commonly used operating systems for such embedded systems are Linux or UNIX-like OSs like Ubuntu
Core or Android.
IoT software encompasses a wide range of software and programming languages from general-purpose
languages like C++ and Java to embedded-specific choices like Google‘s Go language or Parasail.
Few IoT Software’s are-
C & C++: The C programming language has its roots in embedded systems—it even got its start for
programming telephone switches. It‘s pretty ubiquitous, that is, it can be used almost everywhere and many
programmers already know it. C++ is the object-oriented version of C, which is a language popular for both
the Linux OS and Arduino embedded IoT software systems. These languages were basically written for the
hardware systems which makes them so easy to use.
Java: While C and C++ are hardware specific, the code in JAVA is more portable. It is more like a write
once and read anywhere language, where you install libraries, invests time in writing codes once and you are
good to go.
Python: There has been a recent surge in the number of python users and has now become one of the ―go-
to‖ languages in Web development. Its use is slowly spreading to the embedded control and IoT world—
specially the Raspberry Pi processor. Python is an Interpreted language, which is, easy to read, quick to learn
and quick to write. Also, it‘s a powerhouse for serving data-heavy applications.
Unlike most of the languages mentioned so far, it was specifically designed for embedded systems, it‘s
small and compact and has less memory size.
Data Collection: It is used for data filtering, data security, sensing, and measurement. The protocols aid in
decision making by sensing form real-time objects. It can work both ways by collecting data from devices
or distributing data to devices. All the data transmits to a central server.
Devansh Goyal (20EEAEC012)
Device Integration: This software ensures that devices bind and connect to networks facilitating information
sharing. A stable cooperation and communication ensure between multiple devices.
Real-Time Analytics: In this, the input from users serves as potential data for carrying out real-time analysis,
making insights, suggesting recommendations to solve organizations problems and improve its approach. This,
as a result, allows automation and increased productivity.
Application and Process Extension: These applications extend the reach of existing systems and software to
allow a wider, more effective system. They integrate pre-defined devices for specific purposes such as
allowing certain mobile devices or engineering instruments access. It supports improved productivity and
more accurate data collection
RESULT
We have studied the fundamentals of IOT software’s and components. Internet of Things can create
information about the connected objects, analyze it, and make decisions. All IoT applications are using
sensors to detect and collect data that are used to give a proper decision that maintains a high level of security
of the installations.
Devansh Goyal (20EEAEC012)
EXPERIMENT-
The process will extract and install all the required files to execute properly the Arduino Software (IDE)
Proceed with board specific instructions
When the Arduino Software (IDE) is properly installed we can go back to the different Arduino Boards:
Arduino Uno: This is the latest revision of the basic Arduino USB board. It connects to the computer
with a standard USB cable and contains everything else you need to program and use the board.
Arduino NG: REV-C Revision C of the Arduino NG does not have a built-in LED on pin 13 - instead
you'll see two small unused solder pads near the labels "GND" and "13".
Arduino Bluetooth: The Arduino BT is a microcontroller board originally was based on the ATmega168,
but now is supplied with the 328, and the Blue-giga WT11 blue- tooth module. It supports wireless serial
communication over Blue-tooth.
Arduino Mega: The original Arduino Mega has an ATmega1280 and an FTDI USB- to serial chip.
Arduino NANO: The Arduino Nano 3.0 has an ATmega328 and a two-layer PCB. The power LED
moved to the top of the board.
teachers, it's conveniently based on the Processing programming environment, so students learning to
program in that environment will be familiar with how the Arduino IDE works. Open source and
extensible software - The Arduino software published as open source tools, available for extension by
experienced programmers. The language can be expanded through C++ libraries, and people wanting to
understand the technical details can make leap from Arduino to the AVR C programming language on
which it's based. Similarly, you can add AVR-C code directly into your Arduino programs if u want to.
Open source and extensible hardware - The plans of the Arduino boards are published under a
Creative Commons license, so experienced circuit designers can make their own version of the module,
extending it and improving it. Even relatively inexperienced users can build the breadboard version of
the module in order to understand how it works and save money.
Raspberry Pi Introduction
Raspberry Pi is a small single board computer. By connecting peripherals like Keyboard, mouse, display
to the Raspberry Pi, it will act as a mini personal computer. Raspberry Pi is popularly used for real
time Image/Video Processing, IoT based applications and Robotics applications.
Raspberry Pi is slower than laptop or desktop but is still a computer which can provide all the expected
features or abilities, at a low power consumption.
Raspberry Pi Foundation officially provides Debian based Raspbian OS. Also, they provide NOOBS OS
for Raspberry Pi. We can install several Third-Party versions of OS like Ubuntu, Archlinux, RISC OS,
Windows 10 IOT Core, etc.
Raspbian OS is official Operating System available for free to use. This OS is efficiently optimized to
use with Raspberry Pi. Raspbian have GUI which includes tools for Browsing, Python programming,
office, games, etc.
It has ARM based Broadcom Processor SoC along with on-chip GPU (Graphics
Processing Unit). The CPU speed of Raspberry Pi varies from 700 MHz to 1.2 GHz. Also, it has
onboard SDRAM that ranges from 256 MB to 1 GB. Raspberry Pi also provides on-chip SPI, I2C, I2S
and UART modules.
1. Raspberry Pi 1 Model A
2. Raspberry Pi 1 Model A+
3. Raspberry Pi 1 Model B
4. Raspberry Pi 1 Model B+
Devansh Goyal (20EEAEC012)
5. Raspberry Pi 2 Model B
6. Raspberry Pi 3 Model B
7. Raspberry Pi Zero
RASPERRY PI HARDWARE:
HDMI Cable
But, if we have a computer monitor (VGA Display), then we need an HDMI to VGA converter along with
a VGA cable for connecting Raspberry Pi with monitors. HDMI to VGA converter and VGA cable is
shown below.
Now, connect the Raspberry Pi to the Display/monitor and Power-On Raspberry Pi. We will get a Black
command window asking for Login and Password as shown below.
On display, there is a symbol of raspberry to the top-left corner of display. After clicking on it, we will
get menu as shown below,
As we can see, the Raspbian OS has installed Python 2 & 3. It also has different programming IDE like
Geany, BlueJ Java IDE, etc. As raspberry pi 3 has On-chip WiFi, we can connect it to the network and
will get access over Internet.
We can also change password of ―Pi‖ user.
To change password, click on preferences and then select Raspberry Pi Configuration which will
provide a pop-up window.
After writing the code, open terminal (ctrl+alt+t) to execute it. Then, type following commands for
compiling and execution.
RESULT:
In this experiment, we have discussed about the Arduino fundamentals and its necessary software
installation. Thus, Arduino simplifies the process of working with microcontrollers, Arduino is an open
source micro-controller which can be used as a development board for hundreds and thousands of
project. we can program the Arduino board with the help of Arduino IDE and the programming is based
on
C/C++. We have also understood the basic concepts of raspberry pi and its configuration details.
Through this knowledge, we will be able to work upon this platform easily.
Devansh Goyal (20EEAEC012)
EXPERIMENT-
OBJECTIVE: To Interface LED /BUZZER with Arduino /Raspberry Pi and write a program to turn ON
LED for 1 Sec after every 2 seconds.
THEORY: Tinker-cad is a browser-based 3D design and modeling program created to provide a way
for a variety of users to create projects. In this software, we will interface LED with Arduino. Firstly
identify anode (+ve) & cathode (-ve) leg of LED.
Digital Write(LED, HIGH); will turn the LED ON. Now we need to keep the LED ON for 1 second.
We do so by keeping the micro controller idle (or we make it to wait) for 1 second. delay(1000); is the
function we use to keep the micro controller idle for 1 second. After 1 second, we need to turn LED
OFF.
We do so with instruction digital Write(LED, LOW); this will turn LED OFF. Now we need to keep
the LED in its OFF state for 2 second (before it is turned ON again). To do so we write a delay(2000);
instruction once again just below the instruction to turn LED OFF.
Since this is the last statement inside loop() function of our program; the micro controller will begin
executing from beginning statement inside loop() after waiting 2 second to keep LED OFF. So the LED
is ON again after 1 second.
CIRCUIT DIAGRAM:
CODE:
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
digitalWrite(LED_BUILTIN, HIGH); delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(LED_BUILTIN, LOW); delay(1000); // Wait for 1000 millisecond(s) }
Devansh Goyal (20EEAEC012)
Observations: We have interfaced the led with Arduino Uno and observe the simulation result.
RESULT:
LED is interfaced with Arduino uno with ON time delay of 1 second and OFF time delay of 2 seconds.
Thus, we have performed the experiment of led interfacing with Arduino and to turn ON for 1 sec after
every 2 seconds.
Devansh Goyal (20EEAEC012)
EXPERIMAENT-
THEORY: CODE
void setup()
{
Serial.begin(9600); pinMode(2,INPUT); pinMode(13,OUTPUT);
}
void loop()
{ if(digitalRead(2) == 1)
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
}
OBSERVATION:
Devansh Goyal (20EEAEC012)
RESULT:
We have verified that LED is glowing when pushbutton interfaced with Arduino is pressed. Pushbutton
interfacing with Arduino is done and diode is turning ON when it is pressed.
Devansh Goyal (20EEAEC012)
EXPERIMENT-
OBJECTIVE: To interface motor using relay with Arduino/Raspberry Pi and write a program to turn
ON motor when Push-button is pressed.
RESOURCE REQUIRED: Tinkercad
THEORY:
CODE:
const int buttonPin = 12; const int transistorPin = 7; int buttonState = 0; void setup()
{ pinMode(buttonPin, INPUT_PULLUP); pinMode transistorPin, OUTPUT);
}
void loop()
{ buttonState = digitalRead(buttonPin); if (buttonState == LOW)
{ digitalWrite (transistorPin, HIGH);
}
else
{
digitalWrite (transistorPin, LOW);
}
}
We can control high voltage electronic devices using relays. A Relay is actually a switch which is
electrically operated by an electromagnet.
The intention behind the project is to explain how a microcontroller (in this case, an Arduino) can be
used to control a high voltage and high current devices using a relay. When the system is powered on,
the Arduino waits for the button to be pressed (as per the code written). The button terminal is pulled up
internally. Hence, when the button is pushed, the Arduino detects Logic 0 (LOW). This will send a
Logic 1 (HIGH) signal to Pin 7, which is connected to the base of the transistor. As a result, the
transistor is switched ON. As one of the coil terminals of the relay is connected to the collector of the
transistor (which is switched ON), a conduction path between the supply, coil and collector – emitter
terminals of transistor is formed. Because of this, the coil in the relay gets energized and acts as an
electromagnet. As a result, the moving contact of the coil, which was initially in the Normally Closed
(NC) position, will be attracted towards the electromagnet and moves to the Normally Open (NO)
position. This action will complete the motor circuit and hence, the motor starts rotating. The motor
keeps on rotating as long as the button is pushed. Once the button is released, the transistor is switched
OFF and the coil in the relay is de energized. Hence, the contact goes back to the Normally Closed
position and the motor is turned OFF.
Devansh Goyal (20EEAEC012)
CIRCUIT DIAGRAM
OBSERVATIONS:
When pushbutton is pressed, then the motor rotates due to amount of current provided required to turn on
relay by the pushbutton.
RESULT:
Continuous motor operation with a momentary start switch is possible if a normally- open―seal-in‖
contact from the contactor is connected in parallel with the start switch so that once the contactor is
energized it maintains power to itself and keeps itself latched on. Time delay relays are commonly used
in large motor control circuits to prevent the motor from being started (or reversed) until a certain
amount of time has elapsed from an event.
Devansh Goyal (20EEAEC012)
EXPERIMENT-
OBJECTIVE: To Interface DHT11 sensor with Arduino /Raspberry Pi and write a program to print
temperature and humidity readings.
RESOURCE REQUIRED: Arduino IDE, Arduino Uno, jumper wires, breadboard, and DHT sensor.
THEORY: DHT11 sensor is used to measure the temperature and humidity. It has a resistive humidity
sensing component and a negative temperature coefficient (NTC). An 8-bit MCU is also connected in it
which is responsible for its fast response. It is very inexpensive but it gives values of both temperature
and humidity at a time. First of all connect the ground and the VCC of the DHT11 temperature and
humidity sensor to the ground and 5v of the Arduino. Then connect the data pin of the DHT11 sensor to
the pin 2 of the Arduino. To run the following code in Arduino IDE you will first have to install the
DHT library in you Arduino directory.
Download the zip file and place it in your Arduino library folder.
The path to Arduino library folder for my computer is Documents/ Arduino/ Libraries Unzip the
downloaded file and place it in this folder.
After copying the files, the Arduino library folder should have a new folder named DHT containing the
dht.h and dht.cpp. After that copy the following code in the Arduino IDE and upload the code.
ARDUINO CODE:
#include <DHT.h>
#define DHTPIN 6 // The data pin of DHT11/DHT22 should be connected to the digtal pin 9 of Arduino.
#define DHTTYPE DHT22 DHT dht ( DHTPIN, DHTTYPE ) ;
char val; void setup ( ) { // Void setup is the function which technically created at the top of the program.
It is used to initialize variables, pin modes, start using libraries, etc. Serial.begin ( 9600 ) ; dht.begin ( ) ;
} void loop ( ) { // The loop is ran again and again and consists the main code.
float humidity = dht.readHumidity ( ) ; float Temprature = dht.readTemperature ( ) ; if ( isnan (
Temprature ) || isnan ( humidity ) ) { Serial.println ( " Sensor is not avaliable right now " ) ; } else
{
Serial.print ( " Temprature is " ) ; Serial.print ( Temprature ) ; Serial.println ( " *C " ) ; delay(2000);
Serial.print ( " Humidity in % is : " ) ; Serial.print ( humidity ) ;
Serial.print ( " % \t " ) ;
}
Devansh Goyal (20EEAEC012)
Observations: We have interfaced the led with Arduino Uno and observe the simulation result.
RESULT:
We have performed the experiment of DHT11 sensor interfacing with Arduino and verified the correct
result It displays the ambient temperature and humidity readings on serial monitor of Arduino IDE.