SlideShare una empresa de Scribd logo
1 de 26
Shahed Mehbub
President, Robo Mechatronics Association Bangladesh(RMABD)
Day 2
Setting up the Pi
6. USB TO POWER
SOURCE
5. TO MONITOR
4. TO MOUSE
3. TO
KEYBOARD
2. WI-FI
ADAPTER
1. SD CARD
Operating Systems for Pi
• Raspbian (Jessie, Jessie lite)
• Ubuntu (Snappy Ubuntu Core)
• Fedora
• Debian
• Archlinux ARM
• Windows 10 IoT Core
• Kali Linux
• OpenELEC
• RetroPIe
Preparing the SD card with an OS
• Step 1: Download bootable disk .iso's (raspbian jessie)
• Link:https://www.raspberrypi.org/downloads/raspbian
• Step 2: Write iso image to SD card
• For Windows/Mac/Linux
https://www.balena.io/etcher/
Let's boot it up!!!
• Plug in all the accessories
• Plug in the power cable
• Pi will start booting
automatically
(First boot may take a long
time)
• You may have to face a
configure window
(If it happens, follow it
through)
Default Credentials for a new user
• If you encounter for a
username and password:
• username: pi
• password: raspberry
• After login, type 'startx' to go to
the Desktop
Setup Completed!!!
Time for making it home!
▶▶ ▶▶
Wifi Configuration
Menu > Preferences > Wifi Configuration
OR
Click on the network icon on the top panel
Almoooooost Ready!!
Just one more step! :p
Do a system update
(It is important to function all the
apps working correctly)
• Open up the terminal:
• Write--> sudo apt-get update
• and--> sudo apt-get upgrade
** Reboot after completing the update process and we are
good to go!!! :D
GPIO Introduction
GPIO on Raspberry Pi
• 26 GPIO Header in Model A/B and 40 GPIO Header in Model B
• These pins are a physical interface between the Pi and the
outside world.
• Out of 26, 8 are dedicated IO Lines, 2 are for UART, 4 are for
SPI (+1 for Another Chip Select) , and another 2 for the I2C
Interface (Total 17 out of 26)
• Rest are Supply Rails.
• Model B+ has 9 additional GPIO including a extra SPI (Total 17
+ 9 = 26 out of 40)
• WiringPi : Easy to use C Library for accessing the GPIO Lines
via Programming (Arduino Style Programming)
Let's Do Blinky!!!
Making of a LED Blinker using Python
==> What you will need:
-> A raspberry pi
-> A LED
-> A 330Ω resistor to protect the LED
-> Jumper wires
Let's Do Blinky!!!
Step 1: Make sure if the LED is
okay
• Connect the jumper wires as
shown
• One wire on the short leg of
LED (Negative)
• Another one attached with the
resistor is
on the long leg (Positive)
LED
Let's Do Blinky!!!
Step 1: Make sure if the LED
is okay
• Connect the wires as shown
• One in the 3.3V pin (Positive
wire)
• Another one is in GND
** Check if the LED is on!
3.3V (Pin
1)
GND
Cathode
Anode
(longer leg)
Let's Do Blinky!!!
3.3V
Ground
GPIO (general purpose input
output)
Let's Do Blinky!!!
GPIO-4 (Pin 7)
5 functions to control GPIO’s
• GPIO.setmode()
• GPIO.setwarnings()
• GPIO.setup()
• GPIO.input()
• GPIO.output()
Let's Do Blinky!!!
->Programming the LED
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
LED = 4
GPIO.setup(LED,GPIO.OUT)
while True:
GPIO.output(LED,True)
time.sleep(1)
GPIO.output(LED,False)
time.sleep(1)
import RPi.GPIO libs
set LED pin as output
toggle light pin signal to
low/high to make it blink.
set pin type. use BCM, not pin
number
GPIO 4 pin (Pin 7)
Congrats!!!
You just finished your first Raspberry Pi project!
Button input - Wiring
Performing GPIO Input
#import RPi.GPIO as GPIO
import EmulatorGUI as GPIO
import time
GPIO.setmode(GPIO.BCM)
INPUTPIN= 23
GPIO.setup(INPUTPIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
if(GPIO.input(INPUTPIN) == True):
print(‘this’)
else:
print(‘that’)
Your Task!!
Write a program that pushing a button
will turn on an LED
Solution
import EmulatorGUI as GPIO
import time
GPIO.setmode(GPIO.BCM)
INPUTPIN= 23
led = 4
GPIO.setup(INPUTPIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
if(GPIO.input(INPUTPIN) == True):
led.on()
else:
led.off()
def led_on():
GPIO.output(led, True)
Def led_of():
GPIO.output(led, False)
Questions???

Más contenido relacionado

La actualidad más candente

BeagleBone Black Using Python
BeagleBone Black Using PythonBeagleBone Black Using Python
BeagleBone Black Using Python
Sai Viswanath
 

La actualidad más candente (20)

DigiPinguïns: demo Raspberry Pi (Koen De Smet)
DigiPinguïns: demo Raspberry Pi (Koen De Smet)DigiPinguïns: demo Raspberry Pi (Koen De Smet)
DigiPinguïns: demo Raspberry Pi (Koen De Smet)
 
Taking the BeagleBone Cookbook recipes beyond BeagleBone Black
Taking the BeagleBone Cookbook recipes beyond BeagleBone BlackTaking the BeagleBone Cookbook recipes beyond BeagleBone Black
Taking the BeagleBone Cookbook recipes beyond BeagleBone Black
 
Introduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIOIntroduction to Raspberry Pi and GPIO
Introduction to Raspberry Pi and GPIO
 
Introduction to raspberry pi
Introduction to raspberry piIntroduction to raspberry pi
Introduction to raspberry pi
 
Debian & the BeagleBone Black
Debian & the BeagleBone BlackDebian & the BeagleBone Black
Debian & the BeagleBone Black
 
Single Board Computers & Raspberry Pi Basics
Single Board Computers & Raspberry Pi BasicsSingle Board Computers & Raspberry Pi Basics
Single Board Computers & Raspberry Pi Basics
 
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
Rapidly developing IoT (Internet of Things) applications - Part 2: Arduino, B...
 
BeagleBone Black Using Python
BeagleBone Black Using PythonBeagleBone Black Using Python
BeagleBone Black Using Python
 
Getting Started with Raspberry Pi
Getting Started with Raspberry PiGetting Started with Raspberry Pi
Getting Started with Raspberry Pi
 
Raspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick Nesh
Raspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick NeshRaspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick Nesh
Raspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick Nesh
 
BeagleBone Workshop
BeagleBone WorkshopBeagleBone Workshop
BeagleBone Workshop
 
Low Cost HD Surveillance Camera using Raspberry PI
Low Cost HD Surveillance Camera using Raspberry PILow Cost HD Surveillance Camera using Raspberry PI
Low Cost HD Surveillance Camera using Raspberry PI
 
Thotcon2013
Thotcon2013Thotcon2013
Thotcon2013
 
Getting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and ArduinoGetting Started with Raspberry Pi and Arduino
Getting Started with Raspberry Pi and Arduino
 
Hands On Embedded Linux with BeagleBone Black
Hands On Embedded Linux with BeagleBone BlackHands On Embedded Linux with BeagleBone Black
Hands On Embedded Linux with BeagleBone Black
 
Raspberry Pi Using Python
Raspberry Pi Using PythonRaspberry Pi Using Python
Raspberry Pi Using Python
 
LCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot SoftwareLCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot Software
 
My presentation raspberry pi
My presentation raspberry piMy presentation raspberry pi
My presentation raspberry pi
 
Introduction to the rapid prototyping with python and linux for embedded systems
Introduction to the rapid prototyping with python and linux for embedded systemsIntroduction to the rapid prototyping with python and linux for embedded systems
Introduction to the rapid prototyping with python and linux for embedded systems
 
Raspberry Pi and Amateur Radio - 2020 update
Raspberry Pi and Amateur Radio - 2020 updateRaspberry Pi and Amateur Radio - 2020 update
Raspberry Pi and Amateur Radio - 2020 update
 

Similar a Exploring the abc's of raspberry pi and python(day 2)

Raspberry Pi with Java
Raspberry Pi with JavaRaspberry Pi with Java
Raspberry Pi with Java
koji lin
 

Similar a Exploring the abc's of raspberry pi and python(day 2) (20)

Unit 6 - PART2.pptx
Unit 6 - PART2.pptxUnit 6 - PART2.pptx
Unit 6 - PART2.pptx
 
Unit 3 Complete.pptx
Unit 3 Complete.pptxUnit 3 Complete.pptx
Unit 3 Complete.pptx
 
Raspberry pi basics
Raspberry pi  basicsRaspberry pi  basics
Raspberry pi basics
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
 
Raspberry pi intro.
Raspberry pi intro.Raspberry pi intro.
Raspberry pi intro.
 
Introduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlIntroduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin Control
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry pi
 
How to Hack Edison
How to Hack EdisonHow to Hack Edison
How to Hack Edison
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry pi
 
Raspberry Pi Free Session - 20_09_2014
Raspberry Pi Free Session - 20_09_2014Raspberry Pi Free Session - 20_09_2014
Raspberry Pi Free Session - 20_09_2014
 
2_RaspberryPi presentation.pptx
2_RaspberryPi presentation.pptx2_RaspberryPi presentation.pptx
2_RaspberryPi presentation.pptx
 
Raspberry Pi Introductory Lecture
Raspberry Pi Introductory LectureRaspberry Pi Introductory Lecture
Raspberry Pi Introductory Lecture
 
Got Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIOGot Python I/O: IoT Develoment in Python via GPIO
Got Python I/O: IoT Develoment in Python via GPIO
 
Raspberry Pi with Java
Raspberry Pi with JavaRaspberry Pi with Java
Raspberry Pi with Java
 
Iot lab manual new
Iot lab manual newIot lab manual new
Iot lab manual new
 
Raspberry Pi 3 Tutorial | Raspberry Pi 3 Projects | IoT Projects | IoT Tutori...
Raspberry Pi 3 Tutorial | Raspberry Pi 3 Projects | IoT Projects | IoT Tutori...Raspberry Pi 3 Tutorial | Raspberry Pi 3 Projects | IoT Projects | IoT Tutori...
Raspberry Pi 3 Tutorial | Raspberry Pi 3 Projects | IoT Projects | IoT Tutori...
 
Raspberry Pi Session - 22_11_2014
Raspberry Pi Session - 22_11_2014Raspberry Pi Session - 22_11_2014
Raspberry Pi Session - 22_11_2014
 
Raspberry pi technical documentation
Raspberry pi technical documentationRaspberry pi technical documentation
Raspberry pi technical documentation
 
Raspberry Pi ppt.pptx
Raspberry Pi ppt.pptxRaspberry Pi ppt.pptx
Raspberry Pi ppt.pptx
 
Raspberry Pi ppt.pptx
Raspberry Pi ppt.pptxRaspberry Pi ppt.pptx
Raspberry Pi ppt.pptx
 

Último

一比一维多利亚大学毕业证(victoria毕业证)成绩单学位证如何办理
一比一维多利亚大学毕业证(victoria毕业证)成绩单学位证如何办理一比一维多利亚大学毕业证(victoria毕业证)成绩单学位证如何办理
一比一维多利亚大学毕业证(victoria毕业证)成绩单学位证如何办理
uodye
 
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
wpkuukw
 
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get CytotecAbortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
gajnagarg
 
Abortion pills in Dammam +966572737505 Buy Cytotec
Abortion pills in Dammam +966572737505 Buy CytotecAbortion pills in Dammam +966572737505 Buy Cytotec
Abortion pills in Dammam +966572737505 Buy Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
怎样办理昆士兰大学毕业证(UQ毕业证书)成绩单留信认证
怎样办理昆士兰大学毕业证(UQ毕业证书)成绩单留信认证怎样办理昆士兰大学毕业证(UQ毕业证书)成绩单留信认证
怎样办理昆士兰大学毕业证(UQ毕业证书)成绩单留信认证
ehyxf
 
一比一定(购)UNITEC理工学院毕业证(UNITEC毕业证)成绩单学位证
一比一定(购)UNITEC理工学院毕业证(UNITEC毕业证)成绩单学位证一比一定(购)UNITEC理工学院毕业证(UNITEC毕业证)成绩单学位证
一比一定(购)UNITEC理工学院毕业证(UNITEC毕业证)成绩单学位证
wpkuukw
 
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
uodye
 
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
Mankhurd Call Girls, 09167354423 Mankhurd Escorts Services,Mankhurd Female Es...
Mankhurd Call Girls, 09167354423 Mankhurd Escorts Services,Mankhurd Female Es...Mankhurd Call Girls, 09167354423 Mankhurd Escorts Services,Mankhurd Female Es...
Mankhurd Call Girls, 09167354423 Mankhurd Escorts Services,Mankhurd Female Es...
Priya Reddy
 
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
ehyxf
 
CRISIS COMMUNICATION presentation=-Rishabh(11195)-group ppt (4).pptx
CRISIS COMMUNICATION presentation=-Rishabh(11195)-group ppt (4).pptxCRISIS COMMUNICATION presentation=-Rishabh(11195)-group ppt (4).pptx
CRISIS COMMUNICATION presentation=-Rishabh(11195)-group ppt (4).pptx
Rishabh332761
 
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
uodye
 

Último (20)

一比一维多利亚大学毕业证(victoria毕业证)成绩单学位证如何办理
一比一维多利亚大学毕业证(victoria毕业证)成绩单学位证如何办理一比一维多利亚大学毕业证(victoria毕业证)成绩单学位证如何办理
一比一维多利亚大学毕业证(victoria毕业证)成绩单学位证如何办理
 
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
 
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get CytotecAbortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get Cytotec
 
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
 
Abortion pills in Dammam +966572737505 Buy Cytotec
Abortion pills in Dammam +966572737505 Buy CytotecAbortion pills in Dammam +966572737505 Buy Cytotec
Abortion pills in Dammam +966572737505 Buy Cytotec
 
Abortion pills in Jeddah +966572737505 <> buy cytotec <> unwanted kit Saudi A...
Abortion pills in Jeddah +966572737505 <> buy cytotec <> unwanted kit Saudi A...Abortion pills in Jeddah +966572737505 <> buy cytotec <> unwanted kit Saudi A...
Abortion pills in Jeddah +966572737505 <> buy cytotec <> unwanted kit Saudi A...
 
怎样办理昆士兰大学毕业证(UQ毕业证书)成绩单留信认证
怎样办理昆士兰大学毕业证(UQ毕业证书)成绩单留信认证怎样办理昆士兰大学毕业证(UQ毕业证书)成绩单留信认证
怎样办理昆士兰大学毕业证(UQ毕业证书)成绩单留信认证
 
LANDSLIDE MONITORING AND ALERT SYSTEM FINAL YEAR PROJECT BROCHURE
LANDSLIDE MONITORING AND ALERT SYSTEM FINAL YEAR PROJECT BROCHURELANDSLIDE MONITORING AND ALERT SYSTEM FINAL YEAR PROJECT BROCHURE
LANDSLIDE MONITORING AND ALERT SYSTEM FINAL YEAR PROJECT BROCHURE
 
🌹Patia⬅️ Vip Call Girls Bhubaneswar 📱9777949614 Book Well Trand Call Girls In...
🌹Patia⬅️ Vip Call Girls Bhubaneswar 📱9777949614 Book Well Trand Call Girls In...🌹Patia⬅️ Vip Call Girls Bhubaneswar 📱9777949614 Book Well Trand Call Girls In...
🌹Patia⬅️ Vip Call Girls Bhubaneswar 📱9777949614 Book Well Trand Call Girls In...
 
一比一定(购)UNITEC理工学院毕业证(UNITEC毕业证)成绩单学位证
一比一定(购)UNITEC理工学院毕业证(UNITEC毕业证)成绩单学位证一比一定(购)UNITEC理工学院毕业证(UNITEC毕业证)成绩单学位证
一比一定(购)UNITEC理工学院毕业证(UNITEC毕业证)成绩单学位证
 
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
一比一原版(USYD毕业证书)澳洲悉尼大学毕业证如何办理
 
Guwahati Escorts Service Girl ^ 9332606886, WhatsApp Anytime Guwahati
Guwahati Escorts Service Girl ^ 9332606886, WhatsApp Anytime GuwahatiGuwahati Escorts Service Girl ^ 9332606886, WhatsApp Anytime Guwahati
Guwahati Escorts Service Girl ^ 9332606886, WhatsApp Anytime Guwahati
 
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
 
Hilti's Latest Battery - Hire Depot.pptx
Hilti's Latest Battery - Hire Depot.pptxHilti's Latest Battery - Hire Depot.pptx
Hilti's Latest Battery - Hire Depot.pptx
 
Mankhurd Call Girls, 09167354423 Mankhurd Escorts Services,Mankhurd Female Es...
Mankhurd Call Girls, 09167354423 Mankhurd Escorts Services,Mankhurd Female Es...Mankhurd Call Girls, 09167354423 Mankhurd Escorts Services,Mankhurd Female Es...
Mankhurd Call Girls, 09167354423 Mankhurd Escorts Services,Mankhurd Female Es...
 
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
 
CRISIS COMMUNICATION presentation=-Rishabh(11195)-group ppt (4).pptx
CRISIS COMMUNICATION presentation=-Rishabh(11195)-group ppt (4).pptxCRISIS COMMUNICATION presentation=-Rishabh(11195)-group ppt (4).pptx
CRISIS COMMUNICATION presentation=-Rishabh(11195)-group ppt (4).pptx
 
Point of Care Testing in clinical laboratory
Point of Care Testing in clinical laboratoryPoint of Care Testing in clinical laboratory
Point of Care Testing in clinical laboratory
 
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
 

Exploring the abc's of raspberry pi and python(day 2)

  • 1. Shahed Mehbub President, Robo Mechatronics Association Bangladesh(RMABD) Day 2
  • 2. Setting up the Pi 6. USB TO POWER SOURCE 5. TO MONITOR 4. TO MOUSE 3. TO KEYBOARD 2. WI-FI ADAPTER 1. SD CARD
  • 3. Operating Systems for Pi • Raspbian (Jessie, Jessie lite) • Ubuntu (Snappy Ubuntu Core) • Fedora • Debian • Archlinux ARM • Windows 10 IoT Core • Kali Linux • OpenELEC • RetroPIe
  • 4. Preparing the SD card with an OS • Step 1: Download bootable disk .iso's (raspbian jessie) • Link:https://www.raspberrypi.org/downloads/raspbian • Step 2: Write iso image to SD card • For Windows/Mac/Linux https://www.balena.io/etcher/
  • 5. Let's boot it up!!! • Plug in all the accessories • Plug in the power cable • Pi will start booting automatically (First boot may take a long time) • You may have to face a configure window (If it happens, follow it through)
  • 6. Default Credentials for a new user • If you encounter for a username and password: • username: pi • password: raspberry • After login, type 'startx' to go to the Desktop
  • 8. Time for making it home! ▶▶ ▶▶
  • 9. Wifi Configuration Menu > Preferences > Wifi Configuration OR Click on the network icon on the top panel
  • 11. Do a system update (It is important to function all the apps working correctly) • Open up the terminal: • Write--> sudo apt-get update • and--> sudo apt-get upgrade ** Reboot after completing the update process and we are good to go!!! :D
  • 13. GPIO on Raspberry Pi • 26 GPIO Header in Model A/B and 40 GPIO Header in Model B • These pins are a physical interface between the Pi and the outside world. • Out of 26, 8 are dedicated IO Lines, 2 are for UART, 4 are for SPI (+1 for Another Chip Select) , and another 2 for the I2C Interface (Total 17 out of 26) • Rest are Supply Rails. • Model B+ has 9 additional GPIO including a extra SPI (Total 17 + 9 = 26 out of 40) • WiringPi : Easy to use C Library for accessing the GPIO Lines via Programming (Arduino Style Programming)
  • 14. Let's Do Blinky!!! Making of a LED Blinker using Python ==> What you will need: -> A raspberry pi -> A LED -> A 330Ω resistor to protect the LED -> Jumper wires
  • 15. Let's Do Blinky!!! Step 1: Make sure if the LED is okay • Connect the jumper wires as shown • One wire on the short leg of LED (Negative) • Another one attached with the resistor is on the long leg (Positive) LED
  • 16. Let's Do Blinky!!! Step 1: Make sure if the LED is okay • Connect the wires as shown • One in the 3.3V pin (Positive wire) • Another one is in GND ** Check if the LED is on! 3.3V (Pin 1) GND Cathode Anode (longer leg)
  • 17. Let's Do Blinky!!! 3.3V Ground GPIO (general purpose input output)
  • 19. 5 functions to control GPIO’s • GPIO.setmode() • GPIO.setwarnings() • GPIO.setup() • GPIO.input() • GPIO.output()
  • 20. Let's Do Blinky!!! ->Programming the LED import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) LED = 4 GPIO.setup(LED,GPIO.OUT) while True: GPIO.output(LED,True) time.sleep(1) GPIO.output(LED,False) time.sleep(1) import RPi.GPIO libs set LED pin as output toggle light pin signal to low/high to make it blink. set pin type. use BCM, not pin number GPIO 4 pin (Pin 7)
  • 21. Congrats!!! You just finished your first Raspberry Pi project!
  • 22. Button input - Wiring
  • 23. Performing GPIO Input #import RPi.GPIO as GPIO import EmulatorGUI as GPIO import time GPIO.setmode(GPIO.BCM) INPUTPIN= 23 GPIO.setup(INPUTPIN, GPIO.IN, pull_up_down=GPIO.PUD_UP) while True: if(GPIO.input(INPUTPIN) == True): print(‘this’) else: print(‘that’)
  • 24. Your Task!! Write a program that pushing a button will turn on an LED
  • 25. Solution import EmulatorGUI as GPIO import time GPIO.setmode(GPIO.BCM) INPUTPIN= 23 led = 4 GPIO.setup(INPUTPIN, GPIO.IN, pull_up_down=GPIO.PUD_UP) while True: if(GPIO.input(INPUTPIN) == True): led.on() else: led.off() def led_on(): GPIO.output(led, True) Def led_of(): GPIO.output(led, False)