Tybsc It Internet of Things Sem V
Tybsc It Internet of Things Sem V
Tybsc It Internet of Things Sem V
INTERNET OF THINGS
NEDARIYA MOHAMMAD 62
Page|1
TYBSC IT INTERNET OF THINGS SEM V
Practical Journal of
INTERNET OF THINGS
Submitted By
NEDARIYA MOHAMMAD
Bachelor of Science in Information Technology Academic Year
2021-2022
NEDARIYA MOHAMMAD 62
Page|2
TYBSC IT INTERNET OF THINGS SEM V
CERTIFICATE
Examiner’s sign
Date: 24/09/2021
NEDARIYA MOHAMMAD 62
Page|3
TYBSC IT INTERNET OF THINGS SEM V
INDEX
Sr.
Practical Date Signature
No.
NEDARIYA MOHAMMAD 62
Page|4
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO. 1
Raspberry Pi 3 Model B:
The Raspberry Pi 3 is the third generation Raspberry Pi. It replaced the Raspberry Pi 2
Model B in February 2016. Compared to
the Raspberry Pi 2 it has:
• 4 USB ports
• 40 GPIO pins
• Full HDMI port
NEDARIYA MOHAMMAD 62
Page|5
TYBSC IT INTERNET OF THINGS SEM V
• Ethernet port
• Combined 3.5mm audio jack and composite video
• Camera interface (CSI)
• Display interface (DSI)
• Micro SD card slot (now push-pull rather than push-push)
• Video Core IV 3D graphics core
• The Raspberry Pi 3 has an identical form factor to the previous Pi 2 (and Pi 1 Model
B+) and has complete compatibility with Raspberry Pi 1 and 2.
Monitor or TV:
A monitor or TV with HDMI in can be used as a display with a Raspberry Pi. Most
modern television sets and monitors have an HDMI port, and are the easiest to get working
with the Raspberry Pi. You can use an HDMI cable to connect the Raspberry Pi directly to
the television or monitor.
Some older monitors have a DVI port. These work well with the Raspberry Pi,
although you'll need an HDMI-to-DVI adapter to attach to an HDMI cable, or a one-piece
HDMI-to-DVI cable. Some old monitors have a VGA port. These can be trickier to use as
you'll need an HDMI-to-VGA converter, which can change digital video to analogue video. A
simple port adapter won't work.
Ethernet cable:
Ethernet cable will allow your Pi to connect with the internet. It is also useful for
headless setup of Raspberry Pi
Power Supply:
It is recommended that you use a 5V, 2A USB power supply for all models of Raspberry Pi.
NEDARIYA MOHAMMAD 62
Page|6
TYBSC IT INTERNET OF THINGS SEM V
SD Card:
The latest version of Raspbian, the default operating system recommended for the
Raspberry Pi, requires an 8GB (or larger) micro SD card. SD card will store the operating
systems as well as all the file and applications created by you.
Installation Guide:
Now since you have all the required hardware, we will now learn how to get the operating
system onto your microSD card so that you can start using software on your Raspberry Pi.
NEDARIYA MOHAMMAD 62
Page|7
TYBSC IT INTERNET OF THINGS SEM V
1. Begin by placing your SD card into the SD card slot on the Raspberry Pi. It will only
fit one way.
2. Next, plug your keyboard and mouse into the USB ports on the Raspberry Pi.
3. Make sure that your monitor or TV is turned on, and that you have selected the
right input (e.g. HDMI 1, DVI, etc).
4. Connect your HDMI cable from your Raspberry Pi to your monitor or TV.
5. If you intend to connect your Raspberry Pi to the internet, plug an Ethernet cable
into the Ethernet port, or connect a WiFi dongle to one of the USB ports (unless you
have a Raspberry Pi 3).
6. When you're happy that you have plugged all the cables and SD card in correctly,
connect the micro USB power supply. This action will turn on and boot your
Raspberry Pi.
NEDARIYA MOHAMMAD 62
Page|8
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO. 2A
After setting up the raspberry pi and having hands on practice with the Linux
commands, you are now familiar with raspberry pi. Now it’s time to work with the GPIO
pins of the raspberry pi to have an external interface with the raspberry pi.
Hardware Guide:
Along with the basic setup you will require the following components to get started
with the GPIO pins as follows:
1. LED
2. Resistor
3. Connecting wires
4. Breadboard
5. Keyboard
6. Mouse
Before learning this lesson, you must understand the pin numbering system of the GPIO
pins.
GPIO?
One powerful feature of the Raspberry Pi is the row of GPIO (general purpose
input/output) pins along the top edge of the board.
These pins are a physical interface between the Pi and the outside world. At the simplest
level, you can think of them as switches that you can turn on or off (input) or that the Pi
can turn on or off
(output). Of the 40 pins, 26 are GPIO pins and the others are power or ground pins (plus
two ID EEPROM pins which you should not play with unless you know your stuff!)
NEDARIYA MOHAMMAD 62
Page|9
TYBSC IT INTERNET OF THINGS SEM V
Input
GPIO outputs are easy; they are on or off, HIGH or LOW, 3v3 or 0v. Inputs are a bit trickier
because of the way that digital devices work. Although it might seem reasonable just to
connect a button across an input pin and a ground pin, the Pi can get confused as to whether
the button is on or off. It might work properly, it might not. It's a bit like floating about in deep
space; without a reference, it would be hard to tell if you were going up or down, or even what
up or down meant!
Therefore, you will see phrases like "pull up" and "pull down" in Raspberry Pi GPIO tutorials. It's
a way of giving the input pin a reference so it knows for certain when an input is received.
Warning: Randomly plugging wires and power sources into your Pi, however, may kill it. Bad
things can also happen if you try to connect things to your Pi that use a lot of power.
NEDARIYA MOHAMMAD 62
P a g e | 10
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO : 2B
AIM: Displaying Different LED Patterns with Arduino Uno using Tinkercad.
Circuit Diagram:
NEDARIYA MOHAMMAD 62
P a g e | 11
TYBSC IT INTERNET OF THINGS SEM V
Apparatus:
1.LED
2.Resistor
3.Connecting Wire
4.Breadboard Small
5.Arduino Uno R3
6.Keyboard
7.Mouse
Program:
NEDARIYA MOHAMMAD 62
P a g e | 12
TYBSC IT INTERNET OF THINGS SEM V
Void setup1()
{
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
}
Void loop1()
{
digitalWrite(8,HIGH);
digitalWrite(10,LOW);
delay(1000);
digitalWrite(10,HIGH);
digitalWrite(9,LOW);
delay(2000);
digitalWrite(9,HIGH);
digitalWrite(11,LOW);
delay(1500);
digitalWrite(11,HIGH);
digitalWrite(9,LOW);
delay(1000);
}
Void setup2()
{
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
}
Void loop()
{
digitalWrite(9,LOW);
digitalWrite(10,LOW);
delay(1200);
digitalWrite(11,HIGH);
NEDARIYA MOHAMMAD 62
P a g e | 13
TYBSC IT INTERNET OF THINGS SEM V
digitalWrite(8,LOW);
delay(1000);
digitalWrite(10,HIGH);
digitalWrite(11,LOW);
delay(500);
digitalWrite(10,HIGH);
digitalWrite(8,HIGH);
delay(1500);
}
NEDARIYA MOHAMMAD 62
P a g e | 14
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO. 3
Hardware Requirement:
1. Raspberry Pi 3 B+ model
2. LED
3. Power Supply
4. Ethernet Wires
5. Jumper Wires
6. VGA to HDMI connector
7. Monitor
8. Keyboard and Mouse
Connection:
LED Terminal Raspberry Pi Pin Number
LED Positive Pin 35
LED Negative Pin 6 (GND)
Install Telegram App. in mobile. Follow the process to obtain access token.
NEDARIYA MOHAMMAD 62
P a g e | 15
TYBSC IT INTERNET OF THINGS SEM V
Code: telegram.py
#LED Red
GPIO.setup(red,GPIO.OUT)
GPIO.output(red,0)#off initially
def action(msg):
chit_id=msg['chat']['id']
command= msg['text']
print('Received: %s' % command)
if 'on' in command:
message = "on"
if 'red' in command:
message = message + "red "
telegram_bot.sendMessage (chat_id, message)
if 'off in command:
message "Off "
if 'red' in command:
message = message + "red
GPIO.output(red, O)
NEDARIYA MOHAMMAD 62
P a g e | 16
TYBSC IT INTERNET OF THINGS SEM V
telegram_bot =
telepot.Bot('1460601618:AAFuyR4h42rHjypmgx2K6ko6UStBo4JsV_Q')
print (telegram_bot.getMe())
MessageLoop(telegram_bot,action).run_as_thread()
print ('Up and Running... ')
while 1:
time.sleep(5)
NEDARIYA MOHAMMAD 62
P a g e | 17
TYBSC IT INTERNET OF THINGS SEM V
NEDARIYA MOHAMMAD 62
P a g e | 18
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO. 4
AIM: DISPLAYING TIME OVER 4-DIGIT 7-SEGMENT DISPLAY USING RASPBERRY PI.
To display small amount of data with Raspberry Pi, we can use 4 digit 7-segment Display. 7
Segment Display has seven segments in it and each segment has one LED inside it to display
the numbers by lighting up the corresponding segments.
Hardware Requirements
1. Raspberry Pi Model A/B/B+
2. 4 digit 7 Segment Display
3. Jumper wires (Female to Female)
Software Requirements
1. Raspbian Stretch OS
1. Connect your 4 digit 7 segment display with Raspberry Pi's GPIO Pins.
TM1637 Board
Function RPI Physical Pin Raspberry Function
Pin
GND Ground 14 GND
NEDARIYA MOHAMMAD 62
P a g e | 19
TYBSC IT INTERNET OF THINGS SEM V
VCC + 5V Power 4 5V
Note: This Script file contains some of the important functions, which are required to add in
our Python script.
NEDARIYA MOHAMMAD 62
P a g e | 20
TYBSC IT INTERNET OF THINGS SEM V
import sys
import time
import datetime
import RPi.GPIO as GPIO
import tm1637
#CLK ->GPIO23(Pin16)
#Di0 -> GPIO24 (Pin18)
Display = tm1637.TM1637(23,24,tm1637.BRIGHT_TYPICAL)
import sys import time import datetime import
Display.Clear()
Display.SetBrightnes(1)
while(True): now =
datetime.datetime.now()
hour = now.hour minute =
now.minute second =
now.second
currenttime = [ int(hour / 10), hour % 10, int(minute / 10), minute % 10 ]
Display.Show(currenttime)
Display.ShowDoublepoint(second % 2)
time.sleep(1)
The above script needs the tm1637.py script to work, so place both files in the same folder.
Script functions
The clock script uses the following functions, defined in tm1637.py: the
Display. Clear () - Clears display if in dividual LEDs are still active.
- After thi you can adjust the brightness of the display, at least 0 and
maximum 7.
Display.SetBrightnes(x) Display. Sh
ow(x,x,x,x) - Show the actual 4 digits (digits), x can be 0 to
9.
Display.ShowDoublepoint (status) - Co ntrolling the ':' between the second and third digit, true
NEDARIYA MOHAMMAD 62
P a g e | 21
TYBSC IT INTERNET OF THINGS SEM V
NEDARIYA MOHAMMAD 62
P a g e | 22
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO. 5
Hardware Requirement:
1) Raspbeny Pi 3 B+ model
2) Pi camera module
3) Power Supply
4) Ethemet Cable
5) VGA to HDMI connector
6) Monitor
7) Keyboard and Mouse
Connection :
NEDARIYA MOHAMMAD 62
P a g e | 23
TYBSC IT INTERNET OF THINGS SEM V
Code:
camera.py
#To capture a photo
import picamera
import time
camera=picamera.Picamera()
camera.resolution=(1024, 768)
camera.start_preview()
time. sleep(3)
camera.capture('test_photo.jpg")
print ('Done')
Connecting Pi Camera
l) To enable the camera via the command line type following command:
sudo raspi-config
Select option 5, finterfacmg options", and then open "Pi Camera".
2) To Install the updates:
Select option 8, " Update".
3) To complete the process perform a reboot
sudo reboot
NDARIYA MOHAMMAD 62
P a g e | 24
TYBSC IT INTERNET OF THINGS SEM V
2) Vide.py
#To record a video
import picamera
camera=picamera.PiCamera()
camera.resolution=(640,480)
camera.start_preview()
camera.start_recording('test_video_h264')
camera.wait_recording(15)
camera.stop_recording()
print('Finished')
NEDARIYA MOHAMMAD 62
P a g e | 25
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO. 6
Connection:
VCC 5V
GND GND
TxD RxD
RxD TxD
NEDARIYA MOHAMMAD 62
P a g e | 26
TYBSC IT INTERNET OF THINGS SEM V
Step 1: Checking the working USB port and connections and working of GPS module.
NEDARIYA MOHAMMAD 62
P a g e | 27
TYBSC IT INTERNET OF THINGS SEM V
Command: gpsmon
cgps – s
NEDARIYA MOHAMMAD 62
P a g e | 28
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO. 7
Instatlation Mannual
RFID stands for Radio Frequency Identification uses radio frequency to read information
stored
in a RFID card or tag. Each card has a unique ID and this makes it a perfect choice for many
authentication applications. The RFID authention systems are easy to design and are cheap
in
cost. Interfacing RFID Reader with Raspberry Pi can be very useful as you can implement a
wide
range of applications like:
1)Access Control
2)Authentication
3)e-Ticket,e-Payment,c-Toll
4)Attendance System
Hardware Requirements
NEDARIYA MOHAMMAD 62
P a g e | 29
TYBSC IT INTERNET OF THINGS SEM V
SOFTWARE REQUIREMENTS
1.Raspbian Stretch OS
2.SPI Supporting Libraries
3.RC522 Python Library
NEDARIYA MOHAMMAD 62
P a g e | 30
TYBSC IT INTERNET OF THINGS SEM V
STEP 6: Install the MFRC522 library using pip that helps talk to the RC522 module over the
SPI interface.
STEP 7:Install the MFRC522 library using pip that helps to talk to the RC522 module over the
SPI interface.
NEDARIYA MOHAMMAD 62
P a g e | 31
TYBSC IT INTERNET OF THINGS SEM V
STEP 8: Write python script which is uesd to write data from the RFC522 to your RFID tags.
Write.py
Import RPi.GPIO as GPIO
From mfrc522 import SimpleMFRC522
Reader=SimpleMFRC522()
#WELCOME MESSAGE
print(“Looking for cards”)
print(“Press Ctrl+c to stop”)
try:
text=input(‘enter new data:’)
print(“Now place your tag to write……”)
reader.write(text)
print(“Data Written Successfully”)
finally:
GPIO.cleanup()
NEDARIYA MOHAMMAD 62
P a g e | 32
TYBSC IT INTERNET OF THINGS SEM V
When you run script ,it asked to write in the new data,in my case I am going to just type in
msd gurukul.Press Enter when you are happy with what you have written.
With that done,simply place your RFID tag on the top of your RFID RC522 circuit. As soon as
it detects it,it will immediately write the new data to the tag.You should see”Data written
successfully” appear in your command line if it was successful.
STEP 8:write python script which is used to read this data back off the RFID tag.
Read.py
Reader=SimpleMFRC522()
#WELCOME MESSAGE
print(“Looking for cards”)
print(“Press Ctrl+c to stop”)
try:
id,text=reader.read()
print(id)
print(text)
finally:
GPIO.cleanup()
NEDARIYA MOHAMMAD 62
P a g e | 33
TYBSC IT INTERNET OF THINGS SEM V
With the script now running ,all you need to do is place your RFID Tag on your RFID RC522
circuit .As soon as the Python scripts detects the RFID tag being placed on the top,it will
immediately read the data and print it back out to you.
If you successfully receive data back from your read.py script with the text that you pushed
to the card using your write.py script then you have successfully set up your raspberry pi to
connect with your RFID RC522 circuit.
NEDARIYA MOHAMMAD 62
P a g e | 34
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO. 8
Installation Manual
Finger Print Sensor, which we used to verify the identity of a person for various purposes.
Nowadays we can see fingerprint-based systems everywhere in our daily life.
Hardware Requirements
1. Raspberry Pi Model A/B/B+
2. Fingerprint Module
R307 Fingerprint Module consists of optical fingerprint sensor, Supply voltage: DC 4.2 ~
6.0V
Pin No Pin Name Details
1 5V Regulated 5V DC
NEDARIYA MOHAMMAD 62
P a g e | 35
TYBSC IT INTERNET OF THINGS SEM V
Software Requirements
1. Raspbian Stretch OS
1. Now, just connect fingerprint module to Raspberry Pi USB port by using USB to
Serial converter.
Step 1: To install this library, root privileges are required. So login with root user.
NEDARIYA MOHAMMAD 62
P a g e | 36
TYBSC IT INTERNET OF THINGS SEM V
wget http://apt.pm-codeworks.de/pm-codeworks.list -P
/etc/apt/sources.list.d/
Step 5: To return to the normal shell (under the Pi user), type exit
Step 6: Now check USB port on which your finger print sensor is connected. Use this USB
port in our Python script.
NEDARIYA MOHAMMAD 62
P a g e | 37
TYBSC IT INTERNET OF THINGS SEM V
Step 8: Run sample file, to test to see if the sensor is detected and ready for access
The above data should appear, which allows you to display the positions under which an
imprint is stored by selecting a page (0-3).
If here you get Exception message, then something is wrong with the cabling or the
sensor. Check it again.
Step 9: Now execute other scripts, to make sure Fingerprint module is working .
Script Usage
NEDARIYA MOHAMMAD 62
P a g e | 38
TYBSC IT INTERNET OF THINGS SEM V
Put your finger on the glass surface, wait for the instruction in the terminal and remove
your finger as soon as it is written there. Afterwards you have to put your finger a second
time for the verification and the imprint is stored in the next number.
Execute same script again, this time use other finger which is not previously stored.
If fingerprint is not detected, then gives "No match Found" message
NEDARIYA MOHAMMAD 62
P a g e | 39
TYBSC IT INTERNET OF THINGS SEM V
PRACTICAL NO. 9
Hardware requirement:
1. Raspberry Pi 3.
4. HDMI cable.
5. Access to a PC.
6. Ethernet cable.
Step 1:
Insert microSD card in a card reader and connect the card reader to PC.
Step 2:
Using SD Formatter software format your SD card.
Step 3:
Open any browser and search for ‘Windows 10 developer center’.
NEDARIYA MOHAMMAD 62
P a g e | 40
TYBSC IT INTERNET OF THINGS SEM V
Step 4: Click on Windows development center weblink and type ‘/iot’ in url. Hit enter
button.
Step 5:
Go to ‘Download’ tab. And Download Windows 10 IoT Core Dashboard
NEDARIYA MOHAMMAD 62
P a g e | 41
TYBSC IT INTERNET OF THINGS SEM V
Step 6:
Run the downloaded setup file to install the application. Once the installation is successful,
you can launch IoT dashboard.
Step 7:
Select Set up a new device from the sidebar.
Enter the required details. And select the correct drive for your microSD card. Give device a
name and admin password. Accept the license and click on Download and Install Button.
Step 8:
The application will now download the necessary files from Microsoft and flash them to
your microSD card.
NEDARIYA MOHAMMAD 62
P a g e | 42
TYBSC IT INTERNET OF THINGS SEM V
Once the image has been installed on the microSD card, eject the SD card from your PC and
insert to the Raspberry Pi. First connect the power supply, HDMI cable and Ethernet cable.
Connect the HDMI cable to your chosen display, connect keyboard and mouse and power it
up.
NEDARIYA MOHAMMAD 62
P a g e | 43