introduction to raspberry pi with simple gpio pin control
TRANSCRIPT
![Page 1: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/1.jpg)
-a 35 dollar mini computer
Raspberry-pi
An Introduction
![Page 2: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/2.jpg)
Who Am I ?I am Pradip Bhandari. Member of Robotics ClubFinal Year Student Electronics And Communication EngineeringFamiliar with Raspberry pi for more than two yearsI love Hardware and Software more than a girl
Contact info : “masterpradipg”
![Page 3: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/3.jpg)
Handling the RP
-The Raspberry Pi was built to be used, but not abused. EveryPrinted Circuit Board (PCB) should be handled with care.
-Handle the RP only by the edges of the board itself.Avoid touching or holding any of the components on theboard.
-Rough handling can cause solder points to fail and may result in short circuits, but be careful with the GPIO pins as well.
![Page 4: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/4.jpg)
Agenda
Introduction To Raspberry Pi Features How it differs from other Board? Applications Setting Up Hardware Connection Operating System choice Demo GPIO Simple GPIO Python Programming Demo
![Page 5: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/5.jpg)
What is the Raspberry Pi?
Small single-board computer, Credit card size and costs approximately £35
Developed by Raspberry pi foundation UK with the intention of promoting the
teaching of basic computer science in schools
It has all possible features of modern computers
Model: Rpi 1 Model A, A+, Rpi 1 Model B, Rpi 1 Model B+(2012) and Rpi 2 model B(2015)
Introduction
![Page 6: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/6.jpg)
Raspberry Pi Features
CPU 700MHz ARM1176-JZFSGPU Broadcom VideoCore IV @250 MHzMemory 512MB LPDDR2-8002 built in USB hubVideo HDMI, compositeAudio HDMI, stereo analogEthernet cable5V Micro USBFanless It does not include a built-in hard disk , but uses an SD card for booting
and long-term storage.
Features
![Page 7: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/7.jpg)
Raspberry Pi
![Page 8: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/8.jpg)
Raspberry Pi
Micro USB Power
![Page 9: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/9.jpg)
Raspberry Pi
Micro USB Power
HDMI
![Page 10: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/10.jpg)
Raspberry Pi
Micro USB Power
HDMIETHERNET
![Page 11: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/11.jpg)
Raspberry Pi
Micro USB Power
HDMIETHERNET
2xUSB 2.0
![Page 12: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/12.jpg)
Raspberry Pi
Micro USB Power
HDMIETHERNET
2xUSB 2.0
AUDIO
![Page 13: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/13.jpg)
Raspberry Pi
Micro USB Power
HDMIETHERNET
2xUSB 2.0
AUDIO
VIDEO
![Page 14: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/14.jpg)
Raspberry Pi
Micro USB Power
HDMIETHERNET
2xUSB 2.0
AUDIO
VIDEO
GPIO
![Page 15: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/15.jpg)
Raspberry Pi
Micro USB Power
HDMIETHERNET
2xUSB 2.0
AUDIO
VIDEO
GPIO
SD CARD
![Page 16: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/16.jpg)
Raspberry Pi
Micro USB Power
HDMIETHERNET
2xUSB 2.0
AUDIO
VIDEO
GPIO
SD CARD
Camera connector
![Page 17: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/17.jpg)
Raspberry Pi
Micro USB Power
HDMIETHERNET
2xUSB 2.0
AUDIO
VIDEO
GPIO
SD CARD
Screen Panel Connector(TFT touch Screen)
Camera connector
![Page 18: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/18.jpg)
Micro USB power port The micro USB power port is used to power the Raspberry Pi device.
HDMI port The HDMI output is used to plug into a modern television or monitor.
Ethernet port The Ethernet port is used to connect the Raspberry Pi to the internet or a local network.
USB ports USB 2.0 ports are used to plug in a keyboard, mouse, web cam, external hubs etc.
Audio output The audio output can be used to plug into an external amplifier or an audio docking station.
GPIO headers The GPIO headers are used to connect the Raspberry Pi to other hardware devices. For example, they can be used to connect to LEDs, motors and other electronic components.
video output The video output is used to connect to an older type television.
![Page 19: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/19.jpg)
Ingredients
1 x SD Card - 4GB or above
1 x Monitor or TV with a HDMI cable
1 x Mouse
1 x Keyboard
1 x Ethernet LAN cable (optional - needed if you require a network connection)
1 x Micro USB power supply (many mobile phone chargers will work but it must supply 5V and have at least 700mA)
Note: Some monitors do not have HDMI ports – in this situation you will need to have
an adapter – you can get a HDMI to DVI or a HDMI to VGA.
![Page 20: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/20.jpg)
Ingredients
![Page 21: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/21.jpg)
How it differs from other Board
Low power consumption
PC takes 65-250WLaptop takes 15-60WRaspberry Pi 5v,700mA=3.5W
Low costSmall in size
![Page 22: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/22.jpg)
What Can You Do With It?Raspberry Pi is a flexible platform, there’s no single way to use it, Whether you just want to watch videos and surf the web, or you want to hack, learn, and make with the board for fun, utility, and experimentation
General purpose computing• graphical desktop environment with a web browser• install a wide variety of free software like LibreOffice, Games, etc.
Learning to program• Raspberry Pi is meant as an educational tool to encourage kids to experiment with computers, it comes
preloaded with interpreters and compilers for many different programming languages• You can write programs for your Raspberry Pi in many different languages• programming languages like Python, C, Ruby, Java, Perl etc.
Project platform• The Raspberry Pi differentiates itself from a regular computer not only in its price and size, but also
because of its ability to integrate with electronics projects
![Page 23: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/23.jpg)
Applications
Home Automation System.
Home Security System.
HD surveillance Camera.
Media Center.
We can develop what we can think using GPIO.
![Page 24: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/24.jpg)
Applications
•Can be used for making super computers
![Page 25: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/25.jpg)
ApplicationsRaspberry Pi Medical Device Input
Shield
![Page 26: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/26.jpg)
Applications
•Solar Raspberry Pi Power Pack
![Page 27: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/27.jpg)
Applications
•It can make your Old TV in to a smart TV. (You can play Videos, 3D Games, Music, Browse Internet and much more.
•Raspberry Pi can Act as Full HD 1080p Media Player.
•You can connect a Monitor, Keyboard and Mouse and use it as a normal computer.
•Its Graphics Capabilities is better than Apple Products(2012).
![Page 28: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/28.jpg)
Setting Up Hardware ConnectionBasic Setup Connect Monitor via HDMI or Video OutConnect Mouse and KeyboardConnect OS loaded Memory cardPower it up
![Page 29: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/29.jpg)
OS choices● Raspbian wheezy(free, based on Debian )● ArchLinusArm● PiDora(Fedora remix for pi
![Page 30: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/30.jpg)
Loading OS in Memory CardA software called “Win32DiskImager” is neededInstall and run it
1 2
3
1. Browse OS2. Select Drive3. Write it4. After few minutes your
memory card will be ready
![Page 31: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/31.jpg)
DEMOWhen promoted for username and password enter default value as
username: piPassword: raspberryNow we will be at Default console
To start Graphical User interface(GUI) type command “startx” and press enter
![Page 32: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/32.jpg)
• It is a generic pin on an Integrated circuit whose behavior, including wheather it is an input or output pin, can be controlled by user at the run time
• GPIO pin have no special purpose defined, and go unused by default
General Purpose I/p O/p(GPIO)
![Page 33: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/33.jpg)
General purpose digital inputs/outputs
• Outputs used to control external circuits– Switch leds on/off– Switch relays on/off– Actuate solenoid
• Inputs used to monitor status– Read switch status– Alarm inputs
![Page 34: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/34.jpg)
RPi General Purpose IO (GPIO) Pins• 17 GPIO pins brought out onto the P1 header
• most have alternated functions • two pins for UART; two for I2C; six for SPI
• All 17 pins can be GPIO (i.e., INPUT or OUTPUT)• all support interrupts• internal pull-ups & pull-downs for each pin• I2C pins have onboard pull-ups
• using them for GPIO may not work
• Pins are 3.3V not 5V like on the Arduino• They are connected directly to the
Broadcom chip • Sending 5V to a pin may kill the Pi• Maximum permitted current draw from
a 3.3V pin is 50mAImage credit: http://elinux.org/RPi_Low-level_peripherals
![Page 35: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/35.jpg)
Simple LED connection
Our actual connection:
Led1: cathode to Ground anode to any GPIO
Led2: cathode to Ground anode to any GPIO
![Page 36: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/36.jpg)
Programming
• By default, supporting Python as the educational language.
• Any language which will compile for ARMv6 can be used with the Raspberry Pi, though; so you’re not limited to using Python.
![Page 37: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/37.jpg)
Python • To program the GPIO ports in Python, we need to install a very useful Python 2
library called Rpi.GPIO. This module gives us a simple to use Python library that will let us control the GPIO pins.
• To install RPi.GPIO, we first need to install the Python Development toolkit that RPi.GPIO requires.
• To do this enter the following command into LXTerminal: sudo apt-get install python-dev• Then to install Rpi.GPIO itself type: sudo apt-get install python-rpi.gpio• We will probably be prompted to confirm by entering 'Y'.
![Page 38: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/38.jpg)
Simple python program to blink LED
import RPi.GPIO as GPIO #import python 2 GPIO libraryfrom time import sleep #import time library to use sleepGPIO.setmode(GPIO.BCM) #initializing BCMGPIO.setup(7,GPIO.OUT) #set up GPIO pin 7 to outGPIO.setup(8,GPIO.OUT) #set up GPIO pin 8 to outWhile 1: GPIO.output(7,0) #set GPIO pin 7 to level 0 GPIO.output(8,1) #set GPIO pin 8 to level 1 sleep(1) GPIO.output(7,1) #set GPIO pin 7 to level 1 GPIO.output(8,0) #set GPIO pin 8 to level 0
Sleep(1)
![Page 39: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/39.jpg)
DEMO
LED blinking using Python
![Page 40: Introduction To Raspberry Pi with Simple GPIO pin Control](https://reader031.vdocument.in/reader031/viewer/2022032012/55cd69ebbb61ebb4178b47c0/html5/thumbnails/40.jpg)
Thank
you!!
ANY QUERIES ?