You are on page 1of 36

RISHI MS INSTITUTE OF ENGINEERING

&TECHNOLOGY
FOR WOMEN
(Approved by AICTE, New Delhi and Affiliated to JNTUH)
Nizampet Cross Road, JNTUH Kukatpally Hyderabad–500085

LABORATORY MANUAL
C PROGRAMMING FOR ENGINEERS
LABORATORY

B.Tech II YEAR I SEM (R22 REGULATIONS)


For
B. Tech
II Year I semester

DEPARTMENT OF INFORMATION TECHNOLOGY


h> Void main( )
{
int a,b;
printf(“enter the values of a and
b”); scanf(“%d
%d”,&a,&b);
printf(“the arithmetic operators
result is %d %d %d %d”, a+b,a-
b,a*b,a/b);
printf(“the relational operators
result is %d %d %d %d”,
a>b,a<b,a>=b,a<=b);
printf(“the logical operators result
is %d %d %d %d”, a&&b,a||b,!
(a==b));
printf(“the increment operator
result is %d %d %d %d”,a++,+
+a,b++,++b);
printf(“the decrement operator
result is %d %d %d %d”,a--,--
a,b--,--b);
printf(“the bitwise AND operator
result is %d”,a&b);
printf(“the bitwise OR operator
result is %d”,a|b);
printf(“the bitwise NOT operator
result is %d”,a^b);
}
INDEX

S.NO TOPIC PAGE NO

I List of Experiments ii

II V/M /POs/PSOs/PEOs iv

III Syllabus ix

IV Course Objectives & Course Outcomes xi

i
List of Experiments

Exp. No. Experiment Name Page No.


Using raspberry pi
1. a. Calculate the distance using a distance sensor.
b. Basic LED functionality.
Using Arduino
2. a. Calculate the distance using a distance sensor.
b. Basic LED functionality.
c. Calculate temperature using a temperature sensor.
Using Node MCU
3. a. Calculate the distance using a distance sensor.
b. Basic LED functionality.
c. Calculate temperature using a temperature sensor.
4. Installing OS on Raspberry Pi
a) Installation using PiImager
b) Installation using image file
● Downloading an Image
● Writing the image to an SD card
● using Linux
● using Windows
● Booting up Follow the instructions given in the URL
https://www.raspberrypi.com/documentation/computers/getting-started.html
5. Accessing GPIO pins using Python
a) Installing GPIO Zero library.
First, update your repositories list:
sudo apt update
Then install the package for Python 3:
sudo apt install python3-gpiozero
b) Blinking an LED connected to one of the GPIO pin
c) Adjusting the brightness of an LED Adjust the brightness of an LED (0 to 100,
where 100 means maximum brightness) using the in-built PWM wavelength.
6. Collecting Sensor Data
a) DHT Sensor interface
● Connect the terminals of DHT GPIO pins of Raspberry Pi.
● Import the DHT library using import Adafruit_DHT
● Read sensor data and display it on screen.

ii
RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
(Affiliated to JNTUH University, Approved by AICTE)

Department of Information Technology

Vision of the institution:

To be a center of excellence in producing women engineers and scientists who are professionally
competent social leaders to face multi-disciplinary global environment by imparting quality technical
education, values and ethics through innovation methods of teaching and learning.

Mission of the institution:

 To promote women technocrats capable enough to resolve the problems faced by the society using
the knowledge imparted.
 To prepare self-reliant women engineering for technological growth of the nation and society by
laying strong theoretical foundation accompanied by wide practical training.
 To equip the young women with creative thinking capabilities and empowering them towards
innovation.

iii
RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
(Affiliated to JNTUH University, Approved by AICTE)

Department of Information Technology

Vision & Mission of Department

Vision of the department

To empower women by providing cutting-edge technology to female technocrats in the fields of


Information Technology, allowing them to develop into competent engineers and entrepreneurs.

Mission of the department

 Adopting creative techniques to nurture and strengthen the core skill of Computer Science.
 Introduce students to the most recent technological advancements.
 Impart quality education, improve the research, entrepreneurial, and employability skills of women
technocrats.
 Instill professional ethics and a sense of social responsibility in students.
 Strengthen the Industry-Academia interface, which will enable graduates to emerge as
academic leaders or inspiring entrepreneurs

iv

 RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
 (Affiliated to JNTUH University, Approved by AICTE)

Program outcomes (POs)


1. Engineering Knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. Problem Analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
3. Design/Development of Solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
4. Conduct Investigations of Complex Problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of
the information to provide valid conclusions.
5. Modern Tool Usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modelling to complex engineering
activities with an understanding of the limitations.
6. The Engineer and Society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant
to the professional engineering practice.
7. Environment and Sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need
for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
9. Individual and Team Work: Function effectively as an individual, and as a member or
leader in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and
write effective reports and design documentation, make effective presentations, and give and
receive clear instructions.
11. Project Management and Finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long Learning: Recognize the need for, and have the preparation and ability to engage
in independent and life-long learning in the broadest context of technological change.

v
RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
(Affiliated to JNTUH University, Approved by AICTE)

Department of Information Technology

Program specific outcomes (PSOs)

PSO 1: Improve the student's ability to decipher the basic principles and methodology of computer
systems. Improve the students' ability to absorb facts and technical ideas in order to build and
develop software.
PSO 2: The capacity to create novel job routes as an entrepreneur using modern computer languages
and evolving technologies like SDLC, Python, Machine Learning, Social Networks, Cyber
Security, Mobile Apps etc.

vi
RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
(Affiliated to JNTUH University, Approved by AICTE)

Department of Information Technology

Program educational objectives (PEOs)

PEO-1: Engineering graduates with excellent fundamental and technical skills will have
successful careers in industry, meeting the needs of Indian and worldwide firms.

PEO-2: With determination, development, self-reliance, leadership, morality, and moral principles,
engineering graduates will become successful entrepreneurs who will leverage employability.

PEO-3: To support personal and organisational progress, engineering graduates will pursue higher
education and engage in lifelong learning.

vii
SYLLABUS
IOT FOR ENGINEERS LABORATORY
B. TECH II Year I Sem

Week -1:
Using raspberry pi
a. Calculate the distance using a distance sensor.
b. Basic LED functionality.

TEXT BOOKS:

1. Internet of Things - A Hands-on Approach, Arshdeep Bahga and Vijay Madisetti, Universities Press,
2015, ISBN: 9788173719547
2. Getting Started with Raspberry Pi, Matt Richardson & Shawn Wallace, O'Reilly (SPD), 2014, ISBN:
9789350239759

REFERENCE BOOKS:

1. Bernd Scholz-Reiter, Florian Michahelles, “Architecting the Internet of Things”, ISBN 978-3- 642-19156-5 e-
ISBN 978-3-642-19157-2, Springer, 2016.
2. N. Ida, Sensors, Actuators and Their Interfaces, SciTech Publishers, 2014.

viii
Course Objectives:
● To introduce the raspberry PI platform, that is widely used in IoT applications.
● To introduce the implementation of distance sensor on IoT devices.

Course Outcomes:
 Ability to introduce the concept of M2M (machine to machine) with necessary protocols and get awareness in
implementation of distance sensor.
 Get the skill to program using python scripting language which is used in many IoT devices.

CO - PO MAPPING:

CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12

Python CO1 3 2 1 1 1 1 - - 1 1 1
Programming
Lab
CO2 1 2 3 2 1 2 1 1 1

CO - PSO MAPPING:

PSO-1 PSO-2
CO1 1 3
CO2 2 3

ix
Week 1

EXPERIMENT NO:
Using raspberry pi
a. Calculate the distance using a distance sensor. b. Basic LED functionality.

AIM: Using raspberry pi


a. Calculate the distance using a distance sensor.
b. Basic LED functionality.

A. Use a Raspberry Pi to calculate the distance using a distance sensor:


 Connect the distance sensor to the Raspberry Pi's GPIO pins.
 Install the required libraries and packages (e.g., RPi.GPIO, pigpio, time, etc.).
 Write a script in Python to read the sensor data and calculate the distance using a formula based on the sensor's
specifications.
 Use the formula to convert the sensor data into a distance value and display the output on the screen or send it to
a remote server for storage and processing.
 Run the script on the Raspberry Pi to get the distance measurements

PROGRAM:

import RPi.GPIO as GPIO


import time
# Set the GPIO mode
GPIO.setmode(GPIO.BCM)
# Define the GPIO pin for the sensor
TRIG = 23
ECHO = 24
# Set up the GPIO pins for the sensor
GPIO.setup(TRIG,GPIO.OUT)
GPIO.setup(ECHO,GPIO.IN)
# Set the trigger pin to low
GPIO.output(TRIG, False)
# Wait for the sensor to settle
time.sleep(2)
# Send a 10uS pulse to trigger the sensor
GPIO.output(TRIG, True)
time.sleep(0.00001)
GPIO.output(TRIG, False)
# Measure the pulse duration
while GPIO.input(ECHO)==0:
pulse_start = time.time()
while GPIO.input(ECHO)==1:
pulse_end = time.time()
# Calculate the distance
pulse_duration = pulse_end - pulse_start
distance = pulse_duration * 17150
x
distance = round(distance, 2)
# Display the distance
print("Distance:",distance,"cm")
# Clean up the GPIO pins
GPIO.cleanup()

RESULT:

xi
B. Use a Raspberry Pi to implement basic LED functionality:

 Connect the LED to the Raspberry Pi's GPIO pins, with a resistor in series to protect the LED from excessive
current.
 Install the required libraries and packages (e.g. RPi.GPIO, time, etc.).
 Write a script in Python to control the GPIO pin connected to the LED and turn it on and off.
 Run the script on the Raspberry Pi to control the LED.

PROGRAM:

import RPi.GPIO as GPIO


import time
# Set the GPIO mode
GPIO.setmode(GPIO.BCM)
# Define the GPIO pin for the LED
LED = 18
# Set up the GPIO pin for the LED
GPIO.setup(LED, GPIO.OUT)
# Turn on the LED
GPIO.output(LED, True)
time.sleep(1)
# Turn off the LED
GPIO.output(LED, False)
# Clean up the GPIO pins
GPIO.cleanup()

This code sets up the GPIO pin 18 as an output and turns the LED on for 1 second and then off. You can modify
the code to implement different LED functionality, such as blinking, fading, etc.

RESULT:

VIVA QUESTIONS:

 What is a raspberry pi?


 What is a LED functionality?

xii
SYLLABUS
IOT FOR ENGINEERS LABORATORY
B. TECH II Year I Sem

Week -2:
Using Arduino
a. Calculate the distance using a distance sensor.
b. Basic LED functionality.
c. Calculate temperature using a temperature sensor.

TEXT BOOKS:

1. Internet of Things - A Hands-on Approach, Arshdeep Bahga and Vijay Madisetti, Universities Press,
2015, ISBN: 9788173719547
2. Getting Started with Raspberry Pi, Matt Richardson & Shawn Wallace, O'Reilly (SPD), 2014, ISBN:
9789350239759

REFERENCE BOOKS:

1. Bernd Scholz-Reiter, Florian Michahelles, “Architecting the Internet of Things”, ISBN 978-3- 642-19156-5 e-
ISBN 978-3-642-19157-2, Springer, 2016.
2. N. Ida, Sensors, Actuators and Their Interfaces, SciTech Publishers, 2014.

xiii
Course Objectives:
● To introduce the raspberry PI platform, that is widely used in IoT applications.
● To introduce the implementation of distance sensor on IoT devices.

Course Outcomes:
 Ability to introduce the concept of M2M (machine to machine) with necessary protocols and get awareness in
implementation of distance sensor.
 Get the skill to program using python scripting language which is used in many IoT devices.

CO - PO MAPPING:

CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12

Python CO1 2 2 2 3 1 2 - - 1 1 1
Programming
Lab
CO2 2 3 1 3 2 1 1 1 1

CO - PSO MAPPING:

PSO-1 PSO-2
CO1 2 1
CO2 1 2

xiv
Week 2

EXPERIMENT NO:
Using Arduino
a. Calculate the distance using a distance sensor.
b. Basic LED functionality.
c. Calculate temperature using a temperature sensor.

AIM: Using Arduino


a. Calculate the distance using a distance sensor.
b. Basic LED functionality.
c. Calculate temperature using a temperature sensor.

A. Use Arduino to Calculate the distance using a distance sensor


 Connect the distance sensor to the Arduino's digital pins.
 Install the required libraries and packages (e.g. NewPing library).
 Write a sketch in the Arduino IDE to read the sensor data and calculate the distance using the NewPing
library.
 Use the library to convert the sensor data into a distance value and display the output on the serial monitor or
send it to a remote server for storage and processing.
 Upload the sketch to the Arduino to get the distance measurements.

PROGRAM:

#include <NewPing.h>
#define TRIGGER_PIN 12
#define ECHO_PIN 11
#define MAX_DISTANCE 200
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
void setup() {
Serial.begin(9600);
}
void loop() {
delay(50);
int distance = sonar.ping_cm();
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
}
This code uses the NewPing library to calculate the distance using the sensor connected to digital pins
12 and 11. The distance is displayed on the serial monitor and updated every 50 milliseconds.

RESULT:

xv
B. Use Arduino to implement basic LED functionality:
Connect the LED to the Arduino's digital pins, with a resistor in series to protect the LED from excessive
current.
Write a sketch in the Arduino IDE to control the digital pin connected to the LED and turn it on and
off.
Upload the sketch to the Arduino to control the LED.
Here's an example code that demonstrates this process:

PROGRAM:

const int LED = 13;


void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
delay(1000);
}

This code sets up digital pin 13 as an output and turns the LED on and off every 1 second. You can modify the
code to implement different LED functionality, such as blinking, fading, etc.

RESULT:

xvi
C. Use Arduino to Calculate temperature using a temperature sensor:
 Connect the temperature sensor (e.g. LM35) to the Arduino's analog pins.
 Write a sketch in the Arduino IDE to read the sensor data and convert it into a temperature
value.
 Display the temperature output on the serial monitor or send it to a remote server for storage
and processing.
 Upload the sketch to the Arduino to get the temperature readings.
Here's an example code that demonstrates this process:

PROGRAM:

const int TEMP_SENSOR = A0;


void setup() {
Serial.begin(9600);
}
void loop() {
float voltage = analogRead(TEMP_SENSOR) * 0.0048828125;
float temperature = voltage * 100;
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println("°C");
delay(1000);
}

This code reads the analog voltage from the temperature sensor connected to analog pin A0 and converts it into a
temperature value in degrees Celsius. The temperature is displayed on the serial monitor and updated every
1second.

RESULT:

VIVA QUESTIONS:
 Define Arduino
 What is temperature sensor

xvii
SYLLABUS
IOT FOR ENGINEERS LABORATORY
B. TECH II Year I Sem

Week -3:
Using Node MCU
a. Calculate the distance using a distance sensor.
b. Basic LED functionality.
c. Calculate temperature using a temperature sensor.

TEXT BOOKS:

1. Internet of Things - A Hands-on Approach, Arshdeep Bahga and Vijay Madisetti, Universities Press,
2015, ISBN: 9788173719547
2. Getting Started with Raspberry Pi, Matt Richardson & Shawn Wallace, O'Reilly (SPD), 2014, ISBN:
9789350239759

REFERENCE BOOKS:

1. Bernd Scholz-Reiter, Florian Michahelles, “Architecting the Internet of Things”, ISBN 978-3- 642-19156-5 e-
ISBN 978-3-642-19157-2, Springer, 2016.
2. N. Ida, Sensors, Actuators and Their Interfaces, SciTech Publishers, 2014.

xvii
i
Course Objectives:
● To introduce the raspberry PI platform, that is widely used in IoT applications.
● To introduce the implementation of distance sensor on IoT devices.

Course Outcomes:
 Ability to introduce the concept of M2M (machine to machine) with necessary protocols and get awareness in
implementation of distance sensor.
 Get the skill to program using python scripting language which is used in many IoT devices.

CO - PO MAPPING:

CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12

Python CO1 1 3 2 1 1 1 - - 1 1 1
Programming
Lab
CO2 2 3 1 2 1 2 1 1 1

CO - PSO MAPPING:

PSO-1 PSO-2
CO1 1 1
CO2 3 3

xix
Week 3
EXPERIMENT NO:
Using Node MCU
a. Calculate the distance using a distance sensor.
b. Basic LED functionality.
c. Calculate temperature using a temperature sensor.

AIM: Using Node MCU


a. Calculate the distance using a distance sensor.
b. Basic LED functionality.
c. Calculate temperature using a temperature sensor.

A. Using Node MCU to Calculate the distance using a distance sensor:


To calculate the distance using a distance sensor in IoT with NodeMCU, you would need to connect the distance
sensor to the NodeMCU board. Then you would need to write a program in the Lua programming language to
read the distance from the sensor and send it to a remote server. Here is an example of how this can be done:
 Connect the distance sensor to the NodeMCU board.
 Write a program in Lua to read the distance from the sensor and store it in a variable.
 Use the NodeMCU's Wi-Fi capability to send the distance data to a remote server.
 On the remote server, process the data and display the distance on a webpage.
Here is an example code in Lua to read the distance from a HC-SR04 distance sensor:

PROGRAM:

-- Trigger pin will be used to send a signal to the sensor to measure distance
local trigger_pin = 4
-- Echo pin will be used to receive the signal back from the sensor
local echo_pin = 3
-- Set trigger_pin as an output pin
gpio.mode(trigger_pin, gpio.OUTPUT)
-- Set echo_pin as an input pin
gpio.mode(echo_pin, gpio.INPUT)
-- Function to calculate distance
function get_distance()
-- Send a 10us pulse to trigger the measurement
gpio.write(trigger_pin, gpio.HIGH)
tmr.delay(10)
gpio.write(trigger_pin, gpio.LOW)
-- Measure the duration of the pulse received back on the echo pin
local duration = pulse_in(echo_pin, gpio.HIGH)
-- Calculate the distance based on the duration
local distance = duration / 58

xx
-- Return the calculated distance
return distance
end
-- Call the get_distance function and print the result
print("Distance: " .. get_distance() .. " cm")

This is just a basic example and you may need to modify the code based on your specific requirements. You can
also use a library such as the HC-SR04 library in NodeMCU to simplify the process.

RESULT:

xxi
B. Using Node MCU to Basic LED functionality in IOT with output:
To control a basic LED in IoT with NodeMCU, you can use the following steps:
 Connect the LED to the NodeMCU board.
 Write a program in Lua to control the state of the LED (on or off).
 Use the NodeMCU's Wi-Fi capability to send commands to the LED to turn it on or off.
 On a remote device, such as a smartphone or a computer, you can create a user interface to send the commands
to the NodeMCU.
Here is an example code in Lua to control an LED connected to pin D1 on the NodeMCU board:

PROGRAM:

-- LED pin
local led_pin = 1
-- Set the LED pin as an output pin
gpio.mode(led_pin, gpio.OUTPUT)
-- Function to turn the LED on
function turn_on_led()
gpio.write(led_pin, gpio.HIGH)
end
-- Function to turn the LED off
function turn_off_led()
gpio.write(led_pin, gpio.LOW)
end
-- Call the turn_on_led function to turn the LED on
turn_on_led()
-- Wait for 2 seconds
tmr.delay(2000000)
-- Call the turn_off_led function to turn the LED off
turn_off_led()

This is just a basic example and you can modify it to fit your specific requirements. You can also use the
NodeMCU API to create a web server that allows you to control the LED through a web browser.

RESULT:

xxii
C. Using Node MCU to Calculate temperature using a temperature sensor:
To calculate temperature using a temperature sensor in IoT with NodeMCU, you would need to
connect the temperature sensor to the NodeMCU board. Then you would need to write a program in the
Lua programming language to read the temperature from the sensor and send it to a remote server. Here
is an example of how this can be done:
Connect the temperature sensor to the NodeMCU board.
Write a program in Lua to read the temperature from the sensor and store it in a variable.
Use the NodeMCU's Wi-Fi capability to send the temperature data to a remote server.
On the remote server, process the data and display the temperature on a webpage.
Here is an example code in Lua to read the temperature from a DS18B20 temperature sensor

PROGRAM:

-- Pin that the DS18B20 is connected to


local pin = 2
-- Initialize the DS18B20 library
ds18b20.setup(pin)
-- Function to read the temperature
function get_temperature()
-- Read the temperature from the DS18B20
local temperature = ds18b20.read()
-- Return the temperature
return temperature
end
-- Call the get_temperature function and print the result
print("Temperature: " .. get_temperature() .. "°C")

This is just a basic example and you may need to modify the code based on your specific requirements.
You can also use a library such as the DS18B20 library in NodeMCU to simplify the process.

RESULT:

VIVA QUESTIONS:
 Define Node MCU

xxii
i
SYLLABUS
IOT FOR ENGINEERS LABORATORY
B. TECH II Year I Sem

Week -4:
Installing OS on Raspberry Pi
a) Installation using PiImager
b) Installation using image file
● Downloading an Image
● Writing the image to an SD card
● using Linux
● using Windows
● Booting up Follow the instructions given in the URL
https://www.raspberrypi.com/documentation/computers/getting-started.html

TEXT BOOKS:

1. Internet of Things - A Hands-on Approach, Arshdeep Bahga and Vijay Madisetti, Universities Press,
2015, ISBN: 9788173719547
2. Getting Started with Raspberry Pi, Matt Richardson & Shawn Wallace, O'Reilly (SPD), 2014, ISBN:
9789350239759

REFERENCE BOOKS:

1. Bernd Scholz-Reiter, Florian Michahelles, “Architecting the Internet of Things”, ISBN 978-3- 642-19156-5 e-
ISBN 978-3-642-19157-2, Springer, 2016.
2. N. Ida, Sensors, Actuators and Their Interfaces, SciTech Publishers, 2014.

xxi
v
Course Objectives:
● To introduce the raspberry PI platform, that is widely used in IoT applications.
● To introduce the implementation of distance sensor on IoT devices.

Course Outcomes:
 Ability to introduce the concept of M2M (machine to machine) with necessary protocols and get awareness in
implementation of distance sensor.
 Get the skill to program using python scripting language which is used in many IoT devices.

CO - PO MAPPING:

CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12

Python CO1 3 2 1 1 1 1 - - 1 1 1
Programming
Lab
CO2 1 2 3 2 1 2 1 1 1

CO - PSO MAPPING:

PSO-1 PSO-2
CO1 1 3
CO2 2 3

xxv
Week 4
EXPERIMENT NO:
Installing OS on Raspberry Pi
a) Installation using PiImager
b) Installation using image file
● Downloading an Image
● Writing the image to an SD card
● using Linux
● using Windows
● Booting up Follow the instructions given in the URL
https://www.raspberrypi.com/documentation/computers/getting-started.html

AIM:

PROGRAM:

RESULT:

VIVA QUESTIONS:

xxv
i
SYLLABUS
IOT FOR ENGINEERS LABORATORY
B. TECH II Year I Sem

Week -5:
5. Accessing GPIO pins using Python
a) Installing GPIO Zero library.
First, update your repositories list:
sudo apt update
Then install the package for Python 3:
sudo apt install python3-gpiozero
b) Blinking an LED connected to one of the GPIO pin
c) Adjusting the brightness of an LED Adjust the brightness of an LED (0 to 100, where 100 means
maximum brightness) using the in-built PWM wavelength.

TEXT BOOKS:

1. Internet of Things - A Hands-on Approach, Arshdeep Bahga and Vijay Madisetti, Universities Press,
2015, ISBN: 9788173719547
2. Getting Started with Raspberry Pi, Matt Richardson & Shawn Wallace, O'Reilly (SPD), 2014, ISBN:
9789350239759

REFERENCE BOOKS:

1. Bernd Scholz-Reiter, Florian Michahelles, “Architecting the Internet of Things”, ISBN 978-3- 642-19156-5 e-
ISBN 978-3-642-19157-2, Springer, 2016.
2. N. Ida, Sensors, Actuators and Their Interfaces, SciTech Publishers, 2014.

xxv
ii
Course Objectives:
● To introduce the raspberry PI platform, that is widely used in IoT applications.
● To introduce the implementation of distance sensor on IoT devices.

Course Outcomes:
 Ability to introduce the concept of M2M (machine to machine) with necessary protocols and get awareness in
implementation of distance sensor.
 Get the skill to program using python scripting language which is used in many IoT devices.

CO - PO MAPPING:

CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12

Python CO1 3 2 1 1 1 1 - - 1 1 1
Programming
Lab
CO2 1 2 3 2 1 2 1 1 1

CO - PSO MAPPING:

PSO-1 PSO-2
CO1 1 3
CO2 2 3

xxv
iii
Week 5

EXPERIMENT NO:
Accessing GPIO pins using Python
a) Installing GPIO Zero library.
First, update your repositories list:
sudo apt update
Then install the package for Python 3:
sudo apt install python3-gpiozero
b) Blinking an LED connected to one of the GPIO pin
c) Adjusting the brightness of an LED Adjust the brightness of an LED (0 to 100, where 100 means
maximum brightness) using the in-built PWM wavelength.

AIM:

PROGRAM:

RESULT:

VIVA QUESTIONS:

xxi
x
xxx
SYLLABUS
IOT FOR ENGINEERS LABORATORY
B. TECH II Year I Sem

Week -6:
Collecting Sensor Data
a) DHT Sensor interface
● Connect the terminals of DHT GPIO pins of Raspberry Pi.
● Import the DHT library using import Adafruit_DHT
● Read sensor data and display it on screen.

TEXT BOOKS:

1. Internet of Things - A Hands-on Approach, Arshdeep Bahga and Vijay Madisetti, Universities Press,
2015, ISBN: 9788173719547
2. Getting Started with Raspberry Pi, Matt Richardson & Shawn Wallace, O'Reilly (SPD), 2014, ISBN:
9789350239759

REFERENCE BOOKS:

1. Bernd Scholz-Reiter, Florian Michahelles, “Architecting the Internet of Things”, ISBN 978-3- 642-19156-5 e-
ISBN 978-3-642-19157-2, Springer, 2016.
2. N. Ida, Sensors, Actuators and Their Interfaces, SciTech Publishers, 2014.

xxx
i
Course Objectives:
● To introduce the raspberry PI platform, that is widely used in IoT applications.
● To introduce the implementation of distance sensor on IoT devices.

Course Outcomes:
 Ability to introduce the concept of M2M (machine to machine) with necessary protocols and get awareness in
implementation of distance sensor.
 Get the skill to program using python scripting language which is used in many IoT devices.

CO - PO MAPPING:

CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12

Python CO1 3 2 1 1 1 1 - - 1 1 1
Programming
Lab
CO2 1 2 3 2 1 2 1 1 1

CO - PSO MAPPING:

PSO-1 PSO-2
CO1 1 3
CO2 2 3

xxx
ii
Week 6
EXPERIMENT NO:
Collecting Sensor Data
a) DHT Sensor interface
● Connect the terminals of DHT GPIO pins of Raspberry Pi.
● Import the DHT library using import Adafruit_DHT
● Read sensor data and display it on screen.

AIM:

PROGRAM:

RESULT:

VIVA QUESTIONS:

You might also like