Starting with the pi

5
Raspberry Pi: educational courses in several parts Initial setup Hardware: CanaKit Raspberry Pi B (or B+) Ultimate Starter Kit. USB Hub: powered hub recommended, so as not to compete with the Pi for power. Manhattan 7-Port USB 2.0 Ultra Hub, as an example Display of some kind. HDMI or DVI-D recommended, analog (VGA or yellow RCA jack) not recommended Adapter for display, if necessary Keyboard & mouse Normal USB devices work well enough when connected to a powered USB hub. Power strip The total price per kit is likely to be somewhere in the $125 range, possibly more depending in particular on your displays. Software: For each kit, use NOOBS to install Raspbian. Customize the keyboard layout to your locale – the default is UK English (en_GB.utf8). Set the data and time. Set the hostname. We numbered our kits and set the hostnames to match, e.g. librarypi1, librarypi2, librarypi3, etc. Set the password for the default user (pi). We chose “library” as the password, which also gave students a great opportunity to practice consistently spelling “library” correctly. Set the default behavior on boot. We chose to have it go to a command prompt, so that starting the X Window System is a deliberate act, which helped especially with the hardware-focused sessions. For the hardware units, also install ScratchGPIO ( http://simplesi.net/scratchgpio/scratch-raspberrypi-gpio/) and lightshowPi ( http://www.lightshowpi.com/) on each kit. Additional music for lightshowPi could be fun, as long as you don't run afoul of copyright issues. Nothing additional is required for the software units. If you want to show off some of the beauty of code and its results, refer to http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated- python/. It will run on a Pi, but allow several hours for the program to

Transcript of Starting with the pi

Page 1: Starting with the pi

Raspberry Pi: educational courses in several parts

Init ial setup

Hardware:

CanaKit Raspberry Pi B (or B+) Ult imate Starter Kit .

USB Hub: powered hub recommended, so as not to compete with the Pi for power.

◦ Manhattan 7-Port USB 2.0 Ult ra Hub, as an example

Display of some kind.

◦ HDMI or DVI-D recommended, analog (VGA or yellow RCA jack) not

recommended

Adapter for display, if necessary Keyboard & mouse

◦ Normal USB devices work well enough when connected to a powered

USB hub.

Power strip

The total price per kit is likely to be somewhere in the $125 range, possibly more depending in part icular on your displays.

Software: For each kit , use NOOBS to install Raspbian.

Customize the keyboard layout to your locale – the default is UK English (en_GB.utf8).

Set the data and t ime.

Set the hostname. We numbered our kits and set the hostnames to match, e.g. librarypi1, librarypi2, librarypi3, etc.

Set the password for the default user (pi). We chose “library” as the

password, which also gave students a great opportunity to practice consistent ly spelling “library” correctly.

Set the default behavior on boot. We chose to have it go to a command prompt, so that starting the X Window System is a deliberate act, which

helped especially with the hardware-focused sessions.

For the hardware units, also install ScratchGPIO (http://simplesi.net/scratchgpio/scratch-raspberrypi-gpio/) and

lightshowPi (http://www.lightshowpi.com/) on each kit . Addit ional music

for lightshowPi could be fun, as long as you don't run afoul of copyright issues.

Nothing addit ional is required for the software units. I f you want to show off some of the beauty of code and its results, refer to

http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-

python/. It will run on a Pi, but allow several hours for the program to

Page 2: Starting with the pi

complete.

Logist ics: Make sure you have a space and t ime for the classes.

Check the electrical setup for the space.

◦ Ensure that there are sufficient wall out lets for the number of kits you

intend to use.

◦ Ensure that the building's electrical circuits in quest ion can handle a

sustained load of 4A-5A for each kit , simultaneously. This figure is on

the high side, but maximum draw of 1A for the Pi, 2A for the USB hub, and 1A for the monitor approaches that load. Nobody wants to pause

a technology program because the electricity goes out...and nobody wants to be in a posit ion to take the blame for it , either.

1-1: An Introduction

Objectives:

Safety

Basic familiarizat ion Setup

Teardown

Safety first ! When dealing with electrical components, consider the following

guidelines:

1. If it 's metal or otherwise conductive, don't touch it .

2. If you have to touch it , but you aren't 100% sure that it is NOT energized, ask for help.

3. Add power last. Remove power first . 4. Keep it dry. Food and drink should be a safe distance away...like in another

room.

Make sure everybody gets to go home in the same condit ion they came.

Basic familiarizat ion:

Many have used computers (probably all of your students), but few of them are likely to have built one. A primary objective of this session is to demyst ify the

circuit board that is the Raspberry Pi, and move it into the realm of attainable

tools, like hammers or screwdrivers.

Unpack the kit , lay out the pieces, and go through each one. Monitor, keyboard, mouse

Page 3: Starting with the pi

USB hub and its power adapter

Contents of the Pi kit

◦ Power adapter (different from the USB hub)

◦ WiFi dongle

◦ HDMI cable

◦ Breadboard

◦ GPIO ribbon cable

◦ Electrical components: wires, LEDs, buttons, resistors, etc.

◦ Case

◦ Raspberry Pi.

Also spend some t ime going on a tour of the Pi itself. SD card slot (on the bottom)

GPIO pins (sharp AND electrified) RCA-style yellow video plug

Headphone jack

Indicator LEDs USB ports

Ethernet port

HDMI plug Power plug

Setup:

Take some t ime with this step. It will serve everybody well for all the classes to come.

Attach power last. Attach things to the Pi last, too.

Start with the monitor. Plug in the HDMI/DVI -D/RCA cable, depending on your device.

Plug in the keyboard, mouse, and WiFi dongle to the USB hub.

Attach the video cable to the Pi. Attach the USB hub's cable to the Pi.

Insert the SD card. Make sure it is seated properly – this is the most common cause of boot failure.

Plug in the power strip. Plug in the monitor to the power strip, and turn it on.

Plug in the USB hub's adapter to the power strip, and plug it in to the USB hub.

Plug in the Pi's adapter to the power strip.

Page 4: Starting with the pi

Finally, plug in the Pi's power cord, and watch it turn on.

In the unlikely event that sparks fly anywhere, immediately remove people from

danger. Disconnect the power safely, by turning off the power strip or unplugging it from the wall. Once the scene is safe, assess the situation for

human injuries, and treat appropriately. Finally, assess any hardware injuries,

and begin step by step diagnost ics to determine where the problem is, why it happened, and how to prevent it from happening again.

In the more likely event that somebody's Pi doesn't turn on, the following general t roubleshooting t ips could help:

1. Check the power. Is the power strip on? Is the monitor on? Is the Pi on (does it have any glowing indicator lights)?

2. Check the connections. Is the video cable secure? Are the power cables

secure? Are the USB cables secure? Is the SD card seated properly? 3. Try it again.

Logging in:

Now that the system is on, watch the init ializat ion scroll past. When the login prompt appears, do so.

Login: pi

Password: library

The password will not be displayed. If it doesn't work, don't worry, t ry again. This

is a great way to learn how to spell and type “library” perfectly.

Page 5: Starting with the pi

Once login is complete, the command prompt is displayed. Although this is a powerful environment, it can also be int imidating, so let 's get to a GUI. Invoke

the following command:

startx

This starts the X Windows System, a Windows-like GUI environment for Linux. Click

around and get a lit t le familiar with the system.

Shutting down:

Like most modern operating systems, Linux stores some of the filesystem in

memory to improve performance, so you don't want to pull the plug without giving the system a chance to clean up. When it is t ime to shut down the Pi,

open LX Terminal and invoke the following command:

sudo shutdown -h now

Breaking it down:

sudo – “as a superuser, ”

shutdown – “shut down the system” -h – “by halt ing it cleanly”

now – “and do it right now.”

Wait for the Pi to shut down, and unplug the Pi's power cable.

Teardown:

Start ing with the power cords and power strip, unplug everything. Wrap up the cords nicely.

Before putting it all away, ask somebody to double-check that all the pieces are

there! This inventory check is important. Pack all the pieces back in the container(s) from whence they came. Leave

the kits nicer than you found them, if at all possible. You don't know which one you'll be unpacking next t ime, so be nice.