LTKA Labs
SBCs & Raspberry Pi BasicsEueung Mulyana
http://eueung.github.io/ET3010/raspiET-3010 | Attribution-ShareAlike CC BY-SA
1 / 59
Outline
Single Board Computers
Raspberry Pi - Short Introduction
RPi Pinout
Raspbian - Getting Started
Node-RED & Python
2 / 59
SBCs
Single Board Computers
3 / 59
A Single-Board Computer (SBC) is a computer built on a singlecircuit board, with microprocessor(s), memory, input/output(I/O) and other features required of a functional computer.SBCs typically provide a fanless, low-power computing solution.Current SBCs come with a wide variety of processor types, mostwith GPUs on-board. These processors range from X86 basedprocessors from the traditional PC space (AMD and Intel) toARM processors which have traditionally been used in theindustrial and more recently mobile spaces. The most prevalentform of software used on SBCs is Linux with numerousderivations including Android, Ubuntu, Fedora, Debian and ArchLinux as well as FreeBSD.
Many of today's SBCs have become so powerful that they arebeginning to have the capability of modern day PCs and tablets.This trend will continue as more powerful processors make theirway into the embedded computing market as ever-increasingperformance/price ratios rise, as well as additionalmanufacturers enter into this "Wild West" frontier of supportingopen source hardware and software for both DIYers andprofessionals alike.
SBCsIn 2006, a group based in the University of Cambridge'sComputer Laboratory, decided to address the need for a lowcost computing platform that would allow kids to learn how toprogram without the need for a full-¯edged home computer.
The result was a $35 single board computer named RaspberryPi. While initially designed as a tool for students to learnprogramming, the Raspberry Pi was adopted by makers,designers, students and even professional engineers andhelped to launch the current boom in interest in SBCs.
Ref: Electronic Design, Then and Now A Brief History of SingleBoard Computers
4 / 59
5 / 59
Nine Sub-$50 SBCsthat Challenge theRaspberry Pi and
BeagleBone Black
86Duino, A10-OLinuXino-Lime,Arduino TRE, Banana Pi, BPi D1,HummingBoard-i1, Odroid-C1,Orange Pi, and pcDuino3 Nano
Ref: hackerboards.com
6 / 59
Top 10 Sub-$100Hacker SBC List for
2015 (in Order ofImportance)
Ref: hackerboards.com
64-bit SBCs: DragonBoard 410c & Pine A64
7 / 59
Raspberry Pi / RPi / RasPi
Short Introduction
8 / 59
What is a Raspberry Pi?
The Raspberry Pi is a low cost, credit-card sized computer that plugs into acomputer monitor or TV, and uses a standard keyboard and mouse. It is a capablelittle device that enables people of all ages to explore computing, and to learn howto program in languages like Scratch and Python. It's capable of doing everythingyou'd expect a desktop computer to do, from browsing the internet and playing
high-de nition video, to making spreadsheets, word-processing, and playinggames.
What's more, the Raspberry Pi has the ability to interact with the outside world, and has been used in a wide arrayof digital maker projects, from music machines and parent detectors to weather stations and tweeting birdhouses
with infra-red cameras.
9 / 59
10 / 59
Credit card sized single boardcomputer
Teach computer science in
schools at an a!ordable price:Grade School, Middle School &
High School
Design and Development startedin 2006
Raspberry PI Foundation
founded in 2009
Release to Market Feb 2012
3 Million sold by June 2014 5 Million by 03/2015
11 / 59
Early Models A, BRaspberry PI Model A $25 - 256 MBRAM, 1 USB, No Ethernet, GPIO 26
Raspberry PI Model B $35 - 512 MBRAM, 2 USB, Ethernet , GPIO 26
Raspberry PI Model B+ $35 - 512MB RAM, 4 USB, Ethernet, GPIO 40
All have HDMI Out with Audio
All have Audio Jack out
12 / 59
Model A/B:Broadcom BCM2835 (CPU & GPU)256/512MB SDRAM1/2 USB 2.0 PortsNone/Ethernet PortHDMIAudioSD Card SlotMicro USB for power
13 / 59
14 / 59
RPi Model B
Power
15 / 59
RPi Model B
Audio &Video
16 / 59
RPi Model B
Connectivity
17 / 59
RPi Model B
Internals
18 / 59
RPi Model B
Storage
19 / 59
RPi Model B
Parts
20 / 59
CPU Overview
BCM2835ARM11J6JZF-S (ARM11 Family)ARMv6 ArchitectureSingle Core32-Bit RISC700 MHz Clock Rate8 Pipeline StagesBranch Prediction
21 / 59
22 / 59
RPi 2BBCM 2836ARMv7 ArchitectureQuad Core32-Bit RISC900 MHz Clock Rate1 GB RAM
23 / 59
24 / 59
25 / 59
26 / 59
RPi 3BBCM 2837ARMv8 ArchitectureQuad Core64-Bit1.2 GHz Clock Rate1 GB RAM
27 / 59
28 / 59
29 / 59
30 / 59
31 / 59
RPi Pinout
32 / 59
33 / 59
34 / 59
35 / 59
The Raspberry Pi is a 3.3V deviceThe GPIO pins are unbu!ered andunprotected, so if you short somethingout, you could fry your whole Pi, so becareful!
37 / 59
Notes
On Raspberry Pi, all GPIO banks are supplied from 3.3V.Connection of a GPIO to a voltage higher than 3.3V will likely
destroy the GPIO block within the SoC.
38 / 59
Physical Computing
RPi vs. Arduino
Arduino boards are micro-controllers, not full computers.They don't run a full operating system, but simply execute
written code as their rmware interprets it.
You lose access to the basic tools an operating systemprovides, but on the other hand, directly executing simple
code is easier, and is accomplished with no operating systemoverhead.
The main purpose of the Arduino board is to interface withsensors and devices, so it's great for hardware projects in
which you simply want things to respond to various sensorreadings and manual input.
Ref: Digital Trends via Kopcak
Raspbian
Getting Started
39 / 59
41 / 59
Raspbian JessieRelease 2016-03-18
Full Desktop vs. Lite
1. Plug the SD Card loaded with the Operating System intothe Raspberry Pi.
2. If required, plug the USB keyboard and mouse into theRaspberry Pi, perhaps via a USB Hub. Connect the Hub topower, if necessary.
3. If required, plug the video cable into the display and intothe Raspberry Pi.
4. Plug in your Network cable, or Wi-Fi dongle, if required.5. Ensure that your USB Hub (if any) and display are
working.6. With your screen on, plug the other end of the power
source into the Raspberry Pi.7. Plug the power source into the main socket, and switch it
on.8. If connected to a display, the Raspberry Pi should boot up
and display messages on the screen.9. If running headless, it should boot up. When the leds
have stopped ¯ashing, connect to the Raspberry Pi fromthe remote computer. Whether this works will depend onthe operating system you are using; the Raspian Linuxoperating system is con gured to allow SSH connectionsby default.
42 / 59
General StepsIt is always recommended to connect the MicroUSB Power to
the unit last (while most connections can be made live, it isbest practice to connect items such as displays and other
connections with the power turned o!).
Ref: Basic Setup
44 / 59
45 / 59
SSH via PuTTY
46 / 59
SSH Console
raspi-config
Remote SSH Session
# credential: pi/raspberry$ sudo raspi-config
# after reboot$ df -h
$ uname -a$ lsb_release -a
TightVNC Server
$ sudo apt-get install tightvncserver
$ tightvncserver # access password, min 6 chars
$ vncserver :1 -geometry 800x600 -depth 24$ sudo service lightdm stop
47 / 59
Some CLIs
48 / 59
VNC Client
49 / 59
Node-RED & Python
50 / 59
Node-RED is a tool for wiring together hardware devices,APIs and online services in new and interesting ways.
Node-RED provides a browser-based ¯ow editor that makesit easy to wire together ¯ows using the wide range nodes inthe palette. Flows can be then deployed to the runtime in a
single-click.
JavaScript functions can be created within the editor using arich text editor.
A built-in library allows you to save useful functions,templates or ¯ows for re-use.
Ref: Node-RED
51 / 59
Node-REDA visual tool for wiring the Internet of Things
52 / 59
53 / 59
54 / 59
55 / 59
56 / 59
Pythonvia IDLE
import RPi.GPIO as GPIOimport time
GPIO.setmode(GPIO.BCM)GPIO.setwarnings(False)
led = 4GPIO.setup(led,GPIO.OUT)
def blink(pin): GPIO.output(pin,1) time.sleep(1) GPIO.output(pin,0) time.sleep(1)
for i in range (0,10): blink(led)
GPIO.cleanup()
Refs
57 / 59
Refs1. Top ten sub-$100 hacker SBCs for your holiday pleasure2. Ringing in 2015 with 40 Linux-friendly hacker SBCs3. Cli! Ortmeyer, Then and Now A Brief History of Single Board Computers,
Electronic Design, Issue 6, December 20144. RPi Low-level peripherals - eLinux.org5. Introducing the Raspberry Pi 3 | Hackaday6. Adafruit Learning System7. Je!rey Kopcak, An Introduction to the Credit-Card Sized Computer8. The MagPi Magazine - The oþcial Raspberry Pi magazineThe MagPi Magazine9. Mike Linnen, What can I do with a Raspberry Pi
10. Jon Holton and Tim Fratangelo, Raspberry Pi Architecture
58 / 59
ENDEueung Mulyana
http://eueung.github.io/ET3010/raspiLTKA Labs | Attribution-ShareAlike CC BY-SA
59 / 59