0% found this document useful (0 votes)
103 views45 pages

Final IOT Labmaual SMP-DTE

Uploaded by

Name Name
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)
103 views45 pages

Final IOT Labmaual SMP-DTE

Uploaded by

Name Name
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/ 45

A Laboratory Manual for

Internet of Things
(3171108)
B.E. Semester 7
(Electrical Engineering)

Directorate of Technical Education, Gandhinagar,


Gujarat
L.D. College of Engineering
Certificate

This is to certify that Mr. / Ms. _____________________________________ Enrollment

No. __________________________ of B.E. Semester 7th Electrical Engineering of this

Institute (GTU Code:028 ) has satisfactorily completed the Practical for the subject

Internet of Things (3171108) for the academic year ___________________.

Place: _____________________

Date: _________________

Name and Sign of Faculty member:

Head of Department
Preface
Main motto of any laboratory/practical/field work is to enhance required skills as well as to create ability

amongst students to solve any real time problem by developing relevant competencies in psychomotor

domain. To fulfil these requirements, competency focused outcome-based curriculum is designed for

engineering degree programs where sufficient weightage is given to the practical work.

Each experiment in the laboratory manual is keenly designed to serve as a tool to develop and

enhance relevant competency required by various industries among every student. Each experiment is

mapped with Course Outcome which in turn will help satisfying each Course Outcome and to achieve

certain level of attainment. The experiment covers the fundamental theory to understand and perform the

experiment, followed by an apparatus required to perform the experiment. The step-by-step procedure is

described to help students in setting-up and configuring the experimental test bench for performance.

Necessary tables for observations, plots, figures and conclusion are kept in flow with required guidelines.

The necessary precautionary measures for safety are also mentioned.

The laboratory manual also provides the guidelines for the subject faculty member to facilitate

student centric laboratory activities through each experiment by arranging and managing necessary

resources. The evaluation rubrics are well-defined and have been given a certain Weightage for fair

assessment.

The Internet of Things (IoT) course deals with the numbers of devices connected together using

Internet to interact with each other and to exchange certain data of current status of activities to monitor and

control the devices remotely using Website or Mobile Applications over Internet. IoT makes devices smarter

to work automatically as well as to be controlled remotely which makes functionalities quite efficient. IoT

is a combination of sensors, actuators, networking hardware and software which are connected to each other

and communication through the Internet.


Pre-Requisite
Industry Relevant Skills

The following industry relevant competencies are expected to be developed in the student by undertaking the
practical work of this laboratory.
1. Installing and using various softwares used in industries.
2. To get familiar with variety of hardware used in industries.
3. To interface hardware and software to develop various applications.
4. To develop variety of operating and controlling applications using hardware and software.
5. To gain skills of troubleshooting the hardware, software and interfacing parts.

Guidelines for Faculty members


1. Teacher should provide the guideline with demonstration of practical to the students with all features.
2. Teacher shall explain basic concepts/theory related to the experiment to the students before starting of
each practical
3. Involve all the students in performance of each experiment.
4. Teacher is expected to share the skills and competencies to be developed in the students and ensure that
the respective skills and competencies are developed in the students after the completion of the
experimentation.
5. Teachers should give opportunity to students for hands-on experience after the demonstration.
6. Teacher may provide additional knowledge and skills to the students even though not covered in the
manual but are expected from the students by concerned industry.
7. Give practical assignment and assess the performance of students based on task assigned to check whether
it is as per the instructions or not.
8. Teacher is expected to refer complete curriculum of the course and follow the guidelines for
implementation.

Instructions for Students


1. Students are expected to carefully listen to all the theory classes delivered by the faculty members and
understand the COs, content of the course, teaching and examination scheme, skill set to be developed
etc.
2. Students shall organize the work in the group and make record of all observations.
3. Students shall develop maintenance skill as expected by industries.
4. Student shall attempt to develop related hand-on skills and build confidence.
5. Student shall develop the habits of evolving more ideas, innovations, skills etc. apart from those included
in scope of manual.
6. Student shall refer technical magazines and data books.
7. Student should develop a habit of submitting the experimentation work as per the schedule and He/She
should be well prepared for the same.

Common Safety Instructions

1. Students are expected to carefully handle hardware, software and computers.


2. Equipment’s in the laboratory should not be removed, modified, relocated or disassembled without
prior permission of concerned Subject Faculty Member, Lab-Incharge and Head of the Department.
3. Shut down and switch off the computers properly before leaving the computer lab.
4. Switch off all the lights and fans as well as shut all the windows of the computer lab.
Electrical Department Vision Statement
To Foster Learning Environment for Electrical Engineering Education
having High Technical Skills, Ethical Values and Overall Global Competence.

Electrical Department Mision Statement


To provide high quality graduate program in Electrical Engineering to prepare
students for
1. Better Employability, Start-ups and Entrepreneurship.
2. A professional career with essential technical and managerial skills.
3. Collaboration with industries through research and innovation.
4. Other avenues for higher education.
5. Adapting to change in technology and apply the same for the benefits of
society at large.

Program Specific Outcomes


1. To create better learning environment to develop entrepreneurship
capabilities in various areas of Electrical Engineering with superior
efficiency, productivity, cost effectiveness and technological
empowerment of human resource.
2. To inculcate research capabilities in different areas of Electrical
Engineering to identify, comprehend and solve problems and adapt
themselves in a world of constantly evolving technology.
3. To generate high standards of moral and ethical
values among the graduates, this will help in transforming them as
responsible citizen of the nation.
L D COLLEGE OF ENGINEERING, AHMEDABAD
Electrical Engineering Department
List of Practical’s-B.E. Sem 7th Odd Term 2023-2024
Subject: Internet of Things (IOT :3171108)
Sr. CO-
Title of Practical Platform Remarks
No Mapping
Hardware Arduino
Study about Internet of things and Arduino
1. UNO CO 1
family.
Software IDE
To Program GPIO pins of IOT controller Hardware
2. (NodeMCU) and interface it for Digital or NodeMCU CO 2
Analog applications (LED blink) Software IDE
Interfacing of ultra-sonic sensor with IOT CO 2, CO4
Hardware Raspberry
controller and programming the same for
3. Pi
distance calculation with respect to
Software Raspbian
obstacles.
Introduction to Raspberry Pi Hardware Arduino CO 2
4.
Software Raspbian
Operating System Installation and CO 2
Hardware Arduino
5. Configuration of Raspberry Pi
Software Raspbian
To Program GPIO pins of IOT controller Hardware Raspberry CO 2, CO4
6. (Raspberry PI) and interface it with IR Pi, IR Sensors
Sensors Software Raspbian
Interfacing IOT Controller for controlling Hardware Raspberry CO 2, CO4
7. Brightness of LED using Raspberry Pi with Pi, LEDs
PWM technique. Software Raspbian
Implementation of Hardwiring and Hardware Raspberry CO 2, CO4
8. Interfacing of temperature and humidity Pi
sensor DHT22 with IOT controller. Software Raspbian
Hardware CO 2,
To Implement interfacing and programing NodeMCU CO3, CO4
9. of IOT controller for uploading sensor data Software IDE,
on cloud server using MQTT Protocol. Online Blynk
Platform

COURSE OUTCOMES
Sr. No Outcomes Domain of Learning
CO1 Understand IoT architecture Cognitive Domain
CO2 Program Embedded IoT devices Cognitive Domain
Implement IoT protocol to upload sensor data and to control Psychomotor/
CO3
devices Attitudinal Domain
Psychomotor Domain
CO4 Design IoT application
Affective
INDEX

Pg. Start Date End Date Marks/Grade Sign


No
1. Study about Internet of
things and Arduino
family.
2. To Program GPIO pins of
IOT controller
(NodeMCU) and interface
it for Digital or Analog
applications (LED blink)
3. Interfacing of ultra-sonic
sensor with IOT controller
and programming the
same for distance
calculation with respect to
obstacles.
4. Introduction to Raspberry
Pi

5. Operating System
Installation and
Configuration of
Raspberry Pi

6. To Program GPIO pins of


IOT controller (Raspberry
PI) and interface it with
IR Sensors
7. Interfacing IOT Controller
for controlling Brightness
of LED using Raspberry
Pi with PWM technique.
8. Implementation of
Hardwiring and
Interfacing of temperature
and humidity sensor
DHT22 with IOT
controller.
9. To Implement interfacing
and programming of IOT
controller for uploading
sensor data on cloud
server using MQTT
Protocol.
Experiment No: 1
Study about Internet of things and Arduino family introduction

Date:

Competency and Practical Skills: Basic knowledge of Computer, Operating System,


Software and Programming.

Relevant CO:

Objectives: To get familiar with Arduino UNO Board, its functionalities, operating
guidelines, its software Arduino IDE Installation and programming environment.

Apparatus: Arduino UNO Board, Computer, Arduino UNO Board USB Data Cable,
Arduino IDE Software

This experiment will introduce and discuss about the Arduino UNO Board, its components,
features and various functions, as shown in Figure-1.1.

Figure-1.1: Components of Arduino UNO

Overview:
The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz
ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It
contains everything needed to support the microcontroller; simply connect it to a computer
with a USB cable or power it with an AC-to-DC adapter or battery to get started.

The Uno differs from all preceding boards in a way that it does not use the FTDI USB-to-
serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2)
programmed as a USB-to-serial converter. Revision 2 of the Uno board has a resistor pulling
the 8U2 HWB line to ground, making it easier to put into DFU mode. Revision 3 of the board
has the following new features:

• 1.0 pinout: Added SDA and SCL pins that are near to the AREF pin and two other new pins
placed near to the RESET pin, the IOREF that allow the shields to adapt to the voltage
provided from the board. In future, shields will be compatible both with the board that uses
the AVR, which operate with 5V and with the Arduino Duo that operate with 3.3V. The
second one is a not connected pin that is reserved for future purposes.

• Stronger RESET circuit.

• Atmega 16U2 replace the 8U2.

• "Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The
Uno and version 1.0 will be the reference versions of Arduino, moving forward. The Uno is
the latest in a series of USB Arduino boards, and the reference model for the Arduino
platform.

Summary:
• Microcontroller ATmega328
• Operating Voltage 5V
• Input Voltage (recommended) 7-12V
• Input Voltage (limits) 6-20V
• Digital I/O Pins 14 (of which 6 provide PWM output)
• Analog Input Pins 6
• DC Current per I/O Pin 40 mA
• DC Current for 3.3V Pin 50 mA
• Flash Memory 32 KB (ATmega328) of which 0.5 KB used by boot loader
• SRAM 2 KB (ATmega328)
• EEPROM 1 KB (ATmega328)
• Clock Speed 16 MHz

Power:
The Arduino Uno can be powered via the USB connection or with an external power supply.
The power source is selected automatically. External (non-USB) power can come either from
an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a
2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted
in the GND and Vin pin headers of the POWER connector. The board can operate on an
external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may
supply less than five volts and the board may be unstable. If using more than 12V, the voltage
regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
The power pins are as follows:
• VIN: The input voltage to the Arduino board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it through
this pin.
• 5V: This pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or
the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the
regulator, and can damage your board.
• 3V3: A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50
mA.
• GND: Ground pins.

Memory:
The ATmega328 has 32 KB (with 0.5 KB used for the boot loader). It also has 2 KB of
SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).

Input and Output:


Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(),
digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or
receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of
20-50 Kilo ohms. In addition, some pins have specialized functions:
• Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These
pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.
• External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value. See the attachInterrupt() function for
details.
• PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
• SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication
using the SPI library.
• LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value,
the LED is on, when the pin is LOW, it's off.

The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of
resolution (i.e. 1024 different values). By default they measure from ground to 5 volts,
though is it possible to change the upper end of their range using the AREF pin and the
analogReference() function. Additionally, some pins have specialized functionality:
• TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire
library. There are a couple of other pins on the board:
• AREF. Reference voltage for the analog inputs. Used with analogReference().
• Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button
to shields which block the one on the board.
Communication:
The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial
communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on
the board channels this serial communication over USB and appears as a virtual com port to
software on the computer. The '16U2 firmware uses the standard USB COM drivers, and no
external driver is needed. However, on Windows, an .inf file is required. The Arduino
software includes a serial monitor which allows simple textual data to be sent to and from the
Arduino board. The RX and TX LEDs on the board will flash when data is being transmitted
via the USB-to-serial chip and USB connection to the computer (but not for serial
communication on pins 0 and 1).

A Software Serial library allows for serial communication on any of the Uno's digital pins.
The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino software
includes a Wire library to simplify use of the I2C bus. For SPI communication, use the SPI
library.

Installing Arduino IDE:


Search for Arduino and install it as shown in following figures, collaboratively named as
Figure-1.2. Select first option, download and install appropriate version of Arduino IDE
compatible with the operating system. After successful installation, the Arduino icon will be
created on desktop, double click it to open Arduino IDE and start programming.
Figure-1.2: Installing Arduino

Programming:
The Arduino Uno can be programmed with the Arduino software. Select "Arduino Uno from
the Tools > Board menu (according to the microcontroller on your board).

The ATmega328 on the Arduino Uno comes pre-burned with a boot loader that allows you to
upload new code to it without the use of an external hardware programmer. It communicates
using the original STK500 protocol.

You can also bypass the boot loader and program the microcontroller through the ICSP (In-
Circuit Serial Programming) header. The ATmega16U2 (or 8U2 in the rev1 and rev2 boards)
firmware source code is available. The ATmega16U2/8U2 is loaded with a DFU boot loader,
which can be activated by:
• On Rev1 boards: connecting the solder jumper on the back of the board (near the map of
Italy) and then resetting the 8U2.
• On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to ground,
making it easier to put into DFU mode.

One can use Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X and
Linux) to load a new firmware, or one can use the ISP header with an external programmer
(overwriting the DFU boot loader). Following is the default basic structure on any Arduino
program.
References/Sources:

• https://www.farnell.com/datasheets/1682209.pdf
• Arduino Programming Series (ह द
िं ी में ):
https://www.youtube.com/playlist?app=desktop&list=PLV3C-t_tgjGFyXP_-
AF37AoIuxM9jzELM
• Arduino Series (ह दिं ी में ):
https://www.youtube.com/playlist?app=desktop&list=PLV3C-
t_tgjGE1USbPg2jrrDMu26F_M7K-

References used by the students:

Rubric wise marks obtained:

Setting-up Following Data Successful


Rubrics Involvement Total
Experiment Procedure Collection Completion
Marks 10 10 10 10 10 50
Experiment No: 2
To Program GPIO pins of IOT Controller(Node MCU and interface it for Digital and analog
applications.
Date:

Competency and Practical Skills: Basic knowledge of Computer, Operating System,


Software and Programming.

Relevant CO:

Objectives: To get familiar with NodeMCU, its functionalities, operating guidelines, its
software Arduino IDE Installation and programming environment.

Apparatus: NodeMCU Board, Computer, Micro USB to USB Cable, Arduino IDE Software

This experiment will introduce and discuss about the NodeMCU Board, its pin configurations
and its functions.

Figure-2.1: NodeMCU Board and its group wise pin functions

Figure-2.1 demonstrates the NodeMCU Board and its group wise pin functions. Functions are
grouped for ease of understanding and remembrance.
Figure-2.2: NodeMCU with detailed Pin Diagram and functional details

Figure-2.2 explores the NodeMCU with detailed Pin Diagram and functional details. As it
can be seen, most of the pins have multiple functionalities. Details explanation of each pin is
given below:

Power Pins There are four power pins viz. one VIN pin & three 3.3V pins. The VIN pin can
be used to directly supply the ESP8266 and its peripherals, if you have a regulated 5V
voltage source. The 3.3V pins are the output of an on-board voltage regulator. These pins can
be used to supply power to external components.

GND is a ground pin of ESP8266 NodeMCU development board.

I2C Pins are used to hook up all sorts of I2C sensors and peripherals in your project. Both
I2C Master and I2C Slave are supported. I2C interface functionality can be realized
programmatically, and the clock frequency is 100 kHz at a maximum. It should be noted that
I2C clock frequency should be higher than the slowest clock frequency of the slave device.

GPIO Pins ESP8266 NodeMCU has 17 GPIO pins which can be assigned to various
functions such as I2C, I2S, UART, PWM, IR Remote Control, LED Light and Button
programmatically. Each digital enabled GPIO can be configured to internal pull-up or pull-
down, or set to high impedance. When configured as an input, it can also be set to edge-
trigger or level-trigger to generate CPU interrupts.
ADC Channel The NodeMCU is embedded with a 10-bit precision SAR ADC. The two
functions can be implemented using ADC viz. Testing power supply voltage of VDD3P3 pin
and testing input voltage of TOUT pin. However, they cannot be implemented at the same
time.

UART Pins ESP8266 NodeMCU has 2 UART interfaces, i.e. UART0 and UART1, which
provide asynchronous communication (RS232 and RS485), and can communicate at up to 4.5
Mbps. UART0 (TXD0, RXD0, RST0 & CTS0 pins) can be used for communication. It
supports fluid control. However, UART1 (TXD1 pin) features only data transmit signal so, it
is usually used for printing log.

ESP8266 features two SPIs (SPI and HSPI) in slave and master modes. These SPIs also
support the following general-purpose SPI features:

• 4 timing modes of the SPI format transfer


• Up to 80 MHz and the divided clocks of 80 MHz
• Up to 64-Byte FIFO

SDIO Pins ESP8266 features Secure Digital Input/Output Interface (SDIO) which is used to
directly interface SD cards. 4-bit 25 MHz SDIO v1.1 and 4-bit 50 MHz SDIO v2.0 are
supported.

PWM Pins The board has 4 channels of Pulse Width Modulation (PWM). The PWM output
can be implemented programmatically and used for driving digital motors and LEDs. PWM
frequency range is adjustable from 1000 μs to 10000 μs, i.e., between 100 Hz and 1 kHz.

Control Pins are used to control ESP8266. These pins include Chip Enable pin (EN), Reset
pin (RST) and WAKE pin.

• EN pin – The ESP8266 chip is enabled when EN pin is pulled HIGH. When pulled
LOW the chip works at minimum power.
• RST pin – RST pin is used to reset the ESP8266 chip.
• WAKE pin – Wake pin is used to wake the chip from deep-sleep.

References/Sources:

• Experiment Video: https://www.youtube.com/watch?v=pj2h3FaxEQY&t=0s


• https://lastminuteengineers.com/esp8266-nodemcu-arduino-tutorial/
References used by the students:

Rubric wise marks obtained:

Setting-up Following Data Successful


Rubrics Involvement Total
Experiment Procedure Collection Completion
Marks 10 10 10 10 10 50
Experiment – 3

Aim: Interfacing of ultra-sonic sensor with IOT controller and programing the same for
distance calculation with respect to obstacles.

Apparatus: NodeMCU, HC-SR04 (Ultra-sonic Sensor). Bread Board, Jumper Wires, Micro
USB Cable

Theory:

Hcsr04 ultrasonic sensor is composed of ultrasonic transmitter, ultrasonic receiver and a control
circuit. Hscr04 ultrasonic transmitter transmits ultrasound waves at 40,000 Hz. Transmitted
waves bounce back if they hit any flat surface/object in their path. Bounced back waves reaches
the ultrasonic receiver. Ultrasonic receiver receives the bounced back waves and notifies the
control circuit about it. Control circuit than calculates the time taken by waves to reach back
after transmission. Time is than manipulated to approximate the distance traveled by waves or
what is the distance between the sensor and the object? from which ultrasound waves bounced
back.
Hcsr04 can measure distance between an active range of 2 cm to 4 meters. Hcsr04 requires 5
volts and 15 mA of power for operation. Hcsr04 has four pins. Two are power pins. Vcc is +ve
pin apply 5v to this pin and Gnd is ground pin connect -ve of 5v power source with it. The
other two pins are Trigger and Echo.

 Trigger pin is triggered by external controller to out burst an ultrasound wave.


 Echo pin notifies external controller when receiver receives back the bounced back
wave.
 D = 1/2 × T × C
 where D is the distance, T is the time between the Emission and Reception, and C is th
e sonic speed.
 (The value is multiplied by 1/2 because T is the time for go-and-return distance.)
Procedure:

The circuit connections are made as follows:


 The HC-SR04 sensor attach to the Breadboard.
 The sensor Vcc is connected to the NodeMCU +3.3v.
 The sensor GND is connected to the NodeMCU GND.
 The sensor Trigger Pin is connected to the NodeMCU Digital I/O D4.
 The sensor Echo Pin is connected to the NodeMCU Digital I/O D3.

Code:
// defines pins numbers
const int trigPin = 2; //D4
const int echoPin = 0; //D3

// defines variables
long duration;
int distance;

void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
}

void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

// Calculating the distance


distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
delay(2000);
}

Output:

Conclusion:
Experiment No: 4
Introduction to Raspberry Pi

Date:

Competency and Practical Skills: Basic knowledge of Computer, Operating System,


Software and Programming.

Relevant CO:

Objectives: To get familiar with Raspberry Pi Board and its functionalities, operating
guidelines and programming environment.

Apparatus: Raspberry Pi Board, Computer, Raspberry Pi Board Cable

This experiment will introduce and discuss the NodeMCU Board, its pin configurations and
various functions. Figure-10.1 shows major components of Raspberry Pi which are useful for
interfacing and controlling devices through programming.

Figure-10.1: Components of Raspberry Pi

Figure-10.2 shows the necessary peripherals to be attached with Raspberry Pi to obtain


complete functionality of a mini computer from it.

Figure-10.2: Raspberry Pi Peripheral attachments


Figure-10.3 displays various connecting mediums for establishing communication between
Raspberry Pi and Peripherals with different types of interfaces to synchronize, program and
control all.

Figure-10.3: Various Connecting mediums

Figure-10.4 displays complete pin functionalities of Raspberry Pi in detail.

Figure-10.4: Raspberry Pi Pin Diagram


References/Sources:

• Experiment Video:
https://www.youtube.com/watch?v=5D_Nn5NmmrI&list=PL0s3O6GgLL5cteXH7CJ
K7kc2Ar5wR7M81&index=3

References used by the students:

Rubric wise marks obtained:

Setting-up Following Data Successful


Rubrics Involvement Total
Experiment Procedure Collection Completion
Marks 10 10 10 10 10 50
Experiment No: 5
Operating System Installation and Configuration of Raspberry Pi

Date:

Competency and Practical Skills: Basic knowledge of Computer, Operating System,


Software and Programming.

Relevant CO:

Objectives: To install operating system on Raspberry Pi Board and configure it.

Apparatus: Raspberry Pi Board, Computer, Raspberry Pi Board Cable, Memory Card,


Memory Card Reader, Raspbian OS, Python

The experiment will demonstrate the Installation of Raspbian Operating System and
Configuration of Raspberry Pi.

The Figure-11.1 lists various available operating systems for Raspberry Pi.

Figure-11.1: List of Operating Systems supported by Raspberry Pi

First of all, select and download Raspbian OS on memory card as shown in Figure-11.2.
Figure-11.2: Raspberry Pi Operating System source

Once done, insert OS installed memory card into Raspberry Pi board and boot from the same.
The following screen should appear first, as shown in Figure-11.3.

Figure-11.3: First screen after booting

Select Raspberry Pi configuration from Preferences menu. Follow the steps as shown in
following figures, collaboratively named as Figure-11.4.
Figure-11.4: Raspberry Pi Configuration

Raspberry Pi is now ready for use.

References/Sources:

• Experiment Videos:
https://www.youtube.com/watch?v=ePPBivLqlOE&list=PL0s3O6GgLL5cteXH7CJK
7kc2Ar5wR7M81&index=2

https://www.youtube.com/watch?v=D4y_i-
m5rK4&list=PL0s3O6GgLL5cteXH7CJK7kc2Ar5wR7M81&index=4
References used by the students:

Rubric wise marks obtained:

Setting-up Following Data Successful


Rubrics Involvement Total
Experiment Procedure Collection Completion
Marks 10 10 10 10 10 50
Experiment No: 6
To Program GPIO pins of IOT controller interface it with IR Sensors

Date:

Competency and Practical Skills: Basic knowledge of Computer, Operating System,


Software and Programming.

Relevant CO:

Objectives: To program Raspberry Pi Board for interfacing IR Sensor.

Apparatus: Raspberry Pi Board, Computer, Raspberry Pi Board Cable, Memory Card,


Memory Card Reader, Raspbian OS, Python, VNC, Bread board, IR sensor, Buzzer Jumper
wires

Connect the components with Raspberry Pi as shown in Figure-14.1

Figure-14.1: Interfacing IR sensor with Raspberry Pi


Now, write the program code in Python 3. After compilation and execution, the output can be
tested in the presence and absence of the obstacle as shown in following figures,
collaboratively named as Figure-14.2.

Figure-14.2: Testing output on screen as well as using Buzzer sound


Code:

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)

GPIO.setup(3, GPIO.IN)
GPIO.setup(5, GPIO.OUT)

while True:
val = GPIO.input(3)
print (val)
if val == 1:
GPIO.output(5, GPIO.LOW)
else:
GPIO.output(5, GPIO.HIGH)

References/Sources:

• Experiment Videos:
https://www.youtube.com/watch?v=qQTQcN44UWg&list=PL0s3O6GgLL5cteXH7C
JK7kc2Ar5wR7M81&index=7

References used by the students:

Rubric wise marks obtained:

Setting-up Following Data Successful


Rubrics Involvement Total
Experiment Procedure Collection Completion
Marks 10 10 10 10 10 50
Experiment No: 7

Interfacing IOT Controller for controlling Brightness of LED using Raspberry Pi with PWM
technique.
Date:

Competency and Practical Skills: Basic knowledge of Computer, Operating System,


Software and Programming.

Relevant CO:

Objectives: To configure and program Raspberry Pi Board for controlling brightness of LED
using PWM technique.

Apparatus: Raspberry Pi Board, Computer, Raspberry Pi Board Cable, Memory Card,


Memory Card Reader, Raspbian OS, Python, VNC, Bread board, Jumper wires, LEDs,
Resistors

Connect the components with Raspberry Pi as shown in Figure-15.1

Figure-15.1: Interfacing LED with Raspberry Pi


Now, write the program code in Python 3. After compilation and execution, the output can be
tested by observing the increasing and decreasing intensity of LED light, as shown in Figure-
15.2.
Figure-15.2: Brightness control of LED using PWM technique with Raspberry Pi

Code:

import RPi.GPIO as GPIO


import time

GPIO.setmode(GPIO.BOARD)

GPIO.setup(3, GPIO.OUT)

P = GPIO.PWM(3,100)
P.start(0)

while True:
for x in range (100):
P.start(x)
time.sleep(0.1)

for x in range (100)


P.start(100-x)
time.sleep(0.1)

References/Sources:

• Experiment Videos:
https://www.youtube.com/watch?v=F0Ip8zubQlA&list=PL0s3O6GgLL5cteXH7CJK
7kc2Ar5wR7M81&index=8

References used by the students:

Rubric wise marks obtained:

Setting-up Following Data Successful


Rubrics Involvement Total
Experiment Procedure Collection Completion
Marks 10 10 10 10 10 50
Experiment No: 8
Implementation of Hardwiring and Interfacing of temperature and humidity sensor DHT22 with
IOT controller.
Date:

Competency and Practical Skills: Basic knowledge of Computer, Operating System,


Software and Programming.

Relevant CO:

Objectives: To monitor temperature using Raspberry Pi Board.

Apparatus: Raspberry Pi Board, Computer, Raspberry Pi Board Cable, Memory Card,


Memory Card Reader, 16x2 LCD display, Temperature sensor (DHT-11), Raspbian OS,
Python, VNC, Bread board, Jumper wires, Resistors

Interface the DHT-11 temperature sensor and 16x2 LCD with Raspberry Pi as shown in
Figure-17.1

Figure-17.1: Interfacing DHT-11 sensor and 16x2 LCD with Raspberry Pi


Follow the steps as shown in following figures to install DHT-11 sensor library,
collaboratively named as Figure-17.2
Figure-17.2: Steps to install DHT-11 sensor library

Figure-17.3 shows the output when the program code is written in python 3, compiled and
executed without errors. Temperature and Humidity is displayed on LCD.
Figure-17.3: Temperature sensor data displayed on LCD

Code:

import Adafruit_CharLCD as LCD


import Adafruit_DHT
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)

lcd1 = 12
lcd2 = 7
lcd3 = 8
lcd4 = 25
lcd5 = 24
lcd6 = 23

lcd = LCD.Adafruit_CharLCD(lcd1, lcd2, lcd3, lcd4, lcd5, lcd6, 0, 16, 2)

while True:
humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT11,
2)
lcd.clear()
lcd.message("Temp: " + str(temperature) + "C\nHumidity: " +
str(humidity) + "%")
time.sleep(1)

References/Sources:

• Experiment Videos:
https://www.youtube.com/watch?v=tICT98WwYxI&list=PL0s3O6GgLL5cteXH7CJ
K7kc2Ar5wR7M81&index=10

References used by the students:

Rubric wise marks obtained:

Setting-up Following Data Successful


Rubrics Involvement Total
Experiment Procedure Collection Completion
Marks 10 10 10 10 10 50
Experiment – 9

Aim: To Implement interfacing and programming of IOT controller for uploading real time
DHT22 sensor data on a mobile dashboard.

Apparatus: Three jump wires, DHT22, NodeMCU, Micro-USB

Procedure:

Hardware Setup:
 Place the NodeMCU on the breadboard. The rest of the instructions assume the front (
with the holes ) of the DHT22 is facing you.
 The left-most pin of the DHT22 is the positive pin. You should connect it to 3v3 or Vin
on the MCU.
 The second pin of the DHT22 (from the left) is the data pin. You should connect it to
D2 on the MCU.
 The third pin of the DHT22 (from the left) does nothing.
 The last pin of theDHT22 (from the left) is the Ground pin. It should be connected
GND.
Software Setup:
Before starting to upload the program make sure all the necessary library files have been imported
in the Arduino IDE.

Code:
#define BLYNK_TEMPLATE_ID "TMPLwSnJ1Io0"
#define BLYNK_DEVICE_NAME "TempHumidity"

#define BLYNK_FIRMWARE_VERSION "0.1.0"


#define BLYNK_PRINT Serial
#define APP_DEBUG
#define MODE
#include "BlynkEdgent.h"

#define DHTPIN 14 //D5 pin of Node MCU


#define DHTTYPE DHT22
#include <DHT.h>

DHT dht(DHTPIN, DHTTYPE);

BlynkTimer timer1;
float h , t;

void sendSensor()
{
h = dht.readHumidity();
t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Blynk.virtualWrite(V2, h);
Blynk.virtualWrite(V1, t);
}

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

dht.begin();
BlynkEdgent.begin();
timer1.setInterval(2000L, sendSensor);
}

void loop()
{

BlynkEdgent.run();
timer1.run();
h = dht.readHumidity();
t = dht.readTemperature();

delay(800);
}

As discussed in previous practical, All the steps should be taken to create the blynk template
on the blynk cloud website. Here instead of only one virtual pin, We will create two virtual pin
to receive the data for humidity as well as temperature.
In mobile dashboard, instead of switch, we will use gauges to indicate the value of temperature
and humidity.
After that, Code which is shown above will be uploaded on NodeMCU.

Conclusion:

You might also like