Vous êtes sur la page 1sur 54

VSIT Internet of Things Lab Manual

Experiment No: - 1
Aim:
Starting Raspbian OS, familiarizing with raspberry pi components and Interface, connecting to
ethernet, monitor, USB.

Abstract:
The Raspberry Pi is a mini computer specifically created to make tech learning easier. It has a
lot of components for computer-based projects, like USB ports, an Ethernet port, an SD card
slot, Wi-Fi antenna ports, and more.

Required Components:
1. Hardware:
Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
Micro SD USB card reader 1
A Monitor that supports HDMI 1
An HDMI cable 1
An Ethernet cable 1

2. Software:
Raspbian, installed via NOOBS

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

1. USB ports - these are used to connect a mouse and keyboard. You can also connect
other components, such as a USB drive.
2. SD card slot - you can slot the SD card in here. This is where the operating system
software and your files are stored.
3. Ethernet port - this is used to connect the Raspberry Pi to a network with a cable. The
Raspberry Pi can also connect to a network via wireless LAN.
4. Audio jack - you can connect headphones or speakers here.
5. HDMI port- this is where you connect the monitor (or projector) that you are using to
display the output from the Raspberry Pi. If your monitor has speakers, you can
also use them to hear sound.
6. Micro USB power connector - this is where you connect a power supply. You should
always do this last, after you have connected all your other components.
7. GPIO ports -these allow you to connect electronic components such as LEDs and
buttons to the Raspberry Pi.

Procedure:
1. Insert the SD card into your SD card reader. Note the drive letter assigned to the SD
card. You can see the drive letter in the right hand column of Windows Explorer.
2. Run the Win32DiskImager utility from desktop or menu.
3. Select the image file and click on Write Button.

4. Remove SD Card & Insert in Raspberry Pi

5. Connect the mouse & Keyboard to USB port of Raspberry Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

6. Connect Raspberry Pi to HDMI port Directly or use HDMI to VGA connector.

7. Connect the Pi to the internet via Ethernet, use an Ethernet cable to connect the
RaspberryPi.

8. Sound will come if it has speakers or connect headphones or speakers to the Audio jack
if necessary

9. Plug the power supply into a socket and connect it to the micro USB power port.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

10. Red light will indicate Power On and Green Will Indicate the booting of the Raspberry
Pi. The Pi will boot up into a graphical desktop

11. Configuring your Pi:


a. You can control most of your Raspberry Pi’s settings, such as the password, through
the Raspberry Pi Configuration application found in Preferences on the menu

b. System: In this tab you can change basic system settings of your Pi.

Password - set the password of the pi user (it is a good idea to change the password from the
factory default ‘raspberry’)

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Boot - select to show the Desktop or CLI (command line interface) when your Raspberry Pi
starts
Auto Login- enabling this option will make the Raspberry Pi automatically log in whenever it
starts
Network at Boot-selecting this option will cause your Raspberry Pi to wait until a network
connection is available before starting
Splash Screen -choose whether or not to show the splash (startup) screen when your Raspberry
Pi boots
Resolution - you can set the screen resolution here
Underscan - choose whether your Pi should show black bars at the top and bottom of the screen
when it can’t match the screen resolution

c. Interfaces:
You can link devices and components to the Raspberry Pi using a lot of different types of
connections. The Interfaces tab is where you turn these different connections on or off, so that
the Pi recognizes that you’ve linked something to it via a particular type of connection.

Camera - enable the Raspberry Pi Camera Module


SSH - allow remote access to your Raspberry Pi from another computer using SSH
VNC - allow remote access to the Raspberry Pi Desktop from another computer using VNC
SPI -enable the SPI GPIO pins
I2C - enable the I2C GPIO pins
Serial -enable the Serial (Rx, Tx) GPIO pins
1- Wire - enable the 1-Wire GPIO pin
Remote GPIO - allow access your Raspberry Pi’s GPIO pins from another computer.

d. Performance:
If you need to do so for a particular project you want to work on, you can change the
performance settings of your Pi in this tab.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Overclock - change the CPU speed and voltage to increase performance


GPU Memory - change the allocation of memory given to the GPU

e. Localisation

This tab allows you to change your Raspberry Pi settings to be specific to a country or location.
Locale -set the language, country, and character set used by your Raspberry Pi
Timezone- set the time zone
Keyboard - change your keyboard layout
Wi-Fi Country - set the Wi-Fi country code

12. After starting with Raspberry Pi for the first time, the Welcome to RaspberryPi
application will pop up and it will guide through the initial setup.
13. Click Next to start the setup.
14. Set respective Country, Language, and Time zone, then click Next again.

15. Enter a new password for Raspberry Pi and click next.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

16. Connect to your Wi-Fi network by selecting its name, entering the password, and
clicking next

17. Click next let the wizard check for updates to Raspbian and install.

18. Click done or Reboot to finish the setup.

Conclusion:
Thus, Raspbian OS was installed, Raspberry Pi Components and Interface were studied and
implemented, Raspberry was also Connected to ethernet, Monitor, USB.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 2

Aim:
Displaying different LED patterns with Raspberry Pi.

Abstract:
This project deals with displaying different LED patterns using module MAX7219 that uses
SPI interface.

Required Components:
Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
MAX7219 1
Discover Board 1

Interfacing Diagram:

Procedure:
Step 1: Connection of Discover Development Board

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

a. Connect 7 segment display board to Connector No 6 (CN 6) of Discover Development


Board.
b. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development
Board and the other end to GPIO pins of Raspberry Pi in such a way that the arrow
must point towards the SD Card and Pin No 1 of Raspberry Pi.
c. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board.
(Check positive and negative and don’t switch ON power supply until all connections
are connected properly)

Step 2: Connection of Raspberry Pi.

a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.


b. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to VGA
convertor.

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


a. Username: pi
b. Password: raspberry

Step 5: Create a new file with an extension .py

Step 6: Open the file with Python 2 IDLE only.

Step 7: Type and run the program and see the output on 7 segment display board.

Conclusion:
Thus, we have studied and displayed different LED patterns with Raspberry Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 3

Aim:
Displaying Time over 4-Digit 7-Segment Display using Raspberry Pi.

Abstract:
This project deals with Interfacing of 4-digit Seven Segment Display Module with Raspberry
Pi and display Time over it. Only two data wires are required for I2C – a data line (SDA) and
a clock line (SCL).

Required Components:
Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
4-Digit 7-Segment Display Module 1
Discover Board 1

Interfacing Diagram:

4-digit 7-Segment Display Module

Procedure:
Step 1: Connection of Discover Development Board

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

a. Connect 4-Digit 7 segment display board to Connector No 2 (CN 2) of Discover


Development Board.
b. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development
Board and the other end to GPIO pins of Raspberry Pi in such a way that the arrow
must point towards the SD Card and Pin No 1 of Raspberry Pi.
c. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board.
(Check positive and negative and don’t switch ON power supply until all connections
are connected properly)

Step 2: Connection of Raspberry Pi.

a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.


b. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to VGA
convertor.

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


a. Username: pi
b. Password: raspberry

Step 5: Create a new file with an extension .py

Step 6: Open the file with Python 2 IDLE only

Step 7: Type and run the program and see the output on 4-Digit 7 segment display
board.

Conclusion:
Thus, we have studied and displayed Time over 4-Digit 7-Segment Display using Raspberry
Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 4

Aim:
Raspberry Pi Based Oscilloscope

Abstract:
The oscilloscope is an electronic test instrument that allows the visualization and observation
of varying signal voltages, usually as a two-dimensional plot with one or more signals plotted
against time. Today’s project will seek to replicate the signal visualization capabilities of the
oscilloscope using the Raspberry Pi and an analog to digital converter module.

Required Components:
Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
ADS1115ADC 1
Discover Board 1
Analog Input As per availability 1

Interfacing Diagram:

Procedure:
Step 1: Connection of Discover Development Board

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

a. Connect ADC module to Connector No 2 (CN 2) of Discover Development Board.


b. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development Board
and the other end to GPIO pins of Raspberry Pi in such a way that the arrow must point towards
the SD Card and Pin No 1 of Raspberry Pi.
c. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board. (Check
positive and negative and don’t switch ON power supply until all connections are connected
properly)

Step 2: Connection of Raspberry Pi.

a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.


b. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to VGA
convertor.

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


a. Username: pi
b. Password: raspberry

Step 5: Create a new file with an extension .py

Step 6: Open the file with Python 2 IDLE only.

Step 7: Type and run the program and see the output on terminal.

Conclusion:
Thus, Raspberry Pi Based Oscilloscope has been studied and implemented.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: - 5

Aim:
Control Raspberry Pi via Telegram Messenger.

Abstract:
This project deals with how to automatically run scripts for text commands via Telegram after
the installation on the Raspberry was covered in the previous tutorial. This allows you to, for
example, easily query the status of your Pi’s on the go or simply perform actions remotely via
your messenger.

Required Components:
Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
Discover Board 1

Interfacing Diagram:

Procedure:
Step 1: Connection of Discover Development Board

a. Connect Relay Driver to Connector No 7 (CN 7) of Discover Development Board.


b. Connect AC Lamp and Fan across the relay.
c. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development Board
and the other end to GPIO pins of Raspberry Pi in such a way that the arrow must point towards
the SD Card and Pin No 1 of Raspberry Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

d. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board. (Check


positive and negative and don’t switch ON power supply until all connections are connected
properly)

Step 2: Connection of Raspberry Pi.

a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.


b. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to
VGA convertor.

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


a. Username: pi
b. Password: raspberry

Procedure to install “Telegram App” on your smart phone and preparing “Raspberry Pi” to control
Lamp, Fan, etc. connected across relays on Discover Development Board.

Step 5: Installing Telegram App on your smart phone (Only for Android smartphone,
WIFI or mobile data should be ON)

Open “Google Playstore” app in your android mobile.

Search for “Telegram” in search option.

Install the “Telegram” app by clicking on install button highlighted in green colour.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Open the telegram app in your mobile.

Click on “START MESSAGING” button.

Enter your “mobile number” to register with telegram service.

Step 6: Now, configure “Telegram App” for controlling Raspberry Pi.

Now, go in “Search option” in your telegram app and search for the name “BotFather”

Click on “BotFather” and you will see the screen below

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• Click on “START” and you will get some chat information from telegram read it
carefully and understand it properly for using the telegram. More information you will
find on telegram website and its online tutorials.
• Now carefully follow the steps to generate “Token Key” so that you can connect with
your raspberry pi.
• The same “Token Key” will be added to your python program script to control relays.

NOTE: All Telegram commands starts with “/” { example: /start }


• Now type “/start” in message area as shown below.

• You will see something as shown below after above step.

• Now, type “/newbot” in message area and click on send. You will see screen as shown
below.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• Now, “botfather” is asking your you to choose the name for your bot. I have selected
“discoverlab” as the name. Then, “botfather” asks for a username for your bot. I have
replied with username as “discoverBot”. You can use your own “username”

• Thus, you will see reply from “botfather” as shown below.

• Thus, for security reason, I have hidden my token key as shown above. Note down your
token key somewhere in text editor or book so that you can copy it to your python script.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Step 7: Program raspberry pi with Telegram TOKEN key to control devices connected
across relays.
• Now, start Raspberry Pi and right click and create python file with name “main.py”
which steps are shown below.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• Now, you have created python file with name “main.py”. Right click on it and open
with python 2 idle. Make the below change in the program

• Replace current Token Key with your own key.


• Finally, you check all the hardware connection on development board and run the
program and enjoy controlling your devices like fan and light.

Conclusion:
Thus, we have studied and implemented how to Control Raspberry Pi via Telegram Messenger.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 6

Aim:
Setting up Wireless Access Point using Raspberry Pi.

Abstract:
The Raspberry Pi can do a lot, especially now the new Raspberry Pi comes with wireless
capabilities already on board. By turning Raspberry Pi into a wireless access point, it will be
act as a router.

Required Components:
Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
WiFi USB dongle 1
Discover Board 1
Ethernet Cable 1

Interfacing Diagram:

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Procedure:
Step 1: Install, update and upgrade RaspPi

This is done using following commands:


sudo apt-get update
sudo apt-get upgrade

after this reboot pi with sudo reboot.

Step 2: Install hostapd and dnsmasq


• Install the software that will make pi as a wireless access point and also the software
that helps assign network address to devices that connect to the AP.

This is done using following commands:


sudo apt-get install dnsmasq
sudo apt-get install hostapd

• hostapd is the package that lets us create a wireless hotspot using a Raspberry Pi, and
dnsmasq is an easy-to-use DHCP and DNS server. To edit the programs’ configuration
files, disable them from running in the background.

This is done using following commands:


sudo systemctl stop dnsmasq
sudo systemctl stop hostapd

Step 3: Configure a static IP for the wlan0 interface


• Confirm the wlan port on which the wireless device being used is connected. This can
be done by editing the dhcpcd config file. To edit the configuration file, use the
command:
sudo nano /etc/dhcpcd/.conf

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• At the bottom of config file add the following lines.


interface wlan0
static ip_address=192.168.4.1/24
• After adding the lines, the config file should look like the image below.

After these, press Ctrl+X, then Y, then Enter to save the file and exit the editor.

Step 4: Configure the DHCP server (dnsmasq)


• Here dnsmasq used as a DHCP server. The role of a DHCP server is to dynamically
distribute network configuration parameters, such as IP addresses, for interfaces and
services. dnsmasq’s default configuration file contains a lot of unnecessary
information,so instead of editing rename the default configuration file and write a new
one:
interface=wlan0
dhcp-range=192.168.0.11,192.168.0.30,255.255.255.0,24h
• The lines were added meant that provided IP addresses are between 192.168.0.11 and
192.168.0.30 for the wlan0 interface.

Step 5: Configure the access point host software (hostapd)


• Configure the wireless access point, these will be done using a file called
hostapd.conf in /etc/hostapd folder.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Open it up:
sudo nano /etc/hostapd/hostapd.conf

and paste these lines:


interface=wlan0
bridge=br0
ssid=miniProjects
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=subscribe
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Now change the ssid and password, save the config file and exit. show the location of the
configuration file to the system:
sudo nano /etc/default/hostapd

find the line with daemon_conf as shown in the image below.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Uncomment the DAEMON_CONF line and add the line in between the quotes in front of the
“equal to” sign.
/etc/hostapd/hostapd.conf

Step 6: Set up traffic forwarding


• First enable hostapd and dnsmasq using
sudo systemctl start dnsmasq
sudo systemctl start hostapd
• For outbound traffic it is needed to add routing and masquerade. To do this, edit the
config file of the systemctl by running:
sudo nano /etc/sysctl.conf
• Uncomment this line net.ipv4.ip_forward=1

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• Save the config file and exit using ctrl+x followed by y.

Step 7: Add a new iptables rule


• To add IP masquerading for outbound traffic on eth0 using iptables,run the following
commands:
sudo iptables –t nat –A POSTROUTING –o eth0 –j MASQUERADE
and save the new iptables rule:
sudo sh –c “iptables-save>/etc/iptables.ipv4.nat”
• To load the rule on boot, edit the file /etc/rc.local and add the following line just above
the line exit 0:
Iptables-restore < /etc/iptables.ipv4.nat

Step 8: Enable internet connection


• Now the Raspberry Pi is acting as an access point to which other devices can connect.
However, those devices can’t use the Pi to access the internet just yet. To make the
possible, we need to build a bridge that will pass all traffic between the wlan0 and eth0
interfaces.
• To build the bridge, let’s install one more package:
sudo apt-get install bridge-utils
Now add a new bridge (called br0):
sudo brctl addbr br0
Next, connect the eth0 interface to selected bridge:
sudo brctl addif br0 eth0
Finally, edit the interface files
sudo nano /etc/network/interfaces
and add the following lines at the end of the file:
auto br0
iface br0 inet manual
bridge_ports etho wlan0

Step 9: Reboot
Reboot with sudo reboot. Now Raspberry Pi will work as a wireless access point.

Conclusion:
Thus, we have studied and implemented the setup of Wireless Access Point using Raspberry
Pi

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 7

Aim:
Fingerprint Sensor interfacing with Raspberry Pi.

Abstract:
Finger Print Sensor is now become very common to verify the identity of a person for various
purposes. In present time we can see fingerprint-based systems everywhere in our daily life
like for attendance in offices, employee verification in banks, for cash withdrawal or deposits
in ATMs, for identity verification in government offices etc. We have already interfaced it with
Arduino, today we are going to interface Fingerprint Sensor with Raspberry Pi. Using this
Raspberry Pi Fingerprint System, we can enroll new finger prints in the system and can delete
the already fed finger prints.

Required Components:

Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
Discover Board 1
USB to TTL converter 1
Fingerprint Module 1
16x2 LCD 1

The Raspberry Pi has two pins (pin 8 / GPIO14 and pin 10 / GPIO 15), but they work with
3.3V. Since there are different fingerprint sensors, which do not all work with 3.3V, a USB
UART converter is recommended.

Interfacing Diagram:

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Procedure:
Step 1: Connection of Discover Development Board
a. Connect LCD module to Connector No 4 (CN 4) of Discover Development Board.
b. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development
Board and the other end to GPIO pins of Raspberry Pi in such a way that the arrow
must point towards the SD Card and Pin No 1 of Raspberry Pi.
c. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board.
(Check positive and negative and don’t switch ON power supply until all connections
are connected properly)

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Step 2: Connection of Raspberry Pi.

a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.


b. Connect Fingerprint module to USB of Raspberry Pi.
c. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to
VGA convertor.

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


a. Username: pi
b. Password: raspberry

Step 5: Create a new file with an extension .py

Step 6: Open the file with Python 2 IDLE only.

Step 7: Type and run the program and see the output on terminal and LCD module.

Conclusion:
Thus, we have studied and interfaced Fingerprint Sensor with Raspberry Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 8

Aim:
GPS Module Interfacing with Raspberry Pi.

Abstract:
GPS plays a prominent role in the present-day navigation systems, starting out with
smartphones and automobiles to much complex missile guidance systems. Raspberry Pi,
interfaced with a GPS module, can be used for developing an advanced real-time navigation
system. Incorporating the Pi’s image processing, audio processing and web interface
capabilities along with the GPS data we can develop advanced navigation schemes for real-
time implementation.

Required Components:
Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
USB to TTL converter 1
Discover Board 1
GPS Module 1
16x2 LCD 1

The Raspberry Pi has two pins (pin 8 / GPIO14 and pin 10 / GPIO 15), but they work with
3.3V. Since there are different GPS Module, which do not all work with 3.3V, a USB UART
converter is recommended

Interfacing Diagram:

Procedure:
Step 1: Connection of Discover Development Board
a. Connect LCD module to Connector No 4 (CN 4) of Discover Development Board.
b. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development
Board and the other end to GPIO pins of Raspberry Pi in such a way that the arrow
must point towards the SD Card and Pin No 1 of Raspberry Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

c. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board.


(Check positive and negative and don’t switch ON power supply until all connections
are connected properly)

Step 2: Connection of Raspberry Pi.


a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.
b. Connect GPS module to USB port of Raspberry Pi.
c. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to
VGA convertor.

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


a. Username: pi
b. Password: raspberry

Step 5: Create a new file with an extension .py

Step 6: Open the file with Python 2 IDLE only.

Step 7: Type and run the program and see the output on terminal and the LCD module.

Code:
import serial
import time
import RPi.GPIO as GPIO
import sys
from threading import Thread

#############GPIO configuration#######
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
######################################

################## Lcd defines #################


# Define GPIO to LCD mapping
LCD_RS = 13
LCD_E = 19
LCD_D4 = 6
LCD_D5 = 5
LCD_D6 = 21
LCD_D7 = 26

#configure GPIO as output


GPIO.setup(LCD_E, GPIO.OUT) # E
GPIO.setup(LCD_RS, GPIO.OUT) # RS
GPIO.setup(LCD_D4, GPIO.OUT) # DB4
GPIO.setup(LCD_D5, GPIO.OUT) # DB5
GPIO.setup(LCD_D6, GPIO.OUT) # DB6
GPIO.setup(LCD_D7, GPIO.OUT) # DB7
# Define some device constants

LCD_WIDTH = 16 # Maximum characters per line


LCD_CHR = True
LCD_CMD = False

LCD_LINE_1 = 0x80 # LCD RAM address for the 1st line

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

LCD_LINE_2 = 0xC0 # LCD RAM address for the 2nd line

# Timing constants
E_PULSE = 0.0005
E_DELAY = 0.0005

LCD_SCRL_DEL = 0.14529 #LCD scrolling delay

#LCD function to initialize, display character on it.


def lcd_init():
# Initialise display
lcd_byte(0x33,LCD_CMD) # 110011 Initialise
lcd_byte(0x32,LCD_CMD) # 110010 Initialise
lcd_byte(0x06,LCD_CMD) # 000110 Cursor move direction
lcd_byte(0x0C,LCD_CMD) # 001100 Display On,Cursor Off, Blink Off
lcd_byte(0x28,LCD_CMD) # 101000 Data length, number of lines, font size
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)

def lcd_byte(bits, mode):


# Send byte to data pins
# bits = data
# mode = True for character or False for command

GPIO.output(LCD_RS, mode) # RS
# High bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x10==0x10:
GPIO.output(LCD_D4, True)
if bits&0x20==0x20:
GPIO.output(LCD_D5, True)
if bits&0x40==0x40:
GPIO.output(LCD_D6, True)
if bits&0x80==0x80:
GPIO.output(LCD_D7, True)

# Toggle 'Enable' pin


lcd_toggle_enable()

# Low bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x01==0x01:
GPIO.output(LCD_D4, True)
if bits&0x02==0x02:
GPIO.output(LCD_D5, True)
if bits&0x04==0x04:
GPIO.output(LCD_D6, True)
if bits&0x08==0x08:
GPIO.output(LCD_D7, True)

# Toggle 'Enable' pin


lcd_toggle_enable()

def lcd_toggle_enable():
# Toggle enable
time.sleep(E_DELAY)
GPIO.output(LCD_E, True)
time.sleep(E_PULSE)
GPIO.output(LCD_E, False)
time.sleep(E_DELAY)

def lcd_string(message,line):

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

# Send string to display


message = message.ljust(LCD_WIDTH," ")
lcd_byte(line, LCD_CMD)
for i in range(LCD_WIDTH):
lcd_byte(ord(message[i]),LCD_CHR)

def lcd_string_scroll(message, line, SCL_DELAY):


string = message.strip()
string = " " + string
#print "length = " + str(len(string))
if line == 1:
lcd_string(" ", line)
for i in range(len(message)+1+16):
lcd_string(string, line)
time.sleep(SCL_DELAY)
string = string[1:] + " "
pass
else:
lcd_string(" ", line)
for i in range(len(message)+1+16):
lcd_string(string, line)
time.sleep(SCL_DELAY)
string = string[1:] + " "
pass
################## End of Lcd defines ###############

################## User function ####################


def delayms(time_in_msec):
time.sleep( (time_in_msec/1000) )
pass
def delaysec(time_in_sec):
time.sleep(time_in_sec)
################# End of User function #################
try:
ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=0.050)
pass
except:
try:
ser = serial.Serial('/dev/ttyUSB1', 9600, timeout=0.050)
pass
except:
try:
ser = serial.Serial('/dev/ttyUSB2', 9600, timeout=0.050)
pass
except:
try:
ser = serial.Serial('/dev/ttyUSB3', 9600, timeout=0.050)
pass
except Exception as e:
print "Error connecting to GPS module!\nerror:" + str(e)
exit(0)
pass
pass
pass
pass

def main():
lcd_init()
while True:
while ser.inWaiting(): #Waiting here unless some string is recieve
gps_str = str(ser.readline())
gpgga = []
if "$GPGGA" in gps_str:
gps_str = gps_str.translate(None,"\n\r$")
gpgga = gps_str.split(",")
#print gpgga #print GPS whole string that is receiving
standard = gpgga[0]
utc = gpgga[1]

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

lat = gpgga[2]
lat_direction = gpgga[3]
lon = gpgga[4]
lon_direction = gpgga[5]
quality = gpgga[6]
no_of_sats = gpgga[7]
hdop = gpgga[8]
alt = gpgga[9]
a_units = gpgga[10]
undulation = gpgga[11]
u_units = gpgga[12]
age = gpgga[13]
stn_id = gpgga[14][:gpgga[14].find("*")]
checksum = gpgga[14][(gpgga[14].find("*")+1):]
print ("\n" * 50)
print "Standard = " + standard
print "UTC = " + utc
print "Lattitude = " + lat
print "Lattitude Direction = " + lat_direction
print "Longitude = " + lon
print "Longitude Direction = " + lon_direction
print "Quality = " + quality
print "Number of Satellites = " + no_of_sats
print "Horizontal Dilution of Precision = " + hdop
print "Altitude = " + alt
print "Units of Antenna Altitude = " + a_units
print "Undulation = " + undulation
print "Units of Undulation = " + u_units
print "Age = " + age
print "Station ID = " + stn_id
print "Checksum = " + checksum
lcd_string("Loc. Tracking ",LCD_LINE_1)
#lcd_string(lat[:lat.find(".")] + " " + lat_direction +
", " + lon[:lon.find(".")] +
" " + lon_direction, LCD_LINE_2)

lcd_string(lat[:2] + str(chr(223)) + lat[2:4] + " " + lat_direction + ", " +


lon[1:3] + str(chr(223)) + lon[3:5] + " " + lon_direction, LCD_LINE_2)

if name == ' main ':


try:
main()
except KeyboardInterrupt:
pass
finally:
lcd_string("Program ",LCD_LINE_1)
lcd_string("Terminated... ",LCD_LINE_2)
GPIO.cleanup()
print "\n\nProgram terminated..."

Conclusion:
Thus, we have studied and implemented GPS Module Interfacing with Raspberry Pi

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 9

Aim:
IOT based Web Controlled Home Automation using Raspberry Pi.

Abstract:
This experiment deals with the possibility of controlling AC appliances with the click of
buttons on a webpage using internet. Using this IOT based home automation system, you can
control your Home appliances from anywhere in the world. This web server can be run from
any device which can run HTML applications, like Smart Phone, tablet, computer etc.

Required Components:

Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
Discover Board 1
Relay board 1

Interfacing Diagram:

Procedure:
Step 1: Connection of Discover Development Board
a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.
b. Connect GPS module to USB port of Raspberry Pi.
c. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to
VGA convertor.
d. Connect Relay Driver to Connector No 7 (CN 7) of Discover Development Board.
e. Connect AC Lamp and Fan across the relay.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

f. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development


Board and the other end to GPIO pins of Raspberry Pi in such a way that the arrow
must point towards the SD Card and Pin No 1 of Raspberry Pi.
g. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board.
(Check positive and negative and don’t switch ON power supply until all connections
are connected properly)

Step 2: Connection of Raspberry Pi.


a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.
b. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to
VGA convertor

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


a. Username: pi
b. Password: raspberry

Step 5: Setup blynk app and create button controls for fan and light as shown.

• Download blynk app from google play store and install it.
• Open blynk app after downloading and sign up with your email address, then sign in.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• Finally, you will see screen as above as shown. Then click on “+New Project”.

• Now,
1. Enter name of project.
2. Choose device as “Raspberry pi 3 B”.
3. Connection Type as “Ethernet”.
4. Theme as “DARK” or “LIGHT”
Finally click on “Create” button then you will see the following screen.

• Now, you will receive a token key on your Gmail account register as shown below.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• Copy the authentication key so that you can add to your python code.

• Now we have to create controls for light and fan.

• Click on “+” sign as indicated above.

• Click on “Button”. And repeat same steps two time to add two buttons one for light and
one for fan.

• Click on the same button to configure it.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• Now,
1. Choose name for button as “Fan”
2. Output pin as “V1”.
3. Mode as “SWITCH”
4. ON/OFF LABELS as it is.
5. Do not change DESIGN.

• Add another button control and you will see the final output as shown below.

• Then click on play button as shown above.

• Then you are in active mode.

Step 6: Setup raspberry pi python code.


• Now, go to your Raspberry pi and right click and create python file with name
“main.py” which steps are shown below.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• Now, you have created python file with name “main.py”. Right click on it and open
with python idle 2.

• Replace the authentication key with your authentication key that was receive on your
registered Gmail account.
• Finally, you check all the hardware connection on development board and run the
program and enjoy controlling your devices like fan and light.

Conclusion:
Thus, we have studied and implemented IoT based Web Controlled Home Automation using
Raspberry Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 10

Aim:
Visitor Monitoring with Raspberry Pi and Pi camera

Abstract:
This project deals with interfacing Pi camera with Raspberry Pi to capture the image of every
visitor which has entered through the gate or door. whenever any person is arrived at the gate,
he/she has to press a button to open the gate, and as soon as he/she press the button, his/her
picture will be captured and saved in the system with the Date and time of the entry. This can
be very useful for security and surveillance purpose. This system is useful in offices or factories
where visitor entry record is needed to be maintained.

Required Components:

Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
Discover Board 1
Pi Camera With CSI Connector 1

Interfacing Diagram:

Procedure:

Step 1: Connection of Discover Development Board


a. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development
Board and the other end to GPIO pins of Raspberry Pi in such a way that the arrow
must point towards the SD Card and Pin No 1 of Raspberry Pi.
b. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board.
(Check positive and negative and don’t switch ON power supply until all connections
are connected properly)

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Step 2: Connection of Raspberry Pi.


a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.
b. Connect Camera to Camera slot CSI Connector of Raspberry Pi.
c. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to
VGA convertor.

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


a. Username: pi
b. Password: raspberry

Step 5: Install camera Library:


• We need to install Pi camera library files for run this project in Raspberry pi. To do this
we need to follow given commands:
$ sudo apt-get install python-picamera
$ sudo apt-get install python3-picamera

• After it, user needs to enable Raspberry Pi Camera by using Raspberry Pi Software
Configuration Tool (raspi-config):
$ sudo raspi-config

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

• Then select Enable camera and Enable it.

• Then user needs to reboot Raspberry Pi, by issuing sudo reboot, so that new setting
can take. Now your Pi camera is ready to use.
$ sudo reboot

Step 6: Create a new file with an extension .py

Step 7: Open the file with Python 2 IDLE only.

Step 8: Type and run the program and see the output on terminal.

Conclusion:
Thus, we have studied and implemented Visitor Monitoring with Raspberry Pi and Pi camera.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 11

Aim:
RFID interfacing with Raspberry Pi.

Abstract:
Radio-frequency identification (RFID) uses electromagnetic fields to automatically identify
and track tags attached to objects. The tags contain electronically stored information. The RFID
technology enables remote and automated gathering and sending of information between RFID
tags or transponders and readers using a wireless link. Using RFID, the exchange of data
between tags and readers is rapid, automatic and does not require direct contact or line of sight.
An RFID system consists of a reader device and a transponder. A transponder or tag has a
unique serial number which is identified by the reader. The RFID module can be interfaced
with the board using the same serial reception program used for testing the UART. When a
Card (tag) is brought near the RFID reader, it tries to communicate with the tag, receives the
data and decodes it. Finally, it sends the data over the TX line. The UART module in MCU
receives the data and thus used for further applications. RFID tag is applied to products,
individuals or animals to identify and track them through this number. The identification code
of the tag is also displayed on a 16x2 LCD. By employing RFID, much secured entry systems
can be developed without incurring huge costs.

Required Components:

Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
Discover Board 1
RFID Reader 1
16x2 LCD 1

The Raspberry Pi has two pins (pin 8 / GPIO14 and pin 10 / GPIO 15), but they work with
3.3V. Since there are different RFID Module, which do not all work with 3.3V, a USB UART
convertor is needed.

Interfacing Diagram:

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Procedure:
Step 1: Connection of Discover Development Board

a. Connect LCD module to Connector No 4 (CN 4) of Discover Development Board.


b. Connect RFID reader module to Connector No 6 (CN 6) of Discover Development
Board.
c. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development
Board and the other end to GPIO pins of Raspberry Pi in such a way that the arrow
must point towards the SD Card and Pin No 1 of Raspberry Pi.
d. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board.
(Check positive and negative and don’t switch ON power supply until all connections
are connected properly)

Step 2: Connection of Raspberry Pi.


a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.
b. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to
VGA convertor.

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


c. Username: pi
d. Password: raspberry

Step 5: Create a new file with an extension .py

Step 6: Open the file with Python 2 IDLE only.

Step 7: Type and run the program and follow the steps shown on terminal window,
show RFID card, see the output on terminal.

Conclusion:
Thus, we have studied and RFID interfaced with Raspberry Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 12

Aim:
Building Google Assistant with Raspberry Pi.

Abstract:
This Raspberry Pi Google assistant project will walk you through on how to build and setup
your very own Pi-powered Google Assistant. This assistant will actively listen to your voice
and respond to your queries, all you need to say is “Ok Google” or “Hey Google” followed by
your query. To set up your own Google Assistant, we will be walking you through how to test
your audio setup, signing up for the Google Assistant API and also show you how to download
and set up the actual Google Assistant examples. To set up your very own Google Assistant on
your Raspberry Pi all you will need is a USB Microphone and a set of speakers.

Required Components:

Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
Discover Board 1
USB MIC 1
Speaker Raspberry Pi Compatible 1

Interfacing Diagram:

Procedure:
Step 1: Connection of Discover Development Board

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

a. Connect one end of FRC cable to Connector No 1 (CN 1) of Discover Development


Board and the other end to GPIO pins of Raspberry Pi in such a way that the arrow
must point towards the SD Card and Pin No 1 of Raspberry Pi.
b. Connect Power Supply to Connector No 8 (CN 8) of Discover Development Board.
(Check positive and negative and don’t switch ON power supply until all connections
are connected properly)

Step 2: Connection of Raspberry Pi.


a. Connect Keyboard and mouse to USB Ports of Raspberry Pi.
b. Connect Camera to Camera slot CSI Connector of Raspberry Pi.
c. Connect HDMI Port of Raspberry Pi to HDMI monitor via HDMI cable or HDMI to
VGA convertor.

Step 3: Switch ON power supply.

Step 4: Login to Raspberry Pi terminal.


e. Username: pi
f. Password: raspberry

Step 5: Create a new file with an extension .py

Step 6: Open the file with Python 2 IDLE only.

Step 7: Type and run the program and see the output on terminal.

Code:
#!/usr/bin/env python _
# -*- coding: utf-8 -*-

import time
import os

def main():
os.system("bash run.sh")
while True:
time.sleep(3)

main()

Conclusion:
Thus, we have studied and implemented how to build Google assistant with Raspberry Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

Experiment No: 13

Aim:
Installing windows 10 IoT core on Raspberry Pi.

Abstract:
Windows 10 IoT Core is a version of Windows 10 that is optimized for smaller devices with
or without a display, and that runs on the Raspberry Pi 2 and 3. Windows 10 IoT Core utilizes
the rich, extensible Universal Windows Platform (UWP) API for building great solutions.

Required Components:

Particular Quantity
Raspberry Pi3 1
Power Supply 12V/2Amp 1
USB Keyboard 1
USB Mouse 1
Micro SD card 1
Discover Board 1
Ethernet cable 1

Procedure:
1. Go to the Windows 10 developer center.

2. Click Get Windows 10 IoT Core Dashboard to download the necessary application

3. Install the application and open it.

4. Select set up a new device from the sidebar

5. Select the options as shown in the image below. Make sure you select the correct drive
for your microSD card and give your device a name and admin password.

Name:- VIVEK MANTRI Roll No:- 17302C0005


VSIT Internet of Things Lab Manual

6. Select the Wi-Fi network connection you want your Raspberry Pi to connect to, if
required. Only networks your PC connects to will be shown.

7. Click download and install. The application will now download the necessary files from
Microsoft and flash them to your microSD card. It'll take a little while, but the
dashboard will show you the progress.

8. Once the image has been installed on the microSD card, then eject it from PC and go
over to the Raspberry Pi. First connect up the micro USB cable and power supply,
HDMI cable and USB Wi-Fi adapter or Ethernet cable. Connect the HDMI cable to
your chosen display, insert the microSD card into the Raspberry Pi and power it up.

9. The board will automatically connect to your network if you had chosen a Wi-Fi
network during setup, or else enter your Wi-Fi password to connect to the web.

10. Boot the raspberry pi after that go to the dashboard application on the relevant PC and
raspberry will be there as one of the device.

Conclusion:
Thus, we have studied and installed windows 10 IOT core on Raspberry Pi.

Name:- VIVEK MANTRI Roll No:- 17302C0005