Upload
akhilesh-jaiswal
View
217
Download
0
Embed Size (px)
Citation preview
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 1/53
Exploring Raspberry Pi
http://elinux.org/images/f/f4/RaspiFront.JPG
http://upload.wikimedia.org/wikipedia/en/c/cb/RaspberryPi!ogo.s"g
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 2/53
About Speakers
● Lentin Joseph, Achu Wilson and Aronin Chandu
● Experience in Robotics and Embedded systems or
last ! years● http"##$$$%lentin&oseph%com
● http"##$$$%sastrarobotics%com
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 3/53
'uestions (((
● Why did you choose this $orkshop (
● What are you expecting rom this $orkshop (
● What do you $ant to make $ith RaspberryPi (
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 4/53
Agenda● )ntroduction to Raspberry● *ard$are description
● )nstallation o +S
● +S )ntroduction
● Remote Acess using SS*,-C
● Package .anagement● /P)+,)0C,SP)
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 5/53
Agenda
● Python 1 /CC● Wiring Pi and Python /P)+
●
*ello2World demo● LE3 4link, PW. etc
● Raspberry Pi and Arduino
● Raspberry Pi and Camera● *ackathon
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 6/53
Raspberry Pi 1 PC
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 7/53
Compare Raspberry Pi and a PC
#omponents !aptop or P# Raspberry Pi %er &Processor 'ntel (.( Gh)*+ual
#ore,-- h)*ingle#ore 0rm 11
R0 2G& 31( &
Graphics 'ntel + 5--- +ual core "ideocore '%
6thernet 7es 7es
8& (.- 7es 7es
%ideo 9/P %G0 *+' #omposite R#0+'
0udio 9/P 7es 7es
torage 3-- G& arddisk 5( G& + #ard
9perating ystem !inux/indows 9nly !inux
+imensions 14 inch laptop ;.2x3.4x1., cm
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 8/53
Raspberry Pi .odel A14
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 9/53
Raspberry Pi Components
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 10/53
Raspberry Pi Components
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 11/53
4C. 05!6 SoC7System on Chip8
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 12/53
Raspberry Pi " /P)+
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 13/53
Raspberry Pi " /P)+
● 5x /P)+ 7/eneral Purpose )nput#+utput8
● 9AR: ,)0C ,SP) 4us
●
!%! and 6 pins
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 14/53
Rpi Connection 3iagram
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 15/53
Rpi Connection 3iagram
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 16/53
4asic /-9#Linux commands
● ;ls < List =iles
● ;cd < Change 3irectory
●
;mkdir < Create older● ;rmdir < 3elete older
● ;clear < Clear terminal
● ;nano < :ext editor
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 17/53
4asic /-9#Linux commands
● ;dmesg < Sho$ kernel messages
● ;lsusb < List connected usb de>ices
●
;cp < Copy =iles● ;ssh < Secure shell
● ;scp < Copy iles rom one pc to other using ssh
● ;>nc>ie$er < Connect to >nc ser>er
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 18/53
4asic /-9#Linux commands
● ;sudo < Run in root pri>ilage
● ;ping < Pinging to ip address
●
;nmap < Searching tool o )P and Ports
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 19/53
)nstallation o +S
● +S -ame " Raspbian#Linux
● 3o$nload link"
http"##$$$%raspberrypi%org#do$nloads● 4ased on 3ebian operating system
● 3esktop En>iornment " L?3E
● Light $eight +S
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 20/53
)nstallation o +S
● )nstallation tools
● =or Windo$s● Win!03isk)mager%exe
● http"##sourceorge%net#pro&ects#$in!0diskimager#
● =or Linux● ;dd
● http"##sourceorge%net#pro&ects#$in!0diskimager#
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 21/53
)nstallation o +S
● Procedure in Linux● =ormat S3 Card in =A: !0#ext0
● sudo dd bs@m i@Bname2o2image%img o@Bde>ice name
● Eg" sudo dd bs@m i@0D!FD0FDGF$heeHyFraspbian%imgo@#de>#sdb
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 22/53
Setting SS*
● SS* < Secure Shell
● http"##en%$ikipedia%org#$iki#Secure2Shell
●
3irect and Remote Login methods in Rpi● :ypes o remote connections
● Rpi and PC connected through router
● Rpi and PC connected through direct connection● Rpi Wii *otspot
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 23/53
RaspiFconig
● What is raspiFconig
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 24/53
Setting -C Ser>er
● -C7irtual -et$ork Computing8● http"##en%$ikipedia%org#$iki#-C2ser>er
● /raphical desktop sharing system
● )nstallation● ;sudo aptFget install tight>ncser>er
● )n Raspberry Pi● ; >ncser>er " Fgeometry !IIxIDD Fdepth I Fpixelormat rgb6I6
●
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 25/53
Setting -C Ser>er
● )n PC● )nstall tight>nc>ie$er
● ; >nc>ie$er ip"6GD
●
; >nc>ie$er G0%I5%%!"6GD
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 26/53
Remote 3esktop
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 27/53
)ntroduction to Raspbian
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 28/53
Package .anagement
● ;aptFget install
● Synaptic Package .anager " /9) o aptFget
●
;dpkg
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 29/53
/P)+ ,)0C,1SP)
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 30/53
/P)+ ,)0C,1SP)
● /P)+ Libraries● Rpi%/P)+
● Wiring Pi
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 31/53
Rpi%/P)+ )nstallation
● /P)+ Library )nstallation● ; sudo aptFget update
● ; sudo aptFget install pythonFde>
● ; sudo aptFget install pythonFrpi%gpio
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 32/53
WiringPi )nstallation
● Wiring Pi Library )nstallation● ; sudo aptFget install gitFcore
● sudo aptFget update
●
sudo aptFget upgrade● git clone git"##git%drogon%net#$iringPi
● cd $iringPi
● git pull origin
●
cd $iringPi● %#build
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 33/53
Python 1 /CC
● )ntroduction to Python (● Sample codes
●
)ntroduction to /CC7/nu C compiler8● Sample Codes
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 34/53
Rpi%/P)+ 4asics➢
import RPi.GPIO as GPIO #Importing GPIO Module➢ import time # Importing Time module
➢
➢ GPIO.setmode(GPIO.BOARD) # Taking Pin number rom t!e board
➢ GPIO.setup("$ GPIO.O%T) # &etting "t! pin as O%TP%T
➢
➢ tr'
➢ !ile True
➢ GPIO.output("$ GPIO.*IG*) #&etting "t! pin !ig!
➢ time.sleep(") # " se+ dela'
➢ GPIO.output("$ GPIO.,O-) #&etting "t! pin lo
➢
time.sleep(")➢ inall'
➢ GPIO.+leanup() #leaning t!e +onigurations
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 35/53
WiringPi 4asics
● ; man gpio● ; gpio Fg :aking 4C. /P)+ -umber
● ;gpio KFg mode Bpin in#out#p$m#up#do$n#tri
● ; gpio KFg $rite Bpin B>alue
● ;gpio KFg p$m Bpin B>alue7DFD0!8
●
; gpio KFg read B pin● ; gpio readall
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 36/53
WiringPi Pinout
l
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 37/53
WiringPi Examples
●
Setting $iring pin to *)/*● ;gpio mode out
● ;gpio $rite
●
Setting PW.● ;gpio mode p$m
● ;gpio p$m 0DD
l k d
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 38/53
3emo2"4link Led
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 39/53
3emo20"4utton 1 )nput
3 PW.
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 40/53
3emo2!"PW.
3 LC3 ) i
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 41/53
3emo2"LC3 )nteracing
R b Pi 1 A d i
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 42/53
Raspberry Pi 1 Arduino
http://blog.oscarliang.net/raspberry<pi<and<arduino<connected<serial<gpio/
R b Pi 1 A d i
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 43/53
Raspberry Pi 1 Arduino
● 3irect Serial Connection
R b Pi 1 A d i
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 44/53
Raspberry Pi 1 Arduino
● 9S4 Connection
R b Pi 1 A d i
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 45/53
Raspberry Pi 1 Arduino// Arduino odeint serIn01oid setup() 2 &erial.begin(3455)0 61oid loop () 2 i(&erial.a1ailable()) 2
!ile (&erial.a1ailable()75)2 serIn 8 &erial.read()0 &erial.print(serIn$ B9T:)0
6 &erial.println()0 6
dela'("555)06
// P't!on ode in Raspberr' Pi
import serialimport timeser8serial.&erial(;/de1/tt'AM5;$3455)
!ile True
ser.rite(;A;)Time.sleep(")
R pb Pi 1 C m
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 46/53
Raspberry Pi 1 Camera
Raspberr Pi 1 Camera
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 47/53
Raspberry Pi 1 Camera
● Connection" Camera Serial )nterconnect7CS)8
● .aximum Still Resolution" 0,6G0M,G7currently limited to ,G0DM,D5D8
● .aximum ideo Resolution",G0DM,D5D 7D5Dp8 !Dps
Raspberry Pi 1 Camera
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 48/53
Raspberry Pi 1 Camera
; sudo aptFget install gu>c>ie$
Raspberry Pi 1 Sound
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 49/53
Raspberry Pi 1 Sound
● ; sudo aptFget install mplayer
Raspberry Pi Robot demo
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 50/53
Raspberry Pi Robot demo
'uestions ((
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 51/53
'uestions ((
*ackathon
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 52/53
*ackathon
● Will select best ! pro&ects● 3uration " 0 hrs
*ackathon
7/23/2019 exploringraspi-130910124730-phpapp01
http://slidepdf.com/reader/full/exploringraspi-130910124730-phpapp01 53/53
*ackathon
● Will select best ! pro&ects● 3uration " 0 hrs
*app' *a+king )