Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

IOT Practicals

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

IOT 210090107091

0
IOT 210090107091

Practical:1.
● Explain Arduino, Arduino Pin Diagram, Arduino Architecture and Arduino IDE.

● Arduino : Arduino is a microcontroller. It can be programmed to control how electronic parts like
buttons, motors, lights, and switches work together. Arduino is an open-source electronics platform that
uses easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger
on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED,
publishing something online.
➢ An Arduino is actually a microcontroller-based kit which can beeither used directly by
purchasing from the vendor or can be made at home using the components, owing to its open
sourcehardware feature.

Fig.1.1Pin Diagram of Arduino UNO


Reference :
https://www.javatpoint.com

1
IOT 210090107091

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

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.

2
IOT 210090107091

● Arduino Architecture :

Fig.1.2 Architecture of Arduino UNO


Reference :
https://www.raviydb.tech

● Hardware Architecture:-
The input and output (I/O) components of the Arduino hardware design typically include a
microcontroller board. Although subsequent boards might use various microcontrollers, the ATmega328P
and ATmega2560 are the most popular Atmel AVR-based Arduino boards.

The main components of an Arduino board include:


1. Microcontroller:
The Arduino board's microcontroller is its beating heart. It is in charge of running the program and
managing the input/output procedures. The processing speed, memory, and I/O capabilities of the
Arduino board depend on the microcontroller selected.

3
IOT 210090107091

2.USB B Type port :


An Arduino board's USB B Type port is a rectangular connector. It is utilized to link the Arduino to other
electronics or computers. The Arduino can receive power and data via this port. It is frequently employed
to communicate data between the Arduino board and a computer and to program the Arduino. Because
the USB B Type connector is dependable and standardized, several USB cables will work with it. Older
Arduino models frequently include them, although more recent ones might have USB C Type connectors.

3. Analog Input Pins:


A number of analog input pins on Arduino boards allow users to read analog signals from sensors and
other analog devices. These pins use an analog-to-digital converter (ADC) to turn the analog input into a
digital value.

4. Power Pins:
Ground (GND), 5V, and 3.3V are among the several power pins that Arduino boards generally offer.
Power is provided to the board and external components using these pins.

5. ATmega16U2:
It is a typical microcontroller chip for Arduino boards. It acts as a USB-to-serial converter, enabling the
Arduino board to talk to a computer via the USB interface. The ATmega16U2 serves as a link between
the computer and the ATmega328P, which is the primary microcontroller on the Arduino board. It
manages USB communication protocols and transforms the computer's serial data into a form that the
main microcontroller can interpret. As a result, the Arduino may be programmed and data can be
transferred through USB from the board to the PC.

6. Other Components:

The Arduino board has other parts to help it function, including crystal oscillators, voltage regulators, and
capacitors.

4
IOT 210090107091

● Software Architecture:

The Arduino Integrated Development Environment (IDE), which offers a user-friendly interface for
creating, compiling, and uploading code to the Arduino board, serves as the foundation for the Arduino
software architecture. On top of the free and open-source Processing development environment, the
Arduino IDE is constructed.

A condensed version of C++, the Arduino programming language is simple to learn even for newcomers.
It has built-in libraries that offer pre-written routines for typical operations including managing digital
and analog I/O, corresponding over a variety of protocols (such UART, I2C, and SPI), and utilizing timers
and interrupts.

● Arduino IDE :
The Arduino IDE is an open-source software, which is used to write and upload code to the Arduino
boards. The IDE application is suitable for different operating systems such as Windows, Mac OS X, and
Linux.

It supports the programming languages C and C++. Here, IDE stands for Integrated Development
Environment. The program or code written in the Arduino IDE is often called sketching.

We need to connect the Genuino and Arduino board with the IDE to upload the sketch written in the
Arduino IDE software. The sketch is saved with the extension '.ino.'

5
IOT 210090107091

Reference :
https://www.javatpoint.com
www.makerspace.com

6
IOT 210090107091

Practical:2
● Blink LED with Arduino.

Component:
Arduino-UNO
Yellow LED
Cable

Code:

void setup() {

7
IOT 210090107091

pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(3000);
digitalWrite(LED_BUILTIN, LOW);
delay(3000);
}

8
IOT 210090107091

Practical:3
● Perform Experiment using Arduino to measure the distance of any object using
Ultrasonic Sensor.

Component:
U1: Arduino Uno R3
PIEZO: Piezo
DIST1: Ultrasonic Distance Sensor (4-pin)
R1: 1 kΩ Resistor

Diagram:

9
IOT 210090107091

Code:
// C++ code
//
const int buzzer = 8;

int echopin = 6;
int trigpin =7;

int mesafe;
int sure;

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

pinMode(buzzer, OUTPUT);
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);
}
voidloop()
{
digitalWrite(trigpin,LOW);
delayMicroseconds(2);
digitalWrite(trigpin,HIGH);
delayMicroseconds(2);
digitalWrite(trigpin,LOW);
sure=pulseIn(echopin,HIGH);
mesafe=(sure/2)/29.0;

if(mesafe<=15)
{
digitalWrite(buzzer,HIGH);
delay(250);
digitalWrite(buzzer,LOW);
delay(125);
}

10
IOT 210090107091

elseif(mesafe<=20)
{
digitalWrite(buzzer,HIGH);
delay(500);
digitalWrite(buzzer,LOW);
delay(250);
}
elseif(mesafe<=30)
{
digitalWrite(buzzer,HIGH);
delay(1000);
digitalWrite(buzzer,LOW);
delay(1000);
}
else
{
digitalWrite(buzzer,LOW);
}
Serial.print("Distance = ");
Serial.print(mesafe);
Serial.println("cm");
delay(5000);
}

Output:

11
IOT 210090107091

Practical:4
● Interfacing the DHT11 Sensor with Arduino Sensor kit and Write a Program to
Print Temperature and Humidity reading.

Component:
Arduino Sensor kit:
U1:Arduino UNO R3
TH:Temperature Sensor [TMP36]
R1:250 kΩ potentiometer

Diagram:

12
IOT 210090107091

Code:
#include "Arduino_SensorKit.h"
void setup() {
Serial.begin(9600);
Environment.begin();
}
void loop() {
Serial.print("Temperature = ");
Serial.print(Environment.readTemperature());
Serial.println(" C");
Serial.print("Humidity = ");
Serial.print(Environment.readHumidity());
Serial.println(" %");
delay(2000);
}
Output:

13
IOT 210090107091

Practical:5
● Interfacing the Heartbeat Sensor with Arduino.

Component:

● Arduino UNO
● Heartbeat sensor
● Breadboard
● Jumper wires

Diagram:

14
IOT 210090107091

Code:

int PulseSensorPurplePin = 0;
int LED = 13;
int WHITE=2;
int Signal;
int Threshold = 500;
void setup() {
pinMode(LED,OUTPUT);
Serial.begin(9600);
}
void loop() {
Signal = analogRead(PulseSensorPurplePin);
Serial.println(Signal);
if(Signal > Threshold){
digitalWrite(LED,HIGH);
}
else {
digitalWrite(WHITE,HIGH);
}
delay(1000);
}
Output:

15
IOT 210090107091

Practical:6

● Interfacing the LDR Sensor with Arduino.

Component:

● Arduino UNO
● LDR sensor
● Breadboard
● Jumper wires

Diagram:

16
IOT 210090107091

Code:

#define AO_PIN A0

int ledPin = 13;

void setup() {

Serial.begin(9600);

void loop() {

int ldr = analogRead(AO_PIN);

Serial.println(ldr);

delay(1000);

}
Output:

17
IOT 210090107091

Practical:7

● Interfacing the Potentiometer with Arduino Sensor Kit and write a program to print

variable resistor readings.

Component:
Arduino Sensor kit:
U1:Arduino UNO R3
TH:Potentionmeter Sensor []

Diagram:

18
IOT 210090107091

Code:

int potentiometer = A0;

void setup()

Serial.begin(9600);

pinMode(potentiometer, INPUT);

void loop()

int sensor_value = analogRead(potentiometer);

int value = map(sensor_value, 0, 1023, 0, 100);

Serial.print("Potentiometer value: ");

Serial.println(value);

delay(500);

19
IOT 210090107091

Practical:8

● Interfacing the Barometer Sensor (BMP280) with Arduino Sensor Kit and writing a program to print
temperature and atmospheric pressure.

Component:
Arduino Sensor kit:
U1:Arduino UNO R3
TH:Barometer Sensor [BMP280]

Diagram:

20
IOT 210090107091

Code:

#include "Arduino_SensorKit.h"

float pressure;

void setup()

Serial.begin(9600);

Pressure.begin();

void loop()

Serial.print("Temp: ");

Serial.print(Pressure.readTemperature());

Serial.println("C");

Serial.print("Pressure: ");

Serial.print(Pressure.readPressure());

Serial.println("Pa");

21
IOT 210090107091

Serial.print("Altitude: ");

Serial.print(Pressure.readAltitude());

Serial.println("m");

Serial.println("\n");

delay(1000);

}
Output:

22
IOT 210090107091

Practical:9

● Demonstration of Setup & Working of Raspberry Pi.

• Insert your microSD card into the USB card reader.

• Connect the card reader to your computer.

• Download SD Formatter 5.0.1.

• Double-click on Install SD Card Formatter 5.0.1.mpkg in your downloads folder in your Dock to
install SD Formatter5.0.
• Follow the instructions in the installation window.

• Click the Launchpad icon in your Dock. It looks like a silverrocket ship.

• Find the SD Formatter 5.0.1 app.

• To move between Launchpad windows, click the Next Pageicons at the bottom center of the
screen, or swipe to the right or left with your trackpad or Magic Mouse.
• Click on the SD Formatter 5.0.1 app to open it. A formattingwindow will appear on your desktop. •
Under Select Card select your microSD card from thedropdown menu.
• Click Format in the bottom right corner.

• Download the ZIP file of NOOBS Version 3.3.1. It is a largefile and will take a while to complete.
You will want Raspbian, so do not download NOOBS Lite.
• Double-click on the NOOBS file from the Downloads folderin your Dock to open it. •
Select the first file inside the NOOBS folder.
• Scroll down and Shift + left-click on the last file in theNOOBS folder.

23
IOT 210090107091

• Drag and drop all selected NOOBS files into the SD card iconon your desktop. You don't have to
open the SD card drive.
• Right-click on the SD card icon.

• Select "Eject [SD Card Name]".

• Remove the card reader from your computer.

• Remove the microSD card from the card reader.

• Now that NOOBS is loaded onto your microSD card, you'reready to set up your Raspberry Pi. •

Insert the microSD card into the card slot on the undersideof the Raspberry Pi. • Plug the USB
keyboard into one of the USB ports.
• Plug the USB mouse into one of the USB ports

• Alternatively, connect the Bluetooth adapter into one ofthe USB ports.

• Turn on your monitor or TV set and make sure it is set tothe proper input (e.g. HDMI 1 or
Component)

24
IOT 210090107091

• Plug the HDMI or video component cable into the monitoror TV set. •
Connect the other end of the cable into the Raspberry Pi.
• Connect an ethernet cable to your router if you plan toconnect to the Internet. •
Connect the other end of the cable to your Raspberry Pi.

• Alternately, connect the Wi-Fi adapter to the Raspberry Pi.

• Connect the power supply to the Raspberry Pi.

• Plug the power supply into the power outlet. This will turnon and boot up Raspberry Pi.
A power indicator light will begin to glow, letting you know that you are connected.

25
IOT 210090107091

Practical:10

● Connect Raspberry Pi with your existing system components.

• USB ports — these are used to connect a mouse and keyboard. You can also connect other
components, such as a USB drive.
• SD card slot — you can slot the SD card in here. This is where the operating system software and
your files are stored.
• Ethernet port — this is used to connect Raspberry Pi to a network with a cable. Raspberry Pi
can also connect to anetwork via wireless LAN.
• Audio jack — you can connect headphones or speakers here.

• HDMI port — this is where you connect the monitor (or projector) that you are using to display
the output from theRaspberry Pi. If your monitor has speakers, you can also use them to hear
sound.
• Micro USB power connector — this is where you connect a power supply. You should always
do this last, after you haveconnected all your other components.
• GPIO ports — these allow you to connect electronic components such as LEDs and buttons to
Raspberry Pi.

26
IOT 210090107091

27

You might also like