Sie sind auf Seite 1von 22

RASPBERRY PIE

Topic
• Introduction
• Hardware
• Setup
• Installation
• Remote access
• Linux
• GPIO
• Python Programming
• Practice Activity
Introduction and Parts
• Raspberry Pie
o The Raspberry Pi is a credit-card-sized computer that
plugs into your TV and a keyboard. It is a capable
little computer which can be used in electronics
projects, and for many of the things that your desktop
PC does.
Introduction and Parts
Specifications
• SoC BCM2837
• CPU Quad Cortex A53 @ 1.2Ghz
• GPU 400Mhz VideoCore lV
• RAM 1Gb RAM
• Storage micro-SD 8GB(Recommended)
• Ethernet 10/100
• Wireless 802.11n/Bluetooth 4.0
• Video Output HDMI
• Audio Output Headphone
• GPIO 40
GPIO Pins
Setup
• What you will need
• SD Card 8GB recommended
• Display HDMI
• Keyboard and Mouser
• Power Supply
• SD Card Reader
• Software need
• Etcher
• SD Card Formatter
• Any Text Editor
• Raspbian Operating System
• Putty (for Remote Access)
Installation
• Steps
• Quick Format SD Card
• Open Etcher Select disc image and drive
• Flash and Wait
• Insert SD Card to Raspberry Pie
• Connect and Boot
Remote Access (SSH)
• What you will need
• Putty
• Any Text Editor
• SD Card
• SD Card Reader
• Wireless Local Area Network
• Windows For Putty
Remote Access
• Steps
• Enable SSH (Secure Shell)
• Create a Empty document named ssh (ex. Ssh.txt)
• Paste ssh file into the SD Card boot Portion
• Create a wpa_supplicant.conf file to enable wi-fi
connection and connect to the WLAN
• Paste wpa_supplicant.conf into SD Card boot
Portion
Remote Access
• Write Code into wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant
GROUP=netdev
update_config=1

network={
ssid=“Network SSID"
scan_ssid=1
psk=“WPA/WPA2 security key"
key_mgmt=WPA-PSK
}
Remote Access
• Steps using PUTTY in windows
• Open Putty
• Get the IP Address of the
Raspberry Pie
• Input into the host name
• Connection type: SSH
Remote Access
• Login as pi
• Password: raspberry
• SSH UI
Linux Command
• LS
• Command lists the content of the current directory.
• CD
• Change the current directory to the one specified. ( i.e. cd
DirectoryName ) or absulote ( i.e cd /home/Desktop/Directory ).
• Back to the last directory ( i.e cd .. ) or ( i.e cd ../../.. ).
• PWD
• Command displays the name of the present working directory: on a
Raspberry Pi.
• MKDIR
• You can use mkdir to create a new directory, e.g. mkdir newDir
would create the directory newDir in the present working directory.
Linux Command
• RMDIR
• To remove empty directories, use rmdir. So, for example, rmdir
oldDir will remove the directory oldDir only if it is empty.
• RM
• Remove specified file (or recursively from a directory when used
with -r)
• CP
• makes a copy of a file and places it at the specified location (this is
similar to copying and pasting).
• MV
• Command moves a file and places it at the specified location (so
where cp performs a 'copy-paste‘.
Linux Command
• Sudo
• command enables you to run a command as a superuser, or
another user. Use sudo -s for a superuser shell. Ctrl + D to exit in
the superuser shell
• Nano
• is at the easy-to-use end of command-line editors. It's installed by
default, so use “nano somefile.txt “. to edit a file, and keyboard
shortcuts like Ctrl + O to save and Ctrl + X to exit.

More Commands in
https://www.raspberrypi.org/documentation/linux/usage/commands.md
Shutdown Command
• sudo shutdown –h now
• sudo - run the command as superuser shutdown
• - shut down the pi
• -h - halt after shutting down (do not reboot)
• now - do this now (required time command)
• sudo shutdown –r now
• sudo - run the command as superuser shutdown
• - shut down the pi
• -r - reboot the pi after shutting down
• now - do this now (required time command)
GPIO (general-purpose input output)
• Install latest python GPIO
• sudo apt-get install python-rpi.gpio update fo new version
• Voltages
• Two 5V pins and two 3V3 pins are present on the board, as well as a
number of ground pins (0V), which are unconfigurable. The remaining
pins are all general purpose 3V3 pins, meaning outputs are set to 3V3
and inputs are 3V3-tolerant.
• Outputs
• A GPIO pin designated as an output pin can be set to high (3V3) or
low (0V).
• Inputs
• A GPIO pin designated as an input pin can be read as high (3V3) or
low (0V). This is made easier with the use of internal pull-up or pull-
down resistors. Pins GPIO2 and GPIO3 have fixed pull-up resistors,
but for other pins this can be configured in software
GPIO Basic Example
• LED light
• Steps
• creating python file
sudo nano led.py
• Code

Import RPi.GPIO
Import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)

GPIO.output(18, GPIO.HIGH)
time.sleep(3)
GPIO.output(18, GPIO.LOW)
GPIO.cleanup()
Python Programming
• Basic Syntax
• Variable Types
• Basic Operators
• Decision Making
• Loops
• Lists
• Function
• Classes
• Objects
GPIO Basic Example
• 3 led Traffic light
• Red – 15 seconds red
• Yellow – 2 seconds yellow toggle
• Green – 15 seconds green
• repeat

• Tact switch light blinker


• Press 1 time blink every 1 seconds
• Press 2 time blink every 2 seconds
• Press 3 times blink every 3 seconds
Practice Activity
• Create a full traffic light in an intersection with 8
green lights and 4 red lights 4 yellow lights

Das könnte Ihnen auch gefallen