IOT Lab Kit Raspberry
IOT Lab Kit Raspberry
[email protected]
Table of Contents
Interfacing and Programming Arduino with PC ....................................................................................... 2
Studying architecture of Raspberry Pi board ........................................................................................... 4
Installing OS for Raspberry-Pi-3 ............................................................................................................... 9
Connecting Hardware Peripherals to Raspberry-Pi board .................................................................... 13
Understanding GPIO pins on Raspberry Pi board and its use in program ............................................. 20
Studying Connectivity and Configuration of Raspberry Pi board with basic peripherals (LEDs) ........... 25
Interfacing Temperature cum Humidity sensor (DHT-11) with Raspberry Pi board ............................. 28
Understanding the connectivity of Raspberry Pi board with camera. Writing an application to capture
and store the image. .............................................................................................................................. 31
Understanding the connectivity of Raspberry Pi board with X-bee module. Writing a network
application for communication between two devices using X-bee ...................................................... 35
Study of different CPU Frequency Governors. Writing an application to change CPU frequency of
Raspberry-Pi board ................................................................................................................................ 45
Write an Application using Raspberry Pi board to control the operation Stepper Motor .................... 47
Writing an application using Raspberry-Pi board to control the operation of hardware simulated
traffic signal............................................................................................................................................ 50
Writing an application using Raspberry-Pi board to control the operation of a hardware simulated Lift
Elevator .................................................................................................................................................. 53
Understanding the connectivity of Raspberry Pi board circuit with IR sensor (Proximity) ................... 56
Developing a Real time application for Smart home (Intrusion detection) .......................................... 59
Developing a Real time application for a smart home (using Camera module and PIR sensor) ........... 61
1
Interfacing and Programming Arduino with PC
Objectives:
To study the layout of Arduino Board.
To Identify the microcontroller IC on Arduino (ATMEGA328)
To study the installation and interface of Arduino IDE.
To learn basic command of Arduino IDE.
To write a simple program in Arduino IDE to interface the Arduino board with PC.
Software:
Arduino IDE 1.6.9 or higher
Hardware Modules:
Arduino Board
PC / Laptop
Theory:
Introduction to Arduino Board
Arduino Board is an Open Source software and hardware. The brain of Arduino Board is the
microcontroller IC ATMEGA328-UNO-R3 (3rd version) present on the top right corner of the
board.
There are total 20 pins mounted on the board.
From these, 14 are digital pins denoted by 0, 1….13 or D0, D1….D13. These pins can be set
as input or output pins (digital read or write).
The remaining 6 pins are the Analog pins, denoted by A0, A1….A5. These pins are used to
read the analog signal (analog read), these pins can also be used as digital input/output pins.
From the 14 digital pins, 6 pins are denoted by ‘PWM’, which are used to write the analog
signal (analog write).
Arduino board can be connected to the PC using USB cable. It has two different connectors
at its two ends. One of type-A(PC side)) and the other is type-B(Arduino side).
Power is given to Arduino Board by two ways, 1. Through USB cable or 2. By external adapter
(when there is no need of PC/Laptop).
Safety precautions:
First, make all the connections as per steps given below
Then connect Arduino board to PC/Laptop
Interface diagram:
Procedure:
Write the program as per the algorithm given below.
Save and compile the program.
Connect the Arduino board to PC/Laptop using USB cable.
Upload the compiled program and check the output.
Algorithm:
Start IDE
Configure the pin number ‘13’ as ‘OUTPUT’ pin
Make the ‘OUTPUT’ as ‘HIGH’
Give delay of one second
Make the ‘OUTPUT’ as ‘LOW’
Give delay of one second
Observation:
Observe the LED near the pin number ‘13’, it starts blinking as soon as the program is
uploaded.
3
Studying architecture of Raspberry Pi board
Aim/Objectives
To understand the architecture of Raspberry-Pi 3 Model B
Introduction
The Raspberry Pi is developed in the United Kingdom by the Raspberry Pi Foundation.
These boards are approximately credit-card sized.
Raspberry Pi world’s most inexpensive and powerful Single Board Computer.
Raspberry Pi runs Debian based GNU/Linux operating system called Raspbian and ports of
many other OS exist for Raspberry Pi.
Python language is popular for programming Raspberry-Pi
The first generation (Raspberry Pi 1 Model B) was released in February 2012.
Then the Raspberry Pi hardware has evolved through several versions that feature variations
in memory capacity and peripheral-device support.
So several generations of Raspberry Pis have been released
History
The history of Raspberry-Pi evolution is summarized in the below table.
4
Raspberry Pi 3 Model B:
Broadcom IC
GPIO Header
GPIO stands for General Purpose Input Output.
There are 28 GPIO (Digital) pins available on this board via a header.
These pins allow the user to interface the Pi with the real world.
5
For example, using these pins, we can drive the LED, Switches, and Sensors etc.
USB chip
The Raspberry Pi 3 shares the same SMSC LAN9514 chip as its predecessor, the Raspberry Pi
2.
But it has additional 10/100 Ethernet connectivity and four USB channels to the board.
As before, the SMSC chip connects to the SOC via a single USB channel, acting as a USB-to-
Ethernet adaptor and USB hub.
USB Chip
Chip Antenna
There’s no need to connect an external antenna to the Raspberry Pi 3.
Its radios are connected to this chip antenna soldered directly to the board, in order to keep
the size of the device to a minimum.
This antenna is more than capable of picking up wireless LAN and Bluetooth signals – even
through walls.
USB Antenna
Micro SD Card
SD card is used as a boot device and also persistent storage.
The Micro SD Card will hold the operating system which will boot while we power on
Raspberry Pi 3.
HDMI
HDMI port (High-Definition Multimedia Interface) is used to quickly connect Raspberry Pi to
HDMI Monitor.
6
CSI Camera Connector
CSI [Camera serial Interface] is used for connecting a camera to the Raspberry Pi board.
Ethernet Port
Used for connecting to the Internet.
USB Port
There are 4 USB ports mainly used for peripherals like Keyboard, mouse and a Wi-Fi Adapter.
A powered USB hub can be connected and be expanded.