KEMBAR78
Exploring the ABC's of Raspberry Pi with Python | PPTX
Shahed Mehbub
President, Robo Mechatronics Association Bangladesh(RMABD)
What we are gonna learn today
• Introduction to Raspberry Pi
• Hardware description
• OS instruction
• Linux Shell Commands
• Python Basics
What is a Raspberry Pi?
• Credit Card sized single board computer
• Plugs into a TV or a Monitor
• Based on Broadcom chips
• Runs a complete version of Linux
• Has multiple usb ports for communication
• Supports gigabit ethernet lan 10/100
• Can deliver full HD (1080P) video output
• Affordable
Why Raspberry Pi?
• Very Low Cost ($25 for Model A & $35 for Model B/B+)
• Great tool for Learning Programming, Computers & Concepts of
Embedded Linux, etc
• Support for All Age Groups (School Children, College
Undergraduates, Professional Developers, Programmers)
• Supports & runs Free and Open Source Linux OS
• Consumes less than 5W of Power
• Supports Full HD Video Output (1080p), Multiple USB Ports , etc
• Fun to learn & explore. You are limited by your imagination
Technology used in a Pi
Model A
Model B+
Model B+
Hardwares :
Arduino vs Raspberry Pi
Specs Arduino Uno Raspberry Pi Model B+
CPU type Microcontroller Microprocessor
Operating System None Linux (usually Raspbian)
Speed 16 Mhz 700 Mhz
RAM 2KB 512MB
GPU/Display None VideoCore IV GPU
Disk 32KB Depends on SD card
GPIO pins 14 digital pins (includes 6 analog) 26 digital pins
Other connectivity None USB, Ethernet, HDMI, audio
Power consumption 0.25W 3.5W
Minimum things to get started
• Raspberry Pi
• HDMI/VGA monitor
• USB Keyboard
• USB Mouse
• USB WiFi adapter (If isn't built-in)
• 2.0+ Amp USB Power Adapter
• Micro-USB cable
• 8GB+ Micro-SD card
• A Computer to load initial card image
Raspberry Pi Desktop
A tour to Raspbian
• Web Browser: Epiphany
• Office Applications: Libreoffice
• Media Player: VLC
• Run: sudo apt-get install vlc
• Programming:
• Geany (an IDE)
• IDLE, IDLE3 (python IDE)
• Sonic Pi
• Scratch
A Little bit of linux
• Bash (Linux Shell)
• Terminal Commands
• Linux File Systems
Linux Shell
• To interact with the Operating System or
Hardware we need to enter some
commands in the “Shell”.
• Simply put, the shell is a program that
takes your commands from the
keyboard and gives them to the
operating system to perform.
Basic Linux Commands
• Show directory contents:
• (Do this after every command below to see what has changed)
• ls or ls -l
• Make directory:
• mkdir lesson
• Change directory:
• cd lesson
• Create an empty file:
• touch myfile
• Edit file with nano:
• nano myfile
• Type something random inside the text editor then press Ctrl+X to save and quit.
• View file quickly:
• cat myfile
• Copy file
• cp myfile myfile2
• Remove file:
• rm myfile
• Move file
• mv myfile2 myfile
More Useful Commands
Command Purpose
man Get information about a particular
command. Eg: man ls
ifconfig Get network information like IP
address
adduser Create user
passwd Change password
uname –a, uname -r Show OS information
history Shows past commands you ran
chmod Change permissions of a file/directory
File System Directory Layout
• /home/pi or “~”
• Your “Home” directory
• Removable Drives at
• /media/pi/….
Programming on Raspberry Pi
• Raspberry Pi supports several Programming Languages like : Python,
C, C++, JAVA, Perl, HTML5, JavaScript, JQuery etc.
• Python is supported as the principal or main user programming
language.
• Extremely powerful and flexible language.
• Can also be used to control hardware on the Pi.
• Compiled using gcc (GNU Compiler Collection)
** Learning Programming = Practice Writing Programs
Programming on Raspberry Pi
Time to do Python!
Why Python!
• General Purpose Language
• Large Standard Code Library
• Can be compiled to Machine Language
• Can call C code (ctypes)
• Cleaner Coding Style
• Lots of libraries
Life is short…
(Learn Python)
Python Basics – Where to write Python
• IDLE
• Spyder
• Atom
• PyCharm
Python Basics – What to learn
• Print Statements
• Indentation
• Variables
• Comments
• Lists, Dictionaries
• Conditionals – if, elif
• Loops
• Iteration and Range
• Functions
• Exception Handling
Python Basics – Print Statements
print(“Hello World!!!”)
Python Basics – Indentation
Python Basics – Variables
• Numbers(int, float, long, complex)
• Strings
• Boolean
• List
• Tuple
• Dictionary
Python Basics – Comments
Python Basics – Lists and Dictionaries
Python Basics – Conditionals
Python Basics – Loops
Python Basics – Iteration and Range
Python Basics – Functions
Python Basics – Exception Handling
Questions!
Exploring the ABC's of Raspberry Pi with Python

Exploring the ABC's of Raspberry Pi with Python

  • 1.
    Shahed Mehbub President, RoboMechatronics Association Bangladesh(RMABD)
  • 2.
    What we aregonna learn today • Introduction to Raspberry Pi • Hardware description • OS instruction • Linux Shell Commands • Python Basics
  • 3.
    What is aRaspberry Pi? • Credit Card sized single board computer • Plugs into a TV or a Monitor • Based on Broadcom chips • Runs a complete version of Linux • Has multiple usb ports for communication • Supports gigabit ethernet lan 10/100 • Can deliver full HD (1080P) video output • Affordable
  • 4.
    Why Raspberry Pi? •Very Low Cost ($25 for Model A & $35 for Model B/B+) • Great tool for Learning Programming, Computers & Concepts of Embedded Linux, etc • Support for All Age Groups (School Children, College Undergraduates, Professional Developers, Programmers) • Supports & runs Free and Open Source Linux OS • Consumes less than 5W of Power • Supports Full HD Video Output (1080p), Multiple USB Ports , etc • Fun to learn & explore. You are limited by your imagination
  • 5.
    Technology used ina Pi Model A Model B+ Model B+
  • 6.
  • 7.
    Arduino vs RaspberryPi Specs Arduino Uno Raspberry Pi Model B+ CPU type Microcontroller Microprocessor Operating System None Linux (usually Raspbian) Speed 16 Mhz 700 Mhz RAM 2KB 512MB GPU/Display None VideoCore IV GPU Disk 32KB Depends on SD card GPIO pins 14 digital pins (includes 6 analog) 26 digital pins Other connectivity None USB, Ethernet, HDMI, audio Power consumption 0.25W 3.5W
  • 8.
    Minimum things toget started • Raspberry Pi • HDMI/VGA monitor • USB Keyboard • USB Mouse • USB WiFi adapter (If isn't built-in) • 2.0+ Amp USB Power Adapter • Micro-USB cable • 8GB+ Micro-SD card • A Computer to load initial card image
  • 9.
  • 10.
    A tour toRaspbian • Web Browser: Epiphany • Office Applications: Libreoffice • Media Player: VLC • Run: sudo apt-get install vlc • Programming: • Geany (an IDE) • IDLE, IDLE3 (python IDE) • Sonic Pi • Scratch
  • 11.
    A Little bitof linux • Bash (Linux Shell) • Terminal Commands • Linux File Systems
  • 12.
    Linux Shell • Tointeract with the Operating System or Hardware we need to enter some commands in the “Shell”. • Simply put, the shell is a program that takes your commands from the keyboard and gives them to the operating system to perform.
  • 13.
    Basic Linux Commands •Show directory contents: • (Do this after every command below to see what has changed) • ls or ls -l • Make directory: • mkdir lesson • Change directory: • cd lesson • Create an empty file: • touch myfile • Edit file with nano: • nano myfile • Type something random inside the text editor then press Ctrl+X to save and quit. • View file quickly: • cat myfile • Copy file • cp myfile myfile2 • Remove file: • rm myfile • Move file • mv myfile2 myfile
  • 14.
    More Useful Commands CommandPurpose man Get information about a particular command. Eg: man ls ifconfig Get network information like IP address adduser Create user passwd Change password uname –a, uname -r Show OS information history Shows past commands you ran chmod Change permissions of a file/directory
  • 15.
    File System DirectoryLayout • /home/pi or “~” • Your “Home” directory • Removable Drives at • /media/pi/….
  • 16.
    Programming on RaspberryPi • Raspberry Pi supports several Programming Languages like : Python, C, C++, JAVA, Perl, HTML5, JavaScript, JQuery etc. • Python is supported as the principal or main user programming language. • Extremely powerful and flexible language. • Can also be used to control hardware on the Pi. • Compiled using gcc (GNU Compiler Collection) ** Learning Programming = Practice Writing Programs
  • 17.
  • 18.
    Time to doPython!
  • 19.
    Why Python! • GeneralPurpose Language • Large Standard Code Library • Can be compiled to Machine Language • Can call C code (ctypes) • Cleaner Coding Style • Lots of libraries Life is short… (Learn Python)
  • 20.
    Python Basics –Where to write Python • IDLE • Spyder • Atom • PyCharm
  • 21.
    Python Basics –What to learn • Print Statements • Indentation • Variables • Comments • Lists, Dictionaries • Conditionals – if, elif • Loops • Iteration and Range • Functions • Exception Handling
  • 22.
    Python Basics –Print Statements print(“Hello World!!!”)
  • 23.
    Python Basics –Indentation
  • 24.
    Python Basics –Variables • Numbers(int, float, long, complex) • Strings • Boolean • List • Tuple • Dictionary
  • 25.
  • 26.
    Python Basics –Lists and Dictionaries
  • 27.
    Python Basics –Conditionals
  • 28.
  • 29.
    Python Basics –Iteration and Range
  • 30.
  • 31.
    Python Basics –Exception Handling
  • 32.