You are on page 1of 100

The official Raspberry Pi magazine Issue 50 October 2016 raspberrypi.

org/magpi

Issue 50 Oct 2016 5.99

10

The definitive countdown of the


most inspirational builds ever
9 772051 998001
Strato Pi Touch Display

Raspberry Pi 3 Power Supply 12-28VDC Aluminium and steel rear chassis


Raspberry Pi Touch Display Real Time Clock Brushed aluminium front bezel
Strato Pi board Buzzer Optional back box for wall mount
Optional RS232/RS485 & UPS

www.sferalabs.cc
Welcome

WELCOME TO
OUR SPECIAL
50TH ISSUE!
hen I was planning the relaunch of
W The MagPi as the official Raspberry Pi
magazine some 20 issues ago, I was
determined that the community should remain
very much at the heart of the magazine. One
of the earliest regular features we settled on
in this regard was the Project Showcase, which
was designed to highlight some of the most
impressive projects and their makers. Over the
last 18 months, the Project Showcase section
has become a firm favourite with readers,
SEE PAGE 66 FOR DETAILS
so it made sense for us to celebrate our 50th
issue with a countdown of 50 of the greatest
Raspberry Pi projects ever made.
Youve been voting in your thousands to help THIS MONTH:
us decide the running order for the business end
of our feature, and weve got some added glitz
and glamour courtesy of special guest judges Liz 14 PIXEL PERFECT
Theres a new front end for Raspbian and we think youll like it
and Eben Upton and Philip Colligan, CEO of the
Raspberry Pi Foundation, among others.
So grab some refreshments, find a comfy
16 THE CREAM OF THE CROP
Youve been voting in your thousands. Heres the result!
seat, and strap in for the countdown youve
all been waiting for! 48 RASPBERRY PI 101
Enjoy our 50th issue. New to Raspberry Pi? Our new regular guide is here to help

Russell Barnes 68 USB AND ETHERNET BOOT


Managing Editor Who needs SD cards when you can boot from the network?

FIND US ONLINE raspberrypi.org/magpi GET IN TOUCH magpi@raspberrypi.org

EDITORIAL DESIGN PUBLISHING


Managing Editor: Russell Barnes Critical Media: criticalmedia.co.uk For advertising & licensing:
russell@raspberrypi.org Head of Design: Dougal Matthews russell@raspberrypi.org +44 (0)7904 766523
Features Editor: Rob Zwetsloot Designers: Lee Allen, Mike Kay Publisher: Liz Upton
News Editor: Lucy Hattersley CEO: Eben Upton
Sub Editors: Laura Clay, Phil King, Lorna Lynch
DISTRIBUTION SUBSCRIPTIONS CONTRIBUTORS
Seymour Distribution Ltd Select Publisher Services Ltd Sam Aaron, Wes Archer, Alex Bate, Mike Cook,
2 East Poultry Ave PO Box 6337 Ioana Culic, Gareth Halfacree, Richard Hayler,
London Bournemouth PhilKing, Simon Long, Ben Nuttall, Dave Prochnow,
EC1A 9PT | +44 (0)207 429 4000 BH1 9EH | +44 (0)1202 586 848 Matt Richardson & Richard Smedley

This magazine is printed on paper sourced from The MagPi magazine is published by Raspberry Pi (Trading) Ltd., 30 Station Road, Cambridge, CB1 2JH. The publisher,
sustainable forests and the printer operates an editor and contributors accept no responsibility in respect of any omissions or errors relating to goods, products or services
environmental management system which has referred to or advertised in the magazine. Except where otherwise noted, content in this magazine is licensed under a
been assessed as conforming to ISO 14001. Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0). ISSN: 2051-9982.

raspberrypi.org/magpi October
April 2016 3
Contents
Column

Issue 50 October 2016 raspberrypi.org/magpi

TUTORIALS COVER FEATURE


> BUILD AN ACTION CAMERA 44
Who needs a Go Pro when you can build your own?

> RASPBERRY PI 101 ETCHER 48


Learn how to write SD cards using Etcher

> SONIC PI: PRACTICE 50


Practice makes perfect when youre putting on a show

> INTRO TO C PART 4 52


Take control of your funky flow

> SKELETON DANCE 54


This months Pi Bakery is a spooky bonetrousle

> CAR MONITOR PART 2 60


16
Complete your Wyliodrin car monitor

> ARCADE MACHINE PART 4 62


Start putting your cabinet together

IN THE NEWS 50 GREATEST PROJECTS


We celebrate 50 amazing Raspberry Pi projects for our 50th issue

TEN MILLION PIS!


PIXEL OFFICIAL
14 STARTER KIT
REVEALED
Raspberry Pi launches an
official starter kit

10
The new Raspbian interface,
Raspberry Pi celebrates the sale of ten as created by the Raspberry Pi
million Pi computers Foundation boffins

4 October 2016 raspberrypi.org/magpi


Review

3
OSMC
THE BIG FEATURE
68
PIDRIVE KITS
MUST BE WON!
94
USB AND
ETHERNET BOOTING
Use the new Raspberry Pi 3 features
to boot without an SD card

REGULARS
RASPBERRY PI
> NEWS 06
HEALTH TECH The biggest stories from the world of Raspberry Pi

> TECHNICAL FAQ 64


Answers to common problems

> BOOK REVIEWS 80


This months best reads for coders and hackers

> THE FINAL WORD 96


The importance of #10MillionPi, by Matt Richardson

How the Raspberry


Pi is helping heart
COMMUNITY
8
failure patients
and diagnosing
illnesses > THIS MONTH IN PI 82
What else happened this month in the world of Pi?

> MANCHESTER MAKEFEST 84


DARK CONTROL
We interview the people beind the robot controller Kickstarter
12
The MagPi heads to Manchester to meet some makers

> MEET A JAM ORGANISER 86


This month, James Mitchell from Berlin
> EVENTS 88
Weve got a new look for our listing of upcoming Jams

> YOUR LETTERS 92


We answer your letters about the magazine and Pi

REVIEWS
> SUGRU REBEL TECH KIT 76
> MICRO DOT PHAT 78
> IOT PHAT 79
raspberrypi.org/magpi October 2016 5
News FEATURE

THE OFFICIAL RASPBERRY PI


STARTER KIT
Introducing the very
first official starter kit
for the Raspberry Pi

he Raspberry Pi has been


IN THE BOX
T
Above Everything you need to get started with your Raspberry Pi
around for four and a half

ADVENTURES IN RASPBERRY PI years now, and yet its only


fairly recently that there have been
> A Raspberry Pi 3 Model B
> An 8GB NOOBS micro SD card
The Raspberry Pi Starter Kit comes with Carrie Anne official accessories for it such as the
case and the WiFi adapter. However, > An official case
Philbins Adventures in Raspberry Pi book to help
get you coding with your brand new Raspberry Pi. thats all changing now with the > A
 n official 2.5A multi-region
It comes with nine announcement of the Raspberry Pi power supply
projects that teach Starter Kit, a complete set of bits > An official 1m HDMI cable
you how to talk to and pieces to get your new computer
> O
 fficial optical mouse and
your Raspberry Pi, going without hunting down a USB
keyboard with high-quality
create games and mouse in your spare parts box.
scissor-switch action
stories with Scratch, The starter kit has been described
as unashamedly premium by Eben. > A copy of Adventures in
program turtles with
It includes official accessories where Raspberry Pi Foundation Edition
Python, and create a
Raspberry Pi jukebox. there are some, such as the case,
Its written for 11- to while everything thats not official is (magpi.cc/2cCT8pk) and RS
15-year-olds, but if the best version that could be found. Components (magpi.cc/2cCUalq).
youre a bigger kid The kit was announced alongside We can vouch for the quality of many
you might be able to the revelation that ten million of the items in the kit (we do especially
get something out Raspberry Pis had been sold love the official case), and it could
of it if youre starting you can read more about that on be the ultimate stocking stuffer for a
out as well. page10 and is available to buy code-inquisitive kid come Christmas
right now for 99 from Element14 in only a couple of months time.

6 October 2016 raspberrypi.org/magpi


News HEARTFELT TECHNOLOGY

HEARTFELT
TECHNOLOGY
HELPS HEART
FAILURE PATIENTS
The new Pi-powered medical device watches your feet to see whether
or not you need medical care
eart failure costs the NHS hospitalisation for people aged Powering the device are seven
H about two billion pounds
per year, reads the
over 65. What costs the NHS so
much money is that half of these
Raspberry Pis and seven cameras,
attached to heavily modified face
Heartfelt Technologies website. people will regularly require recognition software that now looks
Heartfelt is a startup company with emergency visits; however, many for feet. Any changes that meet a
a new piece of medical equipment of these (about 75%) could be certain set of parameters notifies
that hopes to reduce this cost avoided altogether if patients the relevant medical professionals
drastically, and its all powered would report the symptoms to allow for treatment with a cheap
by a Raspberry Pi. leading to a visit. pill that can sort out any issues
Apparently, one in five people The Heartfelt device watches before a hospital visit is needed.
will suffer from heart failure and patients feet as they get out of Its been through medical trials
its the most common cause of bed in the morning, to detectif already and has a CE mark, with
theres any change in swelling or first orders having been made in

CASE STUDY abnormal cardiovascular activity.


Its that simple, and the device
August of this year. Patients who
have been tested with it dont mind
Heres a report from a study made with the device could save the NHS a whole people seeing their feet, it seems,
in a Cambridge care home with a 75-year-old patient: lot of money. but they would prefer a nice wood
finish on the box to match their
She thought that the idea was good, and that it decor. Read more at hftech.org.
didnt appear too intrusive. However, she had two
concerns: the first one is that the system would take
X-rays and she has heard that this may be bad for her
health. [When] explained that this was like a video
camera taking images, she was perfectly happy with
that. The other concern was that the device had an
aluminium front to it, and she didnt like the look of it
at all, as it wouldnt look nice in her room. She would
prefer a wood panel or even a nice flower pattern.
She had no concerns about a camera being installed
to look at her feet, as she said that living in a care
home, carers come in and out of the room quite a
lot, so she doesnt feel that this is a privacy issue. If
this had helped her to stay home longer, she would
definitely have installed this, as she doesnt like A simple-looking device that sits
low on your wall to make sure you
being in a care home. dont need to go to the hospital

8 October 2016 raspberrypi.org/magpi


NUGENIUS News

NUGENIUS
RASPBERRY ESSENTIAL SPECS

PI-POWERED
Camera: 5 million pixels Sensor: 1/2.5 inch
Bit depth: 12/16-bit Greyscale: 0-65,536
Lens: 8-48mm f1.2 Viewing area: 2024cm
Display: 7 touchscreen Image capture: Yes

DNA IMAGING
GeneTools analysis: Yes Weight: 20kg
Dimensions: 753145cm
Dynamic range: 3.6/4.8 (extended)
Slim transilluminator 2024cm: Optional extra
Blue converter screen 2126cm: Optional extra
The worlds first DNA gel imager thats Visible light converter: Optional extra
powered by Raspberry Pi White epi: Optional extra
GeneDirector: Optional extra
he Heartfelt monitor an external computer, with the
T isnt the only medical
device powered by Pi this
system able to offer annotation
and editing features. Images
month: theres also the Syngene can easily be saved for a more
NuGenius, which promises to be detailed analysis on another
an affordable DNA image analyser computer, though.
that could help detect genes that To our delight, we found that
cause certain diseases. Heres the processor is so powerful
some of the important info: that it could easily run all the
Complete with a high- applications for imaging a
resolution 5MP camera, UV filter, DNA gel, says Dr Lindsey
and integrated Raspberry Pi Kirby, product manager at

The processor is so
powerful that it could easily
run all the applications
computer, the compact NuGenius Syngene, about why they
is the perfect choice for quick, used the Raspberry Pi.
accurate DNA imaging. Featuring We then did some hardware
a touchscreen controlled by image and software redesign
capture software, the system around the Raspberry Pi
is simple for both students and and produced the exciting
experienced scientists alike; they NuGenius imager, which
can set up and rapidly generate is simple enough for even
images of fluorescently labelled schoolchildren to use.
gel types commonly used to To find out more about
detect genetic defects, and the NuGenius, check
genes that cause diseases such out the Syngene site for
as cancer. detailed information:
The benefit of using a magpi.cc/2cBughI.
Raspberry Pi in the device is that Right The complete device, able to take
it doesnt need to connect to high-resolution images of DNA gel

raspberrypi.org/magpi October 2016 9


News FEATURE

10 MILLION
RASPBERRY PIS SOLD
Shortly after becoming the bestselling British computer of all time,
Raspberry Pi hits another incredible milestone

COMPUTER
n 8 September, Eben Raspberry Pi community, the
O Upton revealed in a press, and Raspberry Pi staff

SALES RECORDS
blog on the Raspberry convened at the Terrace Pavilion
Pi website that the Raspberry Pi for a wonderfully unique view of
had crossed the ten million sales London. There were a few projects
line. This amazing achievement on show as well, including a
Where does the Raspberry Pi rank in
comes only a few months after the display from The MagPi regulars
the history of personal computers? Raspberry Pi 3 launch, where it was theHayler-Goodalls.
revealed the Pi had become the As we gather to celebrate
bestselling British computer of all the ten millionth Raspberry
time after selling more than eight Pi, its worth taking a moment
BBC Micro
1.5 MILLION
million units. to remember how far and fast
A small celebration was held at weve come, stated Eben in a
the Palace of Westminster, more speech given at the event, and
commonly known as the Houses to consider what conclusions
of Parliament, at the invitation we can draw from the success of
ZX Spectrum of the Right Honourable Matthew Raspberry Pi as a product and an

5 MILLION Hancock MP. Matthew is the


Minister of State for Digital and
organisation. Because at heart,
the Raspberry Pi story is one of
Culture, and is responsible for collaboration: between individuals,
digital policy. Members of the within and between organisations,

Amstrad PCW Eben gave a

8 MILLION
speech detailing
all the amazing
things that have
happened over
the last four and
a half years

Raspberry Pi
10 MILLION

Commodore 64
17 MILLION
10 October 2016 raspberrypi.org/magpi
10 MILLION RASPBERRY PIS SOLD News

and within and between clusters. success, and certainly no the changes in the computer Above The MagPi
contributor Ozzy
When we started Raspberry expectation that four years later science curriculum, and finished Hayler-Goodall was
Pi, we had an almost comically we would be manufacturing the off by saying how the initial goal on hand to show off
some Pi projects
modest ambition: simply to vast majority of our products had been achieved: more students
reverse the decline in the in the UK, and exporting over are applying to study computer Above left
Celebrating ten
number of people applying to 80% of our production to the US, science at university. million Raspberry
study computer science at the continental Europe, and beyond. The Raspberry Pis mission Pis with a splendid
view of London
University of Cambridge At the Eben went on to detail some is ongoing, and this is only the
time, there was no expectation of the other extraordinary beginning. Lets see what can be
that adults would use Raspberry achievements that have happened accomplished over the next ten
Pi, no expectation of commercial thanks to Raspberry Pi, including million sales.

raspberrypi.org/magpi October 2016 11


News FEATURE

DARK CONTROL
FOR RASPBERRY PI The Dark Water Foundations latest Raspberry Pi add-on boards promise
to make a splash in the field of remotely operated vehicles
ere trying to encourage out their LEGO-based remotely new, Barry and his team needed
W people to do underwater
robotics rather than on
operated vehicles (ROVs). Its a
guerrilla attempt to get people to
something which didnt exist
elsewhere: six-motor capability.
land, Barry Getty explained of do underwater robotics instead of For ground and flying robots,
the not-for-profit Dark Water surfacerobotics. those extra motors maybe
Foundation, during a workshop A year later, Barrys passion arent that big a deal, but for
at the Liverpool MakeFest event for underwater robotics hasnt underwater robots six motors adds
back in 2015. He was standing dimmed, but the technology so much more, Barry enthuses.
in front of a filled fish tank that behind Dark Water has shifted. Six motors on an ROV means
attendees would be using to test Where the original boards were you can have four motors, full
Arduino-compatible, a desire for vectored thrust for horizontal
increased capabilities called for manoeuvrability, and two vertical
boards with more power. motors for depth and tilt. For an
underwater bottom-crawler, you
Switching to the Pi Zero can get full four-wheel drive and
We had been looking for an extra two motors to control
something that was small enough stabilisation and lift.
to fit inside a waterproof pressure For DC motors there arent
container and be sent underwater. any other boards available,
The larger the board, the wider Pi Zero-sized or not, that are
the container required, but when capable of running that many
you factor in potential pressures motors with a single board. For
at depth, you also needed thicker brushless motors, we looked at

WHY KICKSTARTER?
walls to handle that and keep the the annoyances we found with
water out, Barry explains of his other boards and autopilots and
teams progression in the year tried to get rid of them. The main
We originally werent going to make any more since our last interview. The niggle we hated was having to
boards than we needed ourselves, Barry reveals. OpenROV team were using the remove or cut the power cable
The positive feedback and comments made us BeagleBone Black, but we wanted from the ESC [electronic speed
think there was an interest in the boards outside to make a much smaller ROV or control] connectors on all but
of our own plans; so I took some time to tidy up even a container that could be one of the ESCs.
the boards to make them a bit more presentable, fitted to a slightly larger version
and look at what was needed to get them ready of our LEGO ROV body. Dark Control is born
to sell and make them easier to manufacture The small size of the Pi Zero With nothing available on the
and assemble. removed a lot of these issues, market, Barry and his team turned
At this point I thought that Kickstarter wasnt for he continues. We could now to their experience in circuit
us. We needed quite a large initial order and the fit an extremely capable Linux design and came up with two
average Raspberry Pi-based Kickstarter campaign computer in a very small and boards that proved a perfect fit.
was a lot lower than our target would be. I listened cheap container. We just needed The Dark Control 640 works with
to a lot of people and decided to take a chance: motor drivers that were the same DC motors, and the Dark Control
we spent two weeks getting the campaign ready, size to fit on it. Escape with brushless motors.
took a holiday, and then released. Although motor driver boards Still, though, the teams work
for the Raspberry Pi are nothing wasnt done.

12 October 2016 raspberrypi.org/magpi


DARK CONTROL News

The Dark Control


boards are
compatible with
DC or brushless
motors and work
on any 40-pin
model of Raspberry
Pi, including the
compact Pi Zero

Then we looked at controlling extension board is now complete,


robots, Barry recalls. Most and its possible to add sensors
Raspberry Pi robots are controlled ranging from barometers suitable
via WiFi or Bluetooth; some even for aircraft use to air quality
use infrared remote controls. All of systems for data gathering.
these have range issues, especially Its a mixture found nowhere
when used outside. No one, it else, and one that has captured
seemed, had thought of a board plenty of attention. The Dark
this cheap allowing a radio control Control crowdfunding campaign
receiver to be plugged into it to closed with 145 percent of its
take advantage of the extended modest 4,000 goal raised, and

The Dark Control crowdfunding Above Although built with underwater exploration in mind, the
Dark Control boards are equally at home on land or in the air

campaign closed with 145% of


GETTING STARTED
its modest 4,000 goal raised
For a beginner Id recommend putting a board
range. It turned out we could deliveries of the boards have on a Raspberry Pi 3, Barry explains of his Dark
implement CPPM [Combined Pulse already begun. Control add-ons. It has more USB ports for WiFi, a
Position Modulation] reasonably For Barry, though, the keyboard and so on to be added, so they can get
easily and with very little extra excitement is only building. programming a lot easier. Once they have working
work / components so we did. If we can encourage people to code, then put it on a Pi Zero to reduce the size
Then we thought, We still have send their robots off into the world of the robot. The less space taken up by the
some space on here lets add to explore, and to publish the data processor, the bigger the motors you can fit!
things! So we added extra PWM they find, then the world will be a Our aim is to encourage people to think outside
[pulse-width modulation] servo better place. If we can provide tools of building hobby robots. If you can build a robot
headers to each board. that are small and capable enough capable of driving around your living room, then
Barrys team had added yet more for people to fit into underwater you can build something with an air quality sensor
capabilities to the design by the robots, then were heading in the that can drive around a field. Think outside of your
close of the Kickstarter campaign. right direction. living room, and try to think of how your skills can
A nine degrees of freedom (9DOF) More information on the project help your community.
inertial measurement unit (IMU) can be found at darkwater.io.

raspberrypi.org/magpi October 2016 13


News FEATURE

INTRODUCING
PIXEL
The Raspberry Pi Foundation releases a stunning new
desktop fizzing with features
aspbian is getting its web browser. Other new apps I sat down and played with the
R biggest update ever
this month, thanks to a
include RealVNCs Viewer and
Server, which allow you to control
Raspbian desktop for half an hour.
He asked me do you think you can
dazzling new desktop environment Raspberry Pi devices over a make it better?
called PIXEL. network, plus the recently released That conversation led to two
Raspbian with PIXEL (which Sense HAT Emulator. years of hard work building a
stands for Pi Improved Xwindow But the real star isnt the new new interface. Youll notice the
Environment, Lightweight) is apps: its the sensational new look. difference as soon as you boot
a huge software update to the up your Raspberry Pi. Instead of
desktop environment. It introduces Baking a better Pi viewing text scrolling up the screen,
a crisp new interface, and is Simon Long, UX engineer at Raspbian with PIXEL starts with a
brimming with new programs Raspberry Pi, told us the story boot splash image.
andfeatures. behind Raspbian with PIXEL: It The splash screen is followed
Below Chromium The biggest newcomer is was just over two years ago when I by a stunning photograph of an
is now the default
web browser in
Chromium Browser, which walked into Pi Towers for the first Icelandic road on your desktop.
Raspbian with PIXEL replaces Epiphany as the default time. On the first day, Eben and We are very fortunate in

UPDATING TO RASPBIAN WITH PIXEL


The PIXEL desktop ships with the new Raspbian image file. Raspbian
withPIXEL is available at the Raspberry Pi downloads page:
raspberrypi.org/downloads. Its also possible to update a current
RaspbianJessie installation using these commands:

sudo apt-get update


sudo apt-get dist-upgrade
sudo apt-get install -y rpi-chromium-mods
sudo apt-get install -y python-sense-emu python3-sense-emu
python-sense-emu-doc

Please note that if you already use xrdp to remotely access your Raspberry
Pi, this conflicts with the RealVNC server, so you shouldnt install both at
once. If you dont use xrdp and would like to use the RealVNC remote access
packages, enter this line:

sudo apt-get install -y realvnc-vnc-server realvnc-vnc-viewer

Reboot to use Raspbian with PIXEL.


Above Raspbian with PIXEL introduces a whole
new interface with a much more professional look

14 October 2016 raspberrypi.org/magpi


INTRODUCING PIXEL News
Far left PIXEL
comes packed
with beautiful
photography
options for the
desktop wallpaper

Left Code designed


for the Sense
HAT can now be
tested using a
builtinemulator

that Greg Annandale, one of Sam Alder and Alex Carter, the PIXEL perfect
the Foundations developers, guys responsible for all the cartoons Closer inspection of Raspbian with
is also a very talented (and very and graphics you see on our website, PIXEL reveals further features.
well-travelled) photographer, have been sweating blood over these In the past, if your Raspberry Pi
and he has kindly allowed us for the last few months, remarks was working particularly hard, you
to use some of his work as Simon, with Eben providing a might have noticed yellow and red
desktop pictures for PIXEL, watchful eye to make sure every squares appearing in the top-right
explains Simon. pixel was exactly the right colour. corner of the screen, says Simon.
The old window design looked a These have been replaced with
The making of an icon bit dated, compared to what Apple new symbols that make it a bit
The visual refresh extends far and Microsoft are shipping, says more obvious: a lightning bolt for
beyond the desktop imagery. Simon. [PIXEL] windows now undervoltage and a thermometer
The icon set has been completely have a subtle curve on the corners, for overtemperature.
redesigned with a much friendlier a cleaner title bar with new Close, You can also disable WiFi and
feel, in keeping with the Raspberry Minimise, and Maximise icons, and Bluetooth from the menu bar,
Pi website. a much thinner frame. a frequently requested feature.

raspberrypi.org/magpi September 2016 15


Feature

16 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

MEET
THE JUDGES

EBEN UPTON
CEO, Raspberry Pi Trading

Software Projects judge

Celebrate
50 issues PHILIP COLLIGAN
of The MagPi
CEO, Raspberry Pi Foundation

Projects for Good judge

with incredible
LIZ UPTON
projects Director of Communications,
Raspberry Pi Trading

that change Young Makers judge

what you think


MICHAEL HORNE
is possible Web developer

Robot Projects judge

he Raspberry Pi has been used to build


T incredible things, from real-life magic
mirrors to hybrid electric racing cars.
Not a day goes by without an amazing new project.
While theres still a core mission of education, TIM RICHARDSON
the Raspberry Pi is so customisable that makers Performance architect
immediately started using it to create the projects
of their wildest dreams. And they never stopped. Robot Projects judge
It wasnt easy. But working together, we
collected the 50 most inspirational projects
in a celebration of everything Raspberry Pi.
We could have easily added another 50 jaw- And not forgetting
droppers, but with the communitys help to
choose the top 20, we have an excellent mix THE RASPBERRY PI
of fan favourites and professional picks. COMMUNITY (YOU!)
So without further ado, heres the 50 Greatest
Raspberry Pi Projects ever made Top 20 judges

raspberrypi.org/magpi October 2016 17


Feature

FLAPPY 30
CREATED BY: Bernie Sumption
URL: magpi.cc/1VKui85

MCFLAPFACE
FAST FACT:
This tweeting cat flap has over 840 followers
on Twitter

All cats think theyre special, to social media to rant about the
but only Daphne has her very inadequate service provided by
own Twitter-enabled cat flap that her staff (technology journalist
heralds her arrival online. The Kate Bevan), explains Bernie
Flappy McFlapface project snaps on his blog magpi.cc/1VKui85.
a photo and tweets it, along with This activity is cathartic
a cute randomised phrase. and highly recommended for
Built by Bernie Sumption, any household pet. You can
this cat flap is a thing of follow Flappy McFlapface
beauty. Daphne often takes on @DaphneFlap.

MAKER Daphne often takes to social media to rant about


28
SAYS
CREATED BY: Frederick Vandenbosch
the inadequate service provided by her staff URL: magpi.cc/2cJW7Qk
FAST FACT:
The build was part of the Sci-Fi

29
CREATED BY: Cory Kennedy Your Pi competition launched by
Family man and cyber-defence specialist
Element14 and Raspberry Pi
URL: magpi.cc/2cJUYbr
FAST FACT:
It only took about a week to build

PWNGLOVE
Nintendos Power Glove was an
infamous NES peripheral that has
been the butt of many jokes, and
the centre of a lot of nostalgia.
to be the kid from the Now youre
playing with power ad.
There are four original bend
sensors (thumb, index, middle,
PI DESK
Nobody wants a boring desk, but one hobbyist,
The Power Glove didnt live and ring), which connect to an Frederick Vandenbosch, went and built this
up to its original promise, but analogue multiplexer living futuristic table complete with a touch surface,
Cory Kennedy decided that the in the palm housing, which speakers, and a motorised display that rises out
Raspberry Pi could change all that. sends that data back to the of the surface. The PiDesk is one of the cleverest
I wanted to do something Arduino. This is then piped back projects weve come across.
different, says Cory. I wanted to the Raspberry Pi over Bluetooth. The build was part of a design challenge,
says Frederick. The Sci-Fi Your Pi competition
was launched by the Raspberry Pi Foundation
and Element14 to inspire inventors to build
smarter homes. PiDesk is an attempt at making a
space-saving, futuristic-looking desk he explains.
It can change from a regular desk to a computer
workstation and back at the touch of a finger.

MAKER For the projects futuristic


SAYS accents, I was inspired by
the Tron movies, on which I based the
light patterns of the desk

18 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

DIGITAL 27
CREATED BY: Brian Corteil
URL: magpi.cc/2cotnva PI IN NUMBERS
ZOETROPE FAST FACT:
Since his project uses
Before the invention of cinema, OLED displays with the
people used animation devices Raspberry Pi, its actually
called zoetropes to produce the possible to update the
illusion of movement. frames in real-time, so you
The Digital Zoetrope replaces could watch an entire film
the photos on the inside with if you wanted
12 OLED displays. Despite
incorporating a wealth of Zoetrope is moved by hand.
technology, Brians Digital Like the original designs, you spin
the device and look through the
slats to see movement in the still
images as they rotate.

MAKER I was inspired


SAYS by the work
of Eadweard Muybridge,
an early pioneer of high-
speed photography

26
CREATED BY:
Cyril Chapellier

SOUND
& Eric Redon
URL: m
agpi.cc/2d1CsaT

FIGHTER
FAST FACT:
The project was pitched
for the reopening of the
Maison de la Radio, a
Cyril Chapellier and Eric Redon
historic building in Paris
brought a new dimension to
the phrase duelling pianos
with this installation. custom analogue piezo triggers,
Sound Fighter turns two pianos a Raspberry Pi B+, and Arduino
into controllers for a game of Street Unos, and created a special Python 3
Fighter Alpha 3. We transformed firmware to map a classical playing
two classical upright pianos into style onto the Street Fighter Alpha 3
PlayStation 2 controllers using gameplay, explain the French duo. monthly readers of The MagPi

1 MAGPI
obtained every 20 seconds

MagPi
pages &
counting

raspberrypi.org/magpi October 2016 19


Feature

ROBOT
PROJECTS
The Raspberry Pi has helped revolutionise hobby robotics
here are some of the best Pi robots
f theres one thing that weve learnt a Pi Wars-winning robot. Whether youre
I from running CamJam and Pi Wars, into wheeled buggies, walkers, quadcopters
JUDGES

its that everyone loves a Raspberry or ROVs, robots are everywhere and the trend
Pi-controlled robot. Our first big Jam featured looks set to continue. In this section, we
a talk from Matthew Timmons-Brown on choose our top five robots, including one from
robotics in education and, at the last Jam, Pi Wars! So, read on and let us know if you
Brian Corteil talked us through how to build think weve made the right decisions.

CREATED BY: PiBorg


URL: magpi.cc/2ciYDg1
Michael Horne and

DOODLEBORG
Tim Richardson
CamJam and
Pi Wars organisers Billed as the Raspberry Pi tank, this beast
of a machine is one of the biggest Raspberry
Michael (right) and Tim (left) A powerful machine
Pi-powered vehicles around. It may be low requires powerful innards
live with their respective, long-
on horsepower, but its high on torque, and
suffering wives and children in
the trailer hitch allows it to tow a caravan
Potton, Bedfordshire. Together,
using a PlayStation 3 pad to control it. Its JUDGES The monster truck of
they organise the Cambridge SAY
built using PiBorgs motor controllers, and robots: with a 12V battery,
Raspberry Jam and Pi Wars, and
created the CamJam EduKits. uses the great metallic design youd expect six wheels, and three horsepower,
from a PiBorg build. its strong enough to carry a person!

CREATED BY: Si digital


SID THE URL: magpi.cc/2cm4ocR

OFFICE ROBOT
We kind of love the idea of would be. Apparently, it
Sid: an internet-controlled was so popular at one point
robot whirring away in that people were waiting
your own office as people four hours to play with Sid!
play games with it. It 4chan also tried to break it,
would probably get a little but were unsuccessful due
annoying after a while, but to some clever building and
what a fun few weeks that coding work.

Sid was operated


JUDGES A robot arm with a gamers attitude,
using a very simple SAY you can control Sid online and drop
control method
balls into holes to score points!

20 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

CREATED BY: Kris Temmerman


URL: magpi.cc/2cqRCXq
PI WARS 3!
Have a Raspberry Pi robot that you want to show off in a
series of excellent challenges? Feel like you want to build

BALANCEBOT one after seeing these amazing robo-projects? Then


you may be interested in Pi Wars 3, which takes place in
April 2017. Its organised by Michael and Tim, who judged
We spoke to Kris about The eyes show the robots the robots on this
his BalanceBot in issue mood based on the page, and you can
expressions it sees
42 of the magazine. find out more details
The BalanceBots on the Pi Wars
balancing act is very website: piwars.org
impressive due to how
tricky it is. Riding on
two wheels isnt its
only trick, though: it
has facial recognition CREATED BY: Tom Oinn
software attached to a Pi URL: twitter.com/approx_eng
camera, so it can react
to the people around
it using slightly odd
cut-outs of Kriss facial
features. Its a work in
TRIANGULA
progress, but what I wanted to build something that wasnt a
hes managed to standard two-wheel or track differential drive,
do so far has really Tom told us when we caught up with him. His
impressed us! triangle-shaped robot with a holonomic drive (it
can move in any direction even while rotating)
JUDGES Balancing on two wheels and with a Qt did very well at Pi Wars 2015, with Tom boasting
SAY front end, Kris Temmermans robot uses that it was the most agile robot there. No
C code for real-time control wonder it won Pi Noon. You can read the coding
documentation, which Tom is quite proud of,
here: magpi.cc/2cJ7X9S.

CREATED BY: Dexter Industries JUDGES Tom Oinns laser-cut, hand-


URL: magpi.cc/2crkOxu SAY tooled triangular robot with
lots of blinkies on board impressed at last
years Pi Wars, winning Pi Noon!
BRICKPI BOOKREADER 2
The original Bookreader was able
The magic is in
to read books on Kindle, turning the wheel that
the pages with a button. While turns the page
certainly impressive, it was
quickly outclassed by the second
Bookreader that could actually
read and turn the pages of a
physical book. BrickPi is a way
for LEGO Mindstorms to
hook up to the Raspberry
Pi, and with this mish-mash of
LEGO and Pi tech, the robot was
able to best its predecessor.

JUDGES Using a mixture of LEGO and OCR with their


SAY BrickPi interface board, Dexter Industries
have found a way for your Pi to read a real book!

raspberrypi.org/magpi October 2016 21


Feature

25
CREATED BY: Joseph Hazelwood
URL: magpi.cc/2d8Qcj0
FAST FACT:
Its on display in an old cigar warehouse
#OZWALL
The #OZWall video installation, the panels. Each TV is outfitted with
that used to house 100,000 cigars brainchild of Joseph Hazelwood, sits its own Raspberry Pi 2. We used the
in the Escaparate, the focal point code from the CCFE Pi Wall project
of Nashville Tennessees centre for (magpi.cc/2cmigxM) and tailored
world-class contemporary art, OZ it to our needs.
Arts (ozartsnashville.org). In 2016, the #OZwall was
We like to think of this upgraded for interactivity. The
installation as a canvas for other first iteration of this functionality
artists to build upon, Joseph was #OZPodButtons for OZ Arts
tells us, and thats the beauty of Fest, says Joseph. At this event,
open source and platforms like the a visitor was able to push buttons
Raspberry Pi. installed on many art pieces in the
Joseph started by retrofitting room to switch video content and
six vintage TVs with modern LCD get corresponding information.

MAKER A visitor to OZ will walk into the Escaparate


SAYS and be drawn into an interactive
multimedia experience

24
CREATED BY: Jack Chalkley
Head creative technologist at Knit
CREATED BY: Dave Sharples
URL: davesharpl.es 23
#HIUT
URL: weareknit.co.uk
FAST FACT:
FAST FACT: The Joytone was on show at the Toronto

MUSIC
You can interact with HiutMusic International Film Festival and had
on Twitter @HiutMusic around 16,000 visitors

JOYTONE
The #HiutMusic jukebox is a rather beautiful
Twitter-powered music player that takes pride
of place in the Hiut Denim Factory on the west
coast of Wales, where the music is loud and
the coffee is strong. Designed and crafted by
It was created by Knit, a creative technology engineering expert Dave
agency that approached Hiut Denim with an idea Sharples, the Joytone is a unique
to help customers connect with the boutique musical instrument played using
jeans company. an array of mini-joysticks.
Its powered by an internet-connected Ive always wanted to be able
Raspberry Pi, which uses the Spotify and to play a musical instrument,
Twitter APIs in a rather novel way. It plugs says Dave, and a couple years
into the existing sound system on the factory ago I took a music theory class
floor and fans can request a track by posting a to see if that could help me
tweet that includes #HiutMusic, the artist, and learn piano.
track title, says Jack. The tweet is detected and According to Dave, Joytone is a
the song is queued up and played. unique new musical instrument
that features a hexagonal grid
of 72 joysticks. The Joytones white and black keys of a piano.
MAKER
SAYS hexagonal grid exposes musical Each joystick plays one note and the
We patterns that are normally motion of the joystick affects the
wanted to facilitate obscured by the quirks of common volume and character of the note,
a dialogue between acoustic-style interfaces, like the he explains.
Hiut and their
fans through the MAKER I became fascinated with the patterns
emotion of music SAYS associated with musical structures and
realised how beautifully simple music can be

22 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

PIP-BOY 22
TEAM PICKS
CREATED BY: Jesse Roe
URL: magpi.cc/2d8QKVW

3000A
The project was an attempt to make
FAST FACT:
Jesse completed the project
between October and
Christmas 2014
Lucy Hattersley
News Editor
a fully functional Pip-Boy 3000A.
Not something to stick a phone in, I worked on this probably about FLAPPY MCFLAPFACE
but an actual working device, Jesse 70 hours total, with a lot of that I love Flappy McFlapface,
tells us, referencing the official Pip- being just research, Jesse explains the tweeting cat flap.
Boy which will require a smartphone. about his build process. There was Partly because it involves
Having never found a perfect a lot of stuff out there on making cats and the internet
use for his Raspberry Pi, Jesse a Pip-Boy, where to get the cast (always a winner). But also because its an IoT project
decided to use it for this project he from, materials, etc. The main piece in disguise. On the surface, youre just making fun of
was making for a friend. Using a to get was the Pip-Boy cast itself, your cat, but look deeper and there is lots of Python
3D-printed case that he modified which I ordered from Nakamura code and scripting being used to hook a door up to
himself, the build wasnt simple. Shop on Shapeways. the internet, and to Twitter. The creative language
generator is the icing on the cake. Also, it just works!
Follow @daphneflap on Twitter and shes still
tweeting her mugshot daily.

Phil King
Sub Editor

SEEMORE
Virginia Techs huge kinetic-sculpture-cum-
computing-cluster is a spectacular sight. Not only is
it a mesmerising work of art as its articulating arms
move in cascading patterns, but its also a brilliant
visualisation of the concept of parallel computing. I
particularly like the transparency of the design, with

PI IN
its exposed wiring, enabling everyone to see how it

21
CREATED BY: works. Comprising 256 Raspberry Pis and countless
Dave Akerman
custom parts, its not something you could replicate

THE SKY
URL: d
aveakerman.com
at home, but its inspiring nonetheless.
FAST FACT:
The eventual aim is to
fly a series of balloons Dave is a high-altitude ballooning
across Europe, with data enthusiast who has been tethering
passing from balloon Raspberry Pi boards to helium
toballoon balloons and sending them to the
edge of space since 2012. His hobby
and choice of computer have been
attracting much attention since,
leading to a rather hectic life for the
software programmer, and helping
to show further evidence of the
adaptability of the Raspberry Pi.
The Raspberry Pi had two
big effects [on my high altitude
ballooning]: the addition of
live images and all of the media
attention, Dave tell us. I
expected the former, but not the
latter. Its all been good, though.

raspberrypi.org/magpi October 2016 23


Feature

SOFTWARE
PROJECTS
Its not just about physical builds Raspberry Pi would
be nothing without its amazing software creations
ts fair to say that we went
I into Raspberry Pi with CREATED BY: RetroPie team
JUDGE

some unrealistic ideas URL: retropie.org.uk


about what we could reasonably

RETROPIE
expect the open-source software
community to do for us. Its
not enough to put a piece of
hardware out there with bare-
bones software support and expect RetroPie has the ability to realise many peoples
volunteers to fix everything for dreams of owning their own custom arcade
you, for free: many core software cabinet, bringing simple-to-use arcade and
Eben Upton tasks need to be handled by an console emulation to the Raspberry Pi with
inhouse team. very little fuss. It even works on the Pi Zero,
CEO of Raspberry Pi On the other hand, weve been which enabled us to put a Zero into a NES and
(Trading)
consistently amazed by the wide SNES controller for the magazine, while still
Eben is a co-founder of the variety of third-party software being powerful enough to drive a whole arcade
Raspberry Pi Foundation and that people have developed on top cabinet. Just remember the law about what
serves as CEO of Raspberry of this core, without which the ROMs you can use, though.
Pi (Trading), the Foundations Raspberry Pi ecosystem would be a
engineering subsidiary. much less exciting place. Its hard
He likes cats, for some reason. to pick favourites, but here are a
few standout applications.

Play Minecraft and


CREATED BY: Mojang learn how to code
URL: magpi.cc/2cu8nkC using it on Raspberry Pi

MINECRAFT PI
Minecraft Pi was originally
developed to run on the first- can modify it with Python and even
generation Raspberry Pis: it was a hack it with other programming
little stuttery on them, but since the languages. Using Python as a
Raspberry Pi 2 its been great to use. bridge to the GPIO pins, you can
Its not just a game, though: thanks even have Minecraft interact with
to the API being open to use, you the real world
EBEN Who doesnt like a trip down
SAYS memory lane? With an
EBEN An early addition to the Raspberry Pi platform enormous list of supported platforms, you
SAYS back at the tail end of 2012, Minecraft Pi was can waste (I prefer to say invest) hours
developed for us as a favour by Mojang. Its a fantastic reliving your youth. With a Raspberry Pi 3,
educational tool: if only we could persuade Microsoft even many N64 games run smoothly
to produce an updated version!

24 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

CREATED BY: CREATED BY: Ben Croston


Mike Thompson & Peter Green URL: magpi.cc/2cEMDCv
URL: raspbian.org

RASPBIAN
Raspbian is ubiquitous with Raspberry Pi. As the
RPI.GPIO
Quite a miraculous Python module, veterans alike who just want to
premier operating system for the Pi, youll rarely RPi.GPIO opened up the GPIO light an LED, or even control an
find a project that uses anything else, and all the pins to everyone, with the ability entire robot. The great thing is that
tutorials and learning resources on the Raspberry to pretty much directly control it works across every version of the
Pi website are built around it. The community what each programmable pin Raspberry Pi, as long as you take
have really taken to it and tons of bespoke can do. Its become a staple of into account the different number
software has been created or ported to Raspbian many tutorials for beginners and of pins on the first models.
to allow for a fantastic user experience. PIXEL may
now be here, but its still Raspbian at the core.

+ = Raspbian

EBEN I remember the happiness in the office when this


SAYS first appeared. Use it via GPIO Zero, or import it
directly: Ben Crostons RPi.GPIO remains the canonical way
to access the interfacing features of the Raspberry Pi

CREATED BY: Ben Nuttall


Raspbian is independent from the Raspberry Pi URL: magpi.cc/2cqUEhp
Foundation, but they still do plenty of work on it

EBEN
SAYS
Mike Thompson and
Peter Greens painstaking
rebuild of hard-float ARMv7 Debian
GPIO ZERO
for the ARMv6 processor in the original RPi.GPIO is amazing, but for newcomers
Raspberry Pi: where would we be without its not the easiest to use, which is
it? Still the backbone of our OS strategy where Ben Nuttall and Dave Jones came
in. Enthusiastic to get people setting
up and supporting Jams around the

GET INTO
country/world, Bens just as passionate
about making the first steps into coding

PROGRAMMING
just that little bit easier. Together
theyve managed that with this
excellent library that makes common
Programming is a learning process that requires
operations a doddle to write in Python,
steps to understand different concepts. Just one
and which is just about celebrating its
tutorial wont be able to do the job, which is why
first anniversary this issue.
we have entire books on the subject. Of particular
interest for this category is our GPIO Zero Essentials EBEN Another entry in the Foo Zero Olympics,
book, which teaches you how to use the library on SAYS after Pygame Zero and before Raspberry Pi
Python. There are also books on hacking Minecraft Pi
and creating games in Python and Scratch. You can
Zero. Ben Nuttalls done a cracking job of stripping the
find them all here: magpi.cc/Back-issues boilerplate out of Python physical computing

raspberrypi.org/magpi October 2016 25


Feature

4-BOT
20
CREATED BY: David Pride
URL: magpi.cc/1XrC3zU
FAST FACT:
With capturing and processing the image,
calculating the next move, and delivering
the counter, the total time per turn is around
25 seconds
Prepare to be amazed by the enough processing power. The
4-Bot, created by David Pride. trade-off is in the depth of search
This robot plays Connect Four by and therefore the time taken
taking a picture of the game board, to calculate each move If you
processing the colours, and then increase the search depth, this
giving the program the state of the massively increases the calculation
board to calculate the next move. time. So I selected a middle ground
David reveals, There are a huge where the bot plays a pretty mean
but finite number of solutions, game, but the total time per move
and they can all be calculated with is still acceptable.

MAKER In terms of how well it plays, Connect 4


SAYS is a perfect game in mathematical terms

18
CREATED BY: Jonathan Moscardini
and McMaster University students

19
CREATED BY: Scott Garner URL: magpi.cc/2d3mo8x
URL: magpi.cc/2d3lhpB
FAST FACT:
FAST FACT: The students dont just build the car;
No electrical components are visible they have to personally race it, too
in the project

MCMASTER
BEETBOX
One of the craziest
FORMULA HYBRID
Engineering students from McMaster University
enter the Formula Hybrid and EcoCAR 3
competition every year.
Their hybrid race car doesnt lack muscle: it
projects is this work of packs a 15kW in-hub motor for the front wheels,
wonder. The BeetBox is and a 250cc motorcycle engine for the rear wheels.
a musical instrument But their secret weapon is the Raspberry Pi
that allows drummers inside the car, which
to play drum beats by acts as a dashboard
tapping on beetroots. computer and team
The project mounts radio. It gathers
six large beets and an telemetry data
audio amplifier in a and sends it to the
wooden enclosure, and team at trackside,
a Raspberry Pi armed enabling them to
with a capacitive analyse the cars
touch sensor is used to the technology is invisible,both performance.
control touch and response. in the sense that the interaction
Scott says, Im particularly is extremely simple and in the MAKER Essentially its both the
SAYS dashboard computer and
interested in creating complex literal sense that no electronic
technical interactions in which components can be seen. our team radio. It also gives us a few
new features along the way, simply
MAKER The BeetBox is primarily an exploration because its so powerful
SAYS of perspective and expectations

26 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

17
TEAM PICKS
CREATED BY: Martin Mander
URL: magpi.cc/2d3pedC
FAST FACT:
The project took six months to complete
(we think it was worth it) Rob Zwetsloot
Features Editor

RASPBERRY PI VCR PIGRRL


Ive always been a big fan of miniaturised Pi projects
If youre not old enough to one around was quite a novelty that allow you to play games, retro or otherwise.
know what a VCR was, ask your back in the 1980s. Weve had mini NESes, Pi Zeros in controllers (one
parents. You did have to hook it I picked [this] up for spare of those thanks to me), and even lots of mini-arcade
up to a TV, but being able to lug or repair on eBay for 6, cabinets. What I love about the PiGRRL and all its
explains Martin. I stripped out different versions is the portability and the fantastic
all of the internal circuits and custom case to go with it, as well as not having to
replaced them with modern take a bag of games with you everywhere.
tech, with the Raspberry Pi
running the show, a powered
USB hub housed in a pop-out
VHS tape, an Arduino-powered
clock, and a 15 HD TV panel
integrated into the back
of the unit.

16
CREATED BY:
Aether & Hemera
URL: magpi.cc/2d3mGfC

VOYAGE
FAST FACT:
Each boat is 60cm long, 27cm
wide, and 21cm high. The total
installation covers over 1,000
Russell Barnes
Voyage is an impressive Managing Editor
square metres
art installation. Theres a
Raspberry Pi acting as a DHCP PORTABLE PI VCR
and web server as part of the I had the pleasure of meeting Martin Mander
control mechanism. We find at a Cambridge Raspberry Jam, just when I was
ourselves surprisingly touched developing the Project Showcase section for the
at the blending of Raspberry magazine. I was looking for beautiful, well-crafted
Pi and something so beautiful. projects and I was immediately smitten by this retro
Conceived by Newcastle-based chic design; I started the write-up on the spot.
studio Aether & Hemera, the art
project is made from coloured
paper boats on water. People
can engage with the lights
from their mobile phone.
The aim of the artwork is to
allow viewers to travel and sail
with absolute freedom to all the
places they care to imagine,
says the studios website.

MAKER Voyage comes


SAYS from the Latin
viaticum, which means
provision for travelling

raspberrypi.org/magpi October 2016 27


Feature

PROJECTS
YOUNG
FROM 
MAKERS
The Raspberry Pi was created to get kids interested
in coding heres the best of what theyre doing
rom the very start, one of the best graduated this year, and now works on the
F things about working at Pi Towers engineering team that designs your Pi. Every
JUDGE

has been meeting some of the year, theres a new batch of imaginative,
extraordinary kids who make things with the smart, engaging young people who have
Raspberry Pi. We met one of the very first, discovered the Raspberry Pi for the first time,
Liam Fraser, when he was making Raspberry and every year they amaze us with the scope
Pi tutorials as a 17-year-old back in 2012: he and professionalism of what theyre doing.

CREATED BY: Emma


URL: magpi.cc/2ctkH4q
Liz Upton

VERMONT
Director of Communications,
Raspberry Pi

POSTER
Liz is one of the founders of
the Raspberry Pi Foundation.
Shes been running the comms
department press, website,
In the UK we dont tend to get these kind
publications, social media, and
of big school projects that are so popular
design since 2011.
in the USA, and in this case were quite
LIZ Emma was in the second
jealous. At this particular American school,
SAYS grade when she made
second-graders put together a state board,
and Emma went the extra mile making this, and to demonstrate that shed
hers. It included lights and sounds and was done it all herself, her dad filmed the
designed in a way that Emma could make it whole build process, from soldering
herself with only minimal adult supervision. iron to final working model

PI A LA CODE presented to her. When she found out about


the Raspberry Pi, she decided to create
When trying to create education materials a way of teaching computing to kids in
for kids and teens, its important to hear rural India with her own, more interesting
what they have to say about the materials. curriculum and its been a great success.
Sonia was first exposed to computer science
while at middle school in Bangalore and LIZ Sonia Uppal has made
SAYS more of an impact with
found it boring, yet when she returned
CREATED BY: Sonia Uppal home to San Francisco she became her extracurricular project than most
URL: magpi.cc/2cpHOQJ interested when other methods were of us manage in our whole careers

28 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

CREATED BY: Oliver and Amelia CREATED BY: Benton Park Primary School Code Club
URL: magpi.cc/2ctpvqH URL: magpi.cc/2cpTqTG

BEE BOX BENTON PARK


LIVE CODING
ORCHESTRA
Oliver and Amelia may be the youngest makers in this
feature, at age five and seven respectively at the time
they created the Bee Box. The box has reed switches
triggered by a magnet in the bee, to detect its position.
Scratch was used to program a little game, where If youve ever read the tutorials coding orchestra using Raspberry
the bee is placed on the flower and then the beehive. from Sam Aaron on Sonic Pi in Pi and Sonic Pi, with music
There are pictures and sounds to go with it as well. the magazine, youll know hes and graphics, for a very excited
always trying to teach people audience. They came back later
about live coding with it. Some to perform music based on
primary school children took the planets, with a little bit
this to heart and put on a live- of Holst inspiration.

LIZ I bump into Oliver and Amelia


SAYS a couple of times every year LIZ A brilliantly expressive use of the Raspberry
SAYS Pi: music created with Sonic Pi and some
at Pi events. Theyre a brilliant pair,
full of enthusiasm and imagination. kickass dancing. I could watch this all day
This project captures all of it

GETTING
CREATED BY: Zach Igielman
URL: magpi.cc/1OALwNT PIPIANO /
KIDS PIANO HAT
INVOLVED The PiPiano was originally a crowdfunded
Raspberry Pi add-on that allowed you
The reason the Raspberry Pi exists
to make music or even just have a
in the first place is to get more young
multi-button add-on for the Pi. It did
people into computer science again
extraordinarily well, worthy enough on its
after a drop in university applications
own to be on this list; however, the concept
to the subject. Getting the Raspberry
Pi is only the first step; inspiring and was later turned into a proper product by
teaching children about the Pi is the the folks at Pimoroni. Based on Zachs
next one. Attending Raspberry Jams creation, and made with his permission,
(see our Events section on page88) the Piano HAT uses touch-sensitive buttons
or finding your nearest CodeClub rather than physical ones.
(codeclub.org.uk) is a great way
to get for kids to learn about what LIZ Pimoroni turned Zach Igielmans original
SAYS into something that would still be one of my
they can do with a Raspberry Pi
andcoding. favourite add-ons for the Pi even if it hadnt
been invented by a 14-year-old

raspberrypi.org/magpi October 2016 29


Feature

15
LIFEBOX
CREATED BY: Graham Gelding
URL: magpi.cc/1qODcFy
FAST FACT:
The most expensive parts of the project are
the LCD screen and some of the controls
You could be forgiven for
thinking that the LifeBox
was just another neat
little programmed series of
LEDs. This would be a huge
mistake to make, because the
little lights are a lot cleverer
than you could imagine:
theyre alive. Well, sort of. At
the very least, they have been
programmed with behaviour.
In this box live two pixelic

COFFEE TABLE PI
entities, the blue and yellow
species, says Ferran.These two
species compete to survive and
Graham Gelding has created the ultimate in classy, grown- reproduce, feeding [on] the white
up arcade gaming apparatus: a cocktail arcade cabinet. mana that grows under [their] feet.
It was an attempt to recreate the classic arcade
cocktail cabinet, Graham tells us, but in a way that MAKER Since I was a child, I was attracted to
SAYS robotics and the possibilities of simple
can fit into a lounge. Its also a way of introducing my
kids to the games that I had growing up. life simulations
Looking for a project for his Raspberry Pi, Graham
also wanted to try some woodworking. He made the

14
whole table from scratch using pine from an old CREATED BY: Ferran Fbregas
bookshelf, as well as installing the screen, arcade URL: magpi.cc/2cKR1Ds
controls, and the Raspberry Pi itself that powers it. FAST FACT:
The project took two months
MAKER The two projects seemed perfect. to complete
SAYS I could make use of my experience
with Linux, but also learn about woodworking

13
CREATED BY: Matt Reed
URL: mcreed.com
MASON JAR
PRESERVE
FAST FACT:
Matt used Node.js to get the LEDs
to work in time with BitTorrent

The Raspberry Pi-powered Mason backup software. Its similar to


Jar Preserve is the most stylish Dropbox, he says, but instead of
backup solution weve ever seen. a centralised server in the cloud,
[Mason Jars] are industrial- you connect two or more of your
grade glass jars with a sealable lid own devices directly together over
that were originally used at home the BitTorrent protocol.
to preserve foods throughout
MAKER I used a saw
the winter, says Matt. Mason
SAYS to cut the base
Jars allowed for foods that were
harvested in the summer to last into a square, a sander to
all year round. Who doesnt want round it off, and a drill to
tasty fried okra in February? make the LED, Ethernet,
Matt used BitTorrent to create the and power holes

30 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

12
CREATED BY: Hitchin Hackspace
URL: magpi.cc/2cKRLIr FACEBOOK
FAST FACT:
Bighak is driven by two electric wheelchair motors and has a
chassis made from recycled space-age aluminium honeycomb
FAVES
These projects reached the most people on FaceBook

BIGHAK
(via shares and likes). You can follow The MagPi on
Facebook at facebook.com/MagPiMagazine

REACH:
Makers and coders of a certain 360 Camera 33,030
age go all misty-eyed at the
PEOPLE
mere mention of Bigtrak. Create 360 video
This toy, created in 1979, had awesomeness on your
kids across country issuing Raspberry Pi. This project
commands to a robot, such as records omnidirectional
go forward for one second, and video and posts it directly
turn right 90 degrees. to YouTube.
Well, Bighak is very similar, magpi.cc/2cd00fa
say its makers, but on a
rather larger scale 5.2:1, commands by holding up REACH:
to be precise. QR codes to the webcam. Retro SNES sculpture 31,023
Bighak allows the A Raspberry Pi turns the PEOPLE
commander to ride around commands into directions Hand-carved from clay,
in the rear, while issuing and Bighak trundles off. this micro-console
was a firm favourite
MAKER The combination of nostalgia and the with The MagPi
SAYS outrageousness of the suggestion was socialcommunity.
enough to provoke further conversation ending in the magpi.cc/2bSJKKZ
fateful words You know what, I think we could do it!

RGB Tweet-o-meter

LED 11
CREATED BY:
Control an RGB LED
Johan Ten Broeke
and see how well your
& Jeroen van Goor

MIRROR
tweets are doing.
URL: magpi.cc/2cKSeug REACH:
magpi.cc/2bXJ0Hf
22,564
FAST FACT: PEOPLE
The mirror is displayed
Created as an art installation, the at Fullscreen.nls Pi-Powered Sub
LED Mirror consists of a staggering Netherlands office
2,048 LEDs. When someone stands Rather than taking
in front of it, a camera picks up to the skies like most
their movement and creates a Pi-powered drones,
series of snazzy effects. this ingenious ROV
The project began on a small scale. dives beneath the REACH:
We built a prototype of several surface for some 10,735
small 88 LED dot matrix digits, underwaterexploration. PEOPLE
Johan explains. It soon grew. magpi.cc/20TfFiE
The effect is nothing less
than stunning. Although the
displayed images are very abstract, RTAndroid
spectators identify themselves
instantaneously due to the Install Android with
feedback of their motions. This RTAndroid on a REACH:
triggers people to move and wave Raspberry Pi 3. 5,245
in front of the mirror, says Johan. magpi.cc/2bNHh4w PEOPLE

raspberrypi.org/magpi October 2016 31


Feature

PROJECTS
FOR GOOD
Lets celebrate the Raspberry Pi projects that help
people and communities, from health to education
ll over the world, people
A are harnessing the power CREATED BY: FarmBot, Inc
JUDGE

of digital technologies to URL: farmbot.io


solve problems that matter to them.

FARMBOT
One of the most powerful things
about Raspberry Pi computers is how
they have dramatically lowered cost
barriers, meaning that many more
people are able to take advantage Growing your own vegetables is one of
of the latest technologies to create those ideas that sounds great in theory,
exciting new innovations. Just as but in practice can be a lot of work. Its not
Philip Colligan important is the awesome global for everyone, but if you just want to eat
community of entrepreneurs, the result of the labour and you have some
CEO, makers, and educators that provides money to spend, then the FarmBot could be
Raspberry Pi Foundation
inspiration, shares learning, and gives for you. Its an incredible product that can
Philip Colligan is chief executive practical support. This combination also be scaled up to help feed communities.
of the Raspberry Pi Foundation. is massively accelerating the pace at
He is also a craft cider maker, which new solutions are being created
school governor, and dad to two to solve big social problems. It was
young digital makers. hard to pick just five, but here are a
few of my favourites from the many
examples weve found.

CREATED BY: World Possible


URL: worldpossible.org

RACHEL PI
RACHEL is educational server
software that contains everything
youd need students to access, with
the idea being that servers can
be set up in places where there is PHILIP Bringing
no internet and act as an offline SAYS knowledge and PHILIP A beautifully designed
internet, albeit with only the SAYS
education to parts of the and automated food
relevant content you need. The
world that the internet hasnt production system. Powered by a
RACHEL Pi is a Raspberry Pi loaded
with the software which costs
yet reached, using Raspberry Raspberry Pi computer, this completely
only $99, but which can open up Pi and the power of social open-source project aims to change
a wealth of possibilities to people entrepreneurship. Whats the way we produce our food
around the world. not to love about this?

32 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

EDUCATION CREATED BY:

WITH THE
International Education Association
URL: iea.org.lb

RASPBERRY PI
Its no secret that the Raspberry Pi Foundations
main mission is to spread and facilitate computing
education. The Raspberry Pi computer itself aids in
this by lowering the cost of actually purchasing a
computer. Projects on this page like RACHEL and
Pi4L are wonderful uses of the Raspberry Pi for
PI4L
The Pi4L Labs, about 12
THE PI FOR
LEARNING
to 25 Raspberry Pis that
just that, but you dont need to go that far to use students work on, helped
the Pi for educational purposes. The Raspberry Pi teach refugee children
Foundation has produced a ton of teaching materials basic numeracy skills,
that are all freely available for everyone to use and
visual programming
can be found via: magpi.cc/2ctbKrV
(via Scratch), and social
and health awareness.
It could also guide the
teachers themselves so
CREATED BY:
they could better educate
Dana Lewis and Scott Leibrand
the kids using the
URL: diyps.org
resources provided by Pi4L. Lessons arent just provided while on
the computers either, with unplugged lessons included as well.

DO-IT-YOURSELF PHILIP Using Raspberry Pi computers as part of a

PANCREAS SYSTEM
SAYS Unicef-backed educational programme to
support Syrian refugees living in Lebanon,
Also known as the #DIYPS, it was developed to this has already delivered impressive results
solve a known issue with an existing medical
device on the market that had been FDA
approved, and it did. In the process, its makers CREATED BY:
were also able to add features such as real-time Media in Cooperation and Transition
processing of blood glucose, real-time predictive URL: magpi.cc/2cnCJID
alerts, and continually updated recommendations

POCKET FM
on required insulin and carbs. The code has been
released as OpenAPS so other people can build
their own custom system: its literally DIY.

Protecting true free speech in small


parts of Syria, the Pocket FM helps
people gain access to audio content
from Syrnet. Its a radio channel
maintained by humanitarians and
Syrian ex-pat journalists to broadcast
news, language programmes, and
even music to people who dont want
to rely on government-controlled
news feeds whatever government
PHILIP that might be. It can be powered by a
A system built around
SAYS Raspberry Pi for
car battery or solar power and is small
and easy to hide.
continuously monitoring blood glucose
levels for people suffering from PHILIP Bringing independent radio to cities in Syria
diabetes, helping them to manage diet SAYS through low-cost, portable radio devices
and medication, and ultimately to live built on Raspberry Pi computers that convert satellite
longer, healthier lives signals to FM so that everyone can access them

raspberrypi.org/magpi October 2016 33


Feature

10
CREATED BY: The Ruiz Brothers

RASPBERRY PI URL: magpi.cc/2dboNwS


FAST FACT:

NOTEBOOK
You can find a full shopping list of parts,
software, and 3D printing files on the Adafuit
Learning system

This beautiful retro-styled mini- wireless input device thats both


notebook, built by Adafruits affordable and easy-to-use.
Ruiz Brothers, is powered by a While the hardware is the
Raspberry Pi and an Adafruit 3.5 really exciting bit, the 3D-printed
PiTFT touchscreen and, frankly, chassis is a work of art, too.
not a great deal more! Take, for example, its totally
Besides the Raspberry Pi 2 modular hinged design. While
and PiTFT display, for control it works really well on this
the project features a mini- Raspberry Pi mini-notebook,
chiclet keyboard with built-in you could reuse it for 101 different
trackpad. Its a widely available hardware projects.

8
CREATED BY: Raspberry Pi
URL: astro-pi.org
9
CREATED BY: The Ruiz Brothers
URL: magpi.cc/2dbpFBJ FAST FACT:
Seven experiments, designed by
FAST FACT:
schoolchildren, were performed
You can attach Pi
aboard the ISS
Glass to prescription

ASTRO PI
glasses (unlike Google Glass)

PI GLASS
The good people at Adafruit factor, say the Ruiz Brothers.
During 2016, the
United Kingdom
looked to the skies
posted a tutorial on making It easily clips to your prescription as British ESA
a wearable display, powered glasses, and can display any kind Astronaut Tim
by a Raspberry Pi, that clips on of device with composite video, Peake served aboard
to your regular glasses or (if like a Raspberry Pi. the International
youre a Terminator with perfect SpaceStation.
vision) sunglasses. MAKER Hack together Two special
SAYS your own
Our 3D-printed design turns Raspberry Pis joined
a pair of private display glasses Google Glass wearable using Tim up in space. The
into a Google Glass-like form a Raspberry Pi Astro Pi devices, nicknamed Ed and Izzy, had their
own mission to carry out experiments some aided
by Tim himself coded by UK schoolchildren.
Raspberry Pis space adventures arent over.
We hope to see Raspberry Pi-derived hardware in
CubeSats in low Earth orbit and maybe beyond,
says Eben Upton, CEO of Raspberry Pi. Weve been
wondering if SpaceX have any room on their Red
Dragon mission in 2018.

TIM Ive been amazed by how


PEAKE many kids and adults
SAYS
have been encouraged
and inspired to take up programming

34 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

7
CREATED BY: Fl@c@
(pronounced flatcat) VOTE
COUNTING
URL: magpi.cc/2dbpuWQ

RAMANPI
FAST FACT:
The project made it to the
final of the 2014 Hackaday We gathered votes from 4,625 readers who told us
Raman spectroscopy is a molecular Prize comptition their favourite projects. The most popular project
identification technique that was Magic Mirror, with 17.9 percent of the vote.
works by detecting and analysing Theyre also very expensive SeeMore came in second, with 9.5 percent. BrewPi,
the characteristic ways in which pieces of kit. This ramanPi Internet of LEGO, and Aquarium all gained around
substances absorb and emit spectrometer uses a Raspberry Pi 5percent of the vote each. The rest of the voting
radiation. Raman spectrometers and 3D-printed parts, together was split between the Top 20 projects listed here,
can identify chemical compounds with readily available off-the-shelf and other (still very cool) projects.
from tiny samples, and components. Its an astonishing
are non-destructive. contribution to the open source
movement thats likely to be of 4,500
interest to schools, chemists,
biologists, home brew enthusiasts,
people who want to know whats in
MAGIC MIRROR
their water, businesses, ecologists,
4,000
and the simply curious.

MAKER Ordinarily, an
SAYS expensive notch
filter would be used which 3,500
is cost prohibitive for most
SEEMORE
average people

BREWPI 3,000
6
CREATED BY: The Ruiz Brothers
URL: magpi.cc/2dbpjLx
INTERNET OF LEGO
FAST FACT:
The display is a touchscreen,
AQUARIUM
so you can also play modern 2,500
swipe-based games
PIGRRL

PIGRRL
RAMANPI
2,000
ASTRO PI

To celebrate the 25th Its been through a few PI GLASS


anniversary of the Nintendo iterations, and the latest
RASPBERRY PI NOTEBOOK 1,500
Game Boy console, Adafruit Pocket PiGRRL uses a Raspberry
came up with this great Pi and PiTFT HAT (320240 LED MIRROR
emulation project. pixels) to create a portable
BIGHAK
gaming console.
While youre free to set up MASON JAR PRESERVE 1,000
the software side of the project LIFE BOX
in any way you like, the Ruiz
VOYAGE
Brothers have opted to use
RetroPie (magpi.cc/2cqNyJW), a COFFEE TABLE PI
great emulation package for the RASPBERRY PI VCR 500
Raspberry Pi that enables users MCMASTER FORMULA HYBRID
to play games from all sorts of BEETBOX
classic systems. 4BOT
OTHERS
0
raspberrypi.org/magpi October 2016 35
Feature

CREATED BY: Michael Gronau


URL: magpi.cc/2cxpup1
FAST FACT:
The aquarium can set five
different degrees of cloudiness

AQUARIUM
Create the ultimate environment for your fish using an IoT tank
seriously cool home for all your fishies, this The main way it simulates the Caymans
A special aquarium in Germany allows the
fish to experience what it would be like to
is by changing the water temperature, and
illuminating the tank in a specific fashion using
be swimming around a reef off the Cayman Islands. a series of LEDs above the tank. The light takes
Honestly, were pretty jealous of the fish. Maybe they into account not only the amount of sunlight but
all have offshore holdings there? also dawn and sunset, along with the moonlight!
The Raspberry Pi is the key to figuring this part
A paradise for fish. We out, as it polls a Cayman Islands weather station
wonder how a tropical
every couple of minutes and then makes the
storm affects the tank
necessary changes.
All the lights are controlled by an Arduino and
theres even a web interface in case you think the
fish are having too good a time and want to bring
them back to the reality of where they actually
are. Apparently, its been working well long-term
and we sincerely hope the fish are enjoying their
extended Holodeck-esque staycation.

MAKER What I like with this build is the


SAYS possibilities you have with LEDs

36 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

CREATED BY: Cory Guynn


URL: internetoflego.com
FAST FACT:
Cory has been working on Internet of LEGO
since September 2015

INTERNET
OF LEGO An electronic LEGO city thats online
and teaching its maker about IoT
eve seen many Raspberry Pi projects where
W people have created an incredible thing just to
learn about it. The Internet of LEGOs creator
been able to do that make for a dynamic environment.
It links up to the Transport for London API, which helps
Cory has previously described it as a living project; schedule the train and also gives live changes to its
from his blog you can see how it has been built up over destination. You can even read where its going on a
time, not just in terms of LEGO bricks, but also by adding little OLED screen.
internet-controlled bits and pieces. Corys amazing feats are in part due to the help from
He first started with some simple lights, but since the open-source community: an integral part of Pi
then hes added mechanisms that drive lifts and rail projects, it seems.
crossings that also use motion sensors and the like. A lot
of it is programmed with Node-RED, the building-block MAKER My goal with this project
SAYS is to learn tech, and
programming language.
Theres a working train track around the city thats inspire our future engineers and those
one of Corys favourite parts. I love seeing things in who want to better understand these
motion, he tells us. There are several things that Ive exciting new technologies

raspberrypi.org/magpi October 2016 37


Feature

CREATED BY: Elco Jacobs


URL: brewpi.com
FAST FACT:
The BrewPi team are working
on supporting mash control, The original BrewPi

BREWPI
another aspect of brewing equipment was much more
DIY than the final product

Brew the perfect beer using your Raspberry Pi to control the process

T
his is one of the earlier, pioneering
Raspberry Pi projects, having been
initially completed in 2012 when the
Raspberry Pi and the community were still in
their relative infancy. One of the important
things about brewing beer (and wine) is
controlling the temperature of your batch,
which is where the BrewPi comes in.
Its since been made into a product that the
maker Elco Jacobs develops and sells, claiming
its more accurate than other similar products
while also allowing you track data through a web
interface an Internet of Beer, if you will.
Theres other features as well, such as
programmable temperature profiles and the
like, but all in all its a great example of how a
community project turned into a fully fledged
product. Although you may need to hack an old
fridge if you want to brew some truly special
beer, luckily there are guides on how to do that
(using your BrewPi) on the website.

MAKER Compared to
SAYS other temperature
controllers, BrewPi offers much
better temperature control

38 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

CREATED BY: Virginia Tech


URL: seemoreproject.com
FAST FACT:
It took a year to build, with
nine months making, sourcing,
and assembling the parts

SEEMORE
MAKER SeeMore was designed
SAYS to combine computer
science and art to engage, educate,
and inspire broad audiences on the
A Raspberry Pi sculpture thats
importance and beauty of parallel
also secretly a supercomputer
computational thinking
s far as we can tell, this sculpture also holds the
A record for the number of Raspberry Pis working
together in parallel. With 256 linked together in
this massive work of art and tech fusion, it can probably
crunch some serious numbers if you wanted it to.
It was exhibited at the World Maker Faire New York
at the end of 2015, and used 834 metres of wiring to get
it all hooked up and working. A lot of the parts were
custom-made via CNC and laser etching, but the coolest
thing about the piece was how the panels covering each
Pi would move depending on how much computational
power was being used.
The movement of the Raspberry Pis is actually a
curve so it doesnt just flap out, it articulates outward,
one of its creators Sam Blanchard reveals. It has a
double linkage that some might see as superfluous
or overly complex, but I think that what you get is
this waveform that relates to these ideas of fluidity,
and that springs from what a lot of parallel computers
are built to process: things like weather simulation or
fluiddynamics.
Its not on permanent display (theres no room at
Virginia Tech for it), but it does make appearances at
exhibits around the world, so keep your eye out for it.

raspberrypi.org/magpi October 2016 39


Feature

MAGIC
MIRROR A mirror into your life, or at least
CREATED BY: Michael Teeuw
URL: magicmirror.builders the parts that are available online
FAST FACT:

I
The original prototype took a f youve ever been on the Raspberry Pi
couple of weeks to build subreddit, youll probably have seen some
amazing magic mirror projects posted there.
Theyre always very popular, and for good reason:
theyre really cool. Heres the kicker as well: with all
Give yourself
the hard software work done and available, theyre
a quick look and
make sure you not too hard to make, as long as youre handy with a
look on point for saw and varnish for some light woodworking.
the day The project that brought the concept to many
peoples attention last year was Bradley Meltons
mirror, which we featured in issue 40 of the
magazine. It looked and worked great, with all the
basics youd need from a smart mirror: weather,
time, and a nice compliment to get you started in
your day. Bradley built the software of his version
using preexisting software as a guide so he could
understand it, which then allowed him to add
seasonal Easter eggs to it like spooky pictures
during Halloween.
Keep track of
whats going on
today like traffic,
your agenda,
and more

Its nice to get a


positive message
every morning

The hardware inside the mirror is


quite simple (and relatively cheap)

40 October 2016 raspberrypi.org/magpi


THE 50 GREATEST RASPBERRY PI PROJECTS Feature

Bradley added seasonal events


to his mirror, which is easy to do
with its modular nature

The aforementioned preexisting magic mirror


software was created by Michael Teeuw, a maker
from the Netherlands:
I was visiting New York with my girlfriend.
Michael tells us. While wandering around Macys, I
noticed a mirror with an illuminatedsong on it. This
is something I could build myself [I thought], only
better. I wanted my own magic mirror!
Michael built the first mirror before expanding
upon it with a software project hes dubbed As long as you have a little bit of carpentry
Bradleys project was
MagicMirror2. Its an open-source modular platform and general DIY skills to build the frame, and featured in issue 40
so other people can build their own magic mirrors. have a basic understanding of how to program, and was made from
scratch, with the
Since then, magicmirrors like Michaels and you should be able to build this. I have never original as a guide
Bradleys have popped up on Reddit quite often. used JavaScript or CSS before this project, and I
Its an extremely humbling experience, Michael only had a little bit of experience with HTML.
says of the love for the project. It feels like a huge Looks like its time to get building the winner
compliment that I inspired so many people to of our top 50 Raspberry Pi projects.
build their own mirror and explore the world of the
Raspberry Pi. MAKER When I started working on my
Hes recently started a new website, SAYS prototype, I could have never
magicmirror.builders, to guide people who want to
make their own magic mirror project. It has links guessed the amount of attention the project
to the software and blogs from the build, so you
can plan and create your own. However, as Bradley
would get. I am humbled that I was able to
explains to us, its very easy: inspire so many people.

raspberrypi.org/magpi October 2016 41


Tutorial STEP BY STEP
DAVE PROCHNOW
A writer whose numerous projects,
contraptions, and inventions have
appeared in Popular Science,
Nuts & Volts, and SERVO Magazine.
magpi.cc/2cc7uvj

GO, PIONEER
DIY PORTABLE ACTION CAM
Build your own battery-powered, slow-motion, 90fps action camera
Youll to prove youve been there and done that!
Need ost adventurers who are thinking about recording >STEP-01
> Raspberry Pi
Camera Module
M an action event would choose to explore the
GoPro camera system. While being a very capable
Print it
Borrowing a page from the Astro Pi design book,
> 7 5mm recording device thats housed inside a diminutive piOneer consists of a three-part 3D-printed case that
(T-1 3/4) LEDs package, the GoPro cameras have an exorbitant price holds a Raspberry Pi, Camera Module, user interface,
> 7 430 resistors tag that stops weekend warriors in their tracks. What if LiPo battery, and large capacity micro SD card. The
> Big SPST switch an action camera cost less than $50? What if you could case consists of three separate STL files that can be
magpi.cc/ build this camera yourself? What if this camera had printed on any 3D printer with a 150150mm build
2bY3Pmn a fully functional Linux computer inside? Although it surface. The cases top piece should be printed with
> 3.7V 1000mAh might sound like pie-in-the-sky dreaming, these are the a removable support structure. You can download the
LiPo battery hallmarks for our piOneer slo-mo action camera project. STL files from here: magpi.cc/2c3XdUE.
magpi.cc/
2bY3Kiq

> 5V step-up


Flick this switch for both powering
magpi.cc/
the system and capturing 90fps video
2bMIwmv

> JST connector


magpi.cc/
2bLzvc0

> 4 2-inch
#6-32 screws

> 4 - or
-inch rubber
grommets

> Jumper wires

This row of LEDs is


the user interface
for displaying the
cameras status

A custom-designed,
3D-printed, high-impact
plastic enclosure

44 October 2016 raspberrypi.org/magpi


GO, PIONEER Tutorial
>STEP-02
Build your UI
The user interface (UI) for piOneer is dead simple.
Consisting of seven LEDs and one switch, the entire
UI is housed in the case top piece. Begin your UI
construction by gluing the LEDs and the switch to
the upper surface of the case top. While you can use
the same colour LEDs for piOneer, we opted to mix
it up a little: a red LED for power (PWR), blue for
ready, white for countdown 3 and 2, a yellow LED for
countdown 1, red for recording (Rec), and a green
LED for finished. Just one caveat about gluing the
LEDs: ensure that all of the cathodes are lined up
with each other; this makes the next step very easy
to complete.

>STEP-03
Solder your UI Everything soldered
in place. Resistors
Were going to use a little bit of wiring trickery are attached to LED
here! Rather than routing each LED cathode to a anodes, whereas all
of the LED cathodes
separate Pi GPIO GND pin, were going to connect are soldered
each cathode together in a daisy chain fashion, together and wired
to a Pi GND GPIO pin
thereby using only one GND pin for six LEDs! Begin
this wizardry by gently bending the finished
LED cathode so that its touching the recording connection. Likewise, for the remaining LEDs, bend
LED cathode. Now solder these two cathodes and solder each LED cathode to the next until you
together. Continue up the daisy chain, carefully reach the Ready LED. Stop at this LED. Do not solder
bending the recording cathode until its touching the power (PWR) cathode to this chain: it must be
the countdown1 cathode, and soldering that connected to its own GND pin.

>STEP-04
Wiring your UI
The resistors are each individually soldered
to the anodes of all LEDs. Begin this process
by carefully wrapping one end of a resistor lead
around an LED anode lead. The resistor should be
parallel to the inside of the top case. Solder this
connection, and trim and discard the leftover resistor
lead. Add the six remaining resistors to the final
LEDs. Solder a jumper wire to the free end of the
resistors other lead. Complete the LEDs cathode
wiring by soldering a female jumper wire to the
power (PWR) LED cathode lead, and one final female
jumper wire should be soldered to the daisy-chained
cathodes that we created in step 03. The piOneer UI is
now complete.

>STEP-05
Adding battery power
The power system for piOneer consists of three
sub-assemblies: the power (PWR) LED, the SPST
switch, and the battery. While the LED and switch
are pretty straightforward fixtures in a do-it-
yourself (DIY) project, the battery has one additional
component that enables the Pi to run without being
Mount the camera
module to the tethered to a power outlet. A 5V step-up converter
3D-printed base
takes the output from the 3.7V LiPo battery and
with M2 fasteners
increases it to 5 volts.

raspberrypi.org/magpi October 2016 45


Tutorial STEP BY STEP
The completed
project, ready
to capture
your lifes next
greatadventure

>STEP-06 >STEP-08
Wiring your battery Connecting to the GPIO
Two wires are individually soldered to the switchs Place the wired-up top case next to the base that holds
terminals. One of the switchs wires is soldered to the Pi. Slip the mid case onto the top case. Connect
the positive terminal of the JST connector. The JST each of the female jumper wires from the top case to
connector is keyed for proper power signal orientation. the Pi GPIO pins by following this listing:
Use the battery for identifying which terminal is which
remember, the batterys red wire is positive, while GPIO JUMPER
the black wire is GND. The other wire from the switch is
connected to the IN pad on the 5V step-up converter. A Pin Wire
female jumper wire is connected to the OUT pad of the 1 PWR LED anode
converter. The final pad on the converter is a common 4 5V step-up converter OUT
GND connection. In other words, both the batterys GND 6 5V step-up converter GND
and the Pis GND must be connected together via this 9 PWR LED cathode
pad. Therefore, solder a wire from the GND terminal of 22 Ready LED anode
the JST connector to the 5V step-up converter GND pad 16 Countdown 3 LED anode
and solder a female jumper wire to this pad. All of the 15 Countdown 2 LED anode
soldering is now finished for piOneer. 32 Countdown 1 LED anode
33 Rec LED anode
>STEP-07 37 Finis LED anode
Begin final assembly
39 Daisy-chain LED cathodes
The Raspberry Pi and Camera Module will be fastened
(see step 03)
to the base portion of the case. Note the orientation
of the two openings in the base. These openings will
hold the Camera Modules lens and status LED. Line >STEP-09
the module up with these openings and use four Program the Pi
M2 screws for attaching the Camera Module to the Carefully and thoroughly examine each and every
base. Lay a rubber grommet on each of the four tall solder joint and wiring connection, looking for
mounting posts, set the Pi on top of the grommets, touching wires, solder blobs, connection mistakes,
route the Camera Modules ribbon cable out and and so on. Fix any problems before connecting your
over the GPIO pins, and use four more M2 screws for Pi to a power source! When your piOneer passes
securing the Pi to the base. These rubber grommets muster, connect the Pi to a monitor, keyboard, mouse,
will provide a small amount of cushion for the Pi and USB power source; now set up your Pi so that
during your upcoming rough-and-tumble adventures. it boots, with automatic login, to a command-line
Insert the Camera Modules ribbon cable into the interface (CLI). These settings will enable piOneer to
Camera interface connector on the Pi. run automatically without user input every time you

46 October 2016 raspberrypi.org/magpi


Tutorial

pioneer.py Language
>PYTHON 3
import RPi.GPIO as GPIO
from time import sleep DOWNLOAD:
import datetime as dt magpi.cc/2coG1um

import picamera

GPIO.setmode(GPIO.BOARD)
# Set up LED pins
# Ready LED
GPIO.setup(22, GPIO.OUT)
# Countdown 3 LED
GPIO.setup(16, GPIO.OUT)
# Countdown 2 LED
GPIO.setup(15, GPIO.OUT)
# Countdown 1 LED
GPIO.setup(32, GPIO.OUT)
Use-inch or # RECord LED
-inch rubber
grommets as tiny GPIO.setup(33, GPIO.OUT)
shock-absorbing # finisH LED
spacers between
GPIO.setup(37, GPIO.OUT)
the Pi and the case

# Camera is ready, begin countdown


flick the power switch. Download or enter the piOneer GPIO.output(37, False)
code and save your code to the home directory on GPIO.output(22, True)
the Pi. You can alter the code to suit your recording sleep(2)
tastes. As it stands, piOneer will record 1 minute of GPIO.output(16, True)
sleep(2)
640480-pixel video at 90 fps. The final H264 file will
GPIO.output(16, False)
be approximately 65MB in size. In order to make the
GPIO.output(15, True)
Python code run automatically, open your user profile
sleep(2)
for editing: GPIO.output(15, False)
GPIO.output(32, True)
sudo nano /etc/profile sleep(2)
GPIO.output(32, False)
and add this line to the end of that file: GPIO.output(22, False)

sudo python /home/pi/pioneer.py & # Begin recording video


GPIO.output(33, True)
Save, exit, and disconnect piOneer.
# Records 60 seconds of video at 90 fps; change wait_recording

>STEP-10 # for length, in seconds, for video


with picamera.PiCamera() as camera:
Get out there! camera.resolution = (640, 480)
Ensure that the power switch is in the OFF position camera.framerate = 90
and connect the battery to the JST connector. Slowly camera.exposure_mode = 'antishake'
bring the case edges together, ensuring that no metal filename = dt.datetime.now().strftime('%d-%m-%Y-%H:%M:%S.h264')
leads, wires, or solder joints are touching the Pi! camera.annotate_text = dt.datetime.now().strftime('%d-%m-%Y %H:%M:%S')
Insert a long #6-32 screw through each of the casess camera.start_recording(filename,format='h264')
connection lobes and fasten with a nut. We used wing start = dt.datetime.now()
nuts for our fasteners, which makes the case easier while (dt.datetime.now() - start).seconds < 60:
camera.annotate_text = dt.datetime.now().strftime('%d-%m-%Y %H:%M:%S')
to open and close. In order to record a video, just flick
camera.wait_recording(0.2)
the power switch and within 30-45 seconds, piOneer
camera.stop_recording()
will start recording your slo-mo video. Videos are
recorded and saved with a date/time stamp file name. # Finish
In order to view the videos on your Pi, use: GPIO.output(33, False)
GPIO.output(37, True)
omxplayer date-time-stamp-filename.h264 sleep(10)
GPIO.output(37, False)
Have fun doing your daredevil deeds, because now you
can prove it. GPIO.cleanup()

raspberrypi.org/magpi October 2016 47


Tutorial RASPBERRY PI 101: CREATE SD CARDS WITH ETCHER

CREATE SD CARDS WITH

ETCHER
Youll
The easiest way to burn OS image files to your Raspberry Pi SD cards

Need C
opying operating system
(typically Raspbian) image
require a program such as
Win32DiskImager.
Etcher takes a lot of the stress
out of flashing a drive. Etcher wont
files to a micro SD card is So we were pleased to come write to your hard drive volumes
> Raspberry Pi
an essential part of getting started across Etcher (etcher.io). Etcher unless you check Unsafe Mode in
> micro SD card with a Raspberry Pi. It can be a turns the whole process of flashing Settings. Unsafe Mode is handy
> Etcher long-winded process, and is often an OS image file into three simple if you want to flash a USB thumb
difficult for newcomers to grasp. steps: Select Image, Select Drive, drive or other internal drive, but
Mac and Linux users typically and Flash Image. its disabled by default, making the
use the dd command in the More importantly, the same process safer for newcomers.
terminal, while Windows users program, with the same interface, We like Etcher so much, we
is available on all three types of thought wed create this guide
Click here and choose the This is automatically computer Windows, Mac, and to installing and using it. Follow
image youve downloaded. You can selected if you have just one SD
use IMG and ISO files, but you can card attached. Click Select Drive Linux which makes it easy for these steps for hassle-free
even use compressed files such as or Change to pick a different
ZIP, GZ, and XZ SD card everybody to understand. SD card flashing.

Click the Flash! button to copy the


files from the image to the SD card. The
card will be erased in the process, so you
dont need to worry about formatting it

48 October
xxxx 20162016 raspberrypi.org/magpi
RASPBERRY PI 101 Tutorial

01 02

03

>STEP-01 >STEP-04
Install in Windows or Mac Select the image
Download and install Etcher Click Select Image in Etcher.
from the etcher.io website. Use the file manager window
Double-click the .exe file in and locate the image you unzipped
Windows and follow the Etcher in the previous step. Click Open.
setup wizard. Drag the Etcher The image will appear under
app to your Applications folder Select Image, and Connect
on a Mac and double-click to a drive will highlight red.
open it. In Windows, run Etcher
in Administrator Mode: right- >STEP-05 04
click on Etcher and choose Run Insert your SD card
as administrator. Attach your SD card to the
computer. Etcher will select it
>STEP-02 automatically. Etcher wont write
Install on Linux to your hard drives by default, but
Download the AppImage file check that the SD card is listed
from the Etcher website. Open correctly. Now click Flash! to
a terminal window and enter: write the image file to the SD card.

cd Downloads >STEP-06 05
chmod a+x Etcher-linux-x64. Writing the image
AppImage Etcher will format the SD card,
./Etcher-linux-x64.AppImage before writing and verifying
the image; this is shown by a
progress bar. When done, remove
>STEP-03 the SD card, insert it into your
Download your OS image Raspberry Pi, and power it
Download a copy of the latest up. If you want
Raspbian image from to flash another 06
raspberrypi.org/downloads SD card with
(or the OS image you want to the same image,
install). Unzip the file after it has insert it and click
downloaded. Double-click the file Use Same Image.
in Mac or Linux (or use unzip in
a terminal window). In Windows,
right-click the file and choose
Extract All. Etcher can install
directly from a ZIP file, but the
process takes a lot longer.

raspberrypi.org/magpi xxxxx 2016


October 49
Tutorial WALKTHROUGH
SAM AARON
Sam is the creator of Sonic Pi. By day hes
a research associate at the University of

PART 14
Cambridge Computer Laboratory; by night
he writes code for people to dance to.
sonic-pi.net

EIGHT TIPS FOR


LIVE-CODING
&&
PRACTICE
Practice makes perfect and Sam Aaron has some tips on how to do that
Youll
Need ast month, we took a look at five important Code whilst standing
> Raspberry Pi
L techniques for mastering live coding; in other
words, we explored how we could use Sonic Pi
The body of a musician is conditioned for playing their
instrument. For example, a trumpet player needs to
running Raspbian to approach code in the same way we would approach a be able to blow hard, a guitar player needs to be able to
> Sonic Pi v2.9+ musical instrument. One of the important concepts that grip the fretboard with strength, and a drummer needs
> Speakers or
we discussed was practice. This month, were going to to be able to continually hit the drums for long periods
headphones with take a deeper dive into understanding why live-coding of time. So, whats physical about live-coding? Just
a 3.5mm jack practice is important and how you might start. like DJs, live-coders typically perform standing up, and
> Update Sonic Pi: someeven dance whilst they code! If you practise live-
sudo apt-get
update && sudo
Practise regularly coding whilst sitting at a desk and then have to get up
apt-get install
The most important piece of advice is to make sure you and stand at a gig, youll likely find the difference very
sonic-pi practise regularly. Veterans typically practice for 1-2 difficult and frustrating.
hours a day, but 20 minutes is just fine when youre
starting out. Little but often is what youre aiming for. Tip #3 stand while you practise. The easiest way

to do this is to use a standing height desk. However,
T
 ip #1 start to develop a practice routine. Find if you dont have one at home there are a couple
a nice time in the day that works for you, and try of low-fi options, such as practising on an ironing
to practise at that time as many days of the week board or with a keyboard on a stack of books. Make
as you can. Before long, youll be looking forward sure you stretch before you start practising, and try
to your regular session. to maybe dance a little during the session.

Learn to touch-type Practise setting up


If you watch a professional musician performing on stage Most instruments require some assembly and tuning before
youll likely notice a few things. Firstly, when they play they can be played. Unless youre a rock star with a bus
they dont stare at their instrument. Their fingers, arms, full of roadies, youll have to set up your own instrument
and bodies know which keys to press, strings to pluck, or before your gig. This is often a stressful time and its easy
drums to hit without them having to think about it too for problems to occur. One way to help with this is to
much. This is known as muscle memory and although incorporate the setup process into your practice sessions.
it might sound like something only professionals can do,
its just the same as when you first learned to walk or ride Tip #4 treat setting up as an important part of

a bike: practising through repetition. your practice. Pack a box with all the performance
essentials and put them together before each
Tip #2 learn how to touch-type. There are
 practice session. Once youve finished practising,
many apps, websites, and even games to help you take the time to carefully pack everything away
achieve this. Find one you like the look of and stick afterwards. This may take some time at first, but
at it until you can code without looking down. with practice youll get faster.

50 October 2016 raspberrypi.org/magpi


FIVE LIVE-CODING TECHNIQUES Tutorial
Experiment musically MAIN APPLICATION MANIPULATION
Once youve set up and are ready to start making music,
you might find yourself struggling to know where to start. M-r - Run Code
You might have a good idea of the kind of sounds you
want to make, but are frustrated that you cant produce M-s - Stop Code
them, or you dont even know what kind of sound to
make! Dont worry: this is very common and happens to M-i - Toggle Help System
every musician, even if theyve been practising for a long
time. Its much more important to be making sounds you M-p - Toggle Preferences
dont like than not making any sounds at all.
M-{ - Switch Buffer to the Left
Tip #5 spend time experimenting. Try to make

time to explore new sounds and ideas. Dont worry M-} - Switch Buffer to the Right
that it might sound terrible if its not the style
youre looking for. Youll increase the chance of M-+ - Increase Text Size of Current Buffer
stumbling over a sound or combination of sounds
which you love! Even if 99% of the sounds you M-- - Decrease Text Size of Current Buffer
make are bad, that 1% might be the riff or intro to
your new track. Forget the things you dont like
and remember the parts you do. This is even easier Remove all distractions Above Learn the
Sonic Pi shortcuts,
when making music with code: just press Save! A common problem when practising is to become and improve your
performance, here:
distracted with other things. Practising is hard and magpi.cc/2cO2mCt
Hear the code requires real discipline, regardless of the kind of music
Many musicians can look at a musical score and hear youre making. If youre struggling to get started or
the music in their head without having to play it. This make progress, its often too easy to hop on social
is a very useful skill and its well worth incorporating media; if youve set yourself a target of 20 minutes
into your live-coding practice sessions, to have some of practice, its important to try to spend all that time
understanding of what the code is going to sound like. being as productive as possible.
You dont need to be able to hear it exactly in your head,
but its useful to know if the code is going to be fast, Tip #7 before you start practising, remove

slow, loud, rhythmic, melodic, random, etc. The final as many distractions as possible. For example,
goal is then to be able to reverse this process: to be able disconnect from the internet, put your phone in
to hear music in your head and know what code to write another room, and try to practise in a quiet place
to make it. It may take you a long time to master this, where youre unlikely to be disturbed.
but once you do, youll be able to improvise on stage and
express your ideas fluently. Keep a practice diary
When youre practising, youll often find your mind is
Tip #6 write some code into Sonic Pi, but
 full of new exciting ideas: new musical directions, new
dont press Run. Instead, try to imagine what sounds to try out, new functions to write, etc. These
sound its going to produce. Then press Run, ideas are often so interesting that you might stop what
listen, and think about what you got right and youre doing and start working on the idea. This is
what you didnt. Keep repeating this until it another form of distraction!
becomes a natural part of your coding process.
Even if youre a veteran, you might be surprised Tip #8 keep a practice diary by your keyboard.

occasionally, but it does let you learn new tricks. When you get an exciting new idea, pause your
practice session, quickly jot the idea down, then
carry on practising. You can then spend some
quality time thinking about and working on your
ideas after youve finished practising.

Bringing it all together


Try to establish a practice routine which incorporates
as many of these ideas as possible. Keep the sessions as
fun as possible, but be aware that some practice sessions
will be hard and feel a little like work. However, it will
allbeworth it once youve created your first piece or
given your first performance. Remember, practice is the
Above If you plan to add some Minecraft magic to your set,
you should practise that too key to success!

raspberrypi.org/magpi October 2016 51


Tutorial WALKTHROUGH
SIMON LONG
Works for Raspberry Pi as a software
engineer, specialising in user interface
design. In his spare time he writes apps
for the iPhone and solves crosswords.
raspberrypi.org

A for loop lets you initialise, test, and A switch statement allows you to
increment the variables associated with a choose different actions depending on
loop from within the loop definition itself multiple different values of a variable

AN INTRODUCTION TO C PART 04

ADVANCED FLOW CONTROL


For loops and case statements more advanced ways of controlling the flow of a program
he if statement and while loop described in a = 0 is the initial condition; the variable
T the previous article are fairly simple control
structures. This month, were going to look at
a is initialised to 0 at the start of the loop.
a < 5 is the test, just like in a while loop;
a few more complex ones that can help to make your this is checked on each iteration of the loop,
code shorter and more efficient. and the loop code is only executed if the test
While the while loop we saw in the previous article evaluates to true; as soon as the test is false,
YOUR is very useful, the for loop tends to be favoured by execution continues after the curly bracket at
FAVOURITE many programmers, as it puts all the logic controlling the end of the loop code.
LOOP the loop in one place. Heres an example: a++ is the increment; this is code which is executed
All three at the end of each iteration of the loop, before the
types of loop #include <stdio.h> test is evaluated again. In this case, it adds 1 to a.
in C while,
dowhile, and So when this for loop runs, what happens? First,
for can be void main (void) a is set to 0. The test is then checked; is a (which
used in nearly { is 0) less than 5? Yes it is, so the code inside the
every situation
where a loop int a; curly brackets is executed, and the value of a is
is needed; for (a = 0; a < 5; a++) printed. Finally, the increment is applied, meaning 1
choose { is added to a.
whichever
you like. Some printf ("a is equal to %d\n", a); The test is then repeated; if true, the loop code is
people prefer } executed again, and the increment is again applied,
to use one printf ("a is equal to %d and Ive then this repeats over and over until the test is false.
type of loop
for everything; finished", a); In terms of what they do, for loops and while loops
others pick } are pretty much identical.
and choose
whichever
looks tidiest This isnt all that different from a while loop, Switch statements
for each but all of the control for the loop lives in the round One thing that you quite often want to do is to test a
circumstance. brackets after the for keyword. This contains three variable against several values and do different things
There are no
wrong choices! statements, separated by semicolons; in order, these based on each of them. You can do this with a set of
are the initial condition, the test, and the increment. nested if statements:

52 October 2016 raspberrypi.org/magpi


AN INTRODUCTION TO C Tutorial
#include <stdio.h> also execute. Try it by compiling the code above and
MULTIPLE
running it; in the terminal youll see it say that a is
INITIALISATIONS
void main (void) equal to 0. Now remove the two breakstatements:
{ You can
int a = 0; initialise
multiple
if (a == 0) switch (a) variables in a
{ { for loop just
printf ("a is equal to 0\n"); case 0 : printf ("a is equal to 0\n"); separate them
by commas.
} case 1 : printf ("a is equal to So if you want
else if (a == 1) 1\n"); to set two
{ default : printf ("a is greater variables at
the start of the
printf ("a is equal to 1\n"); than 1\n"); loop, you can
} } use for (a = 0,
else b = 1;<test>;
<increment>)
{ and run it again youll now see:
printf ("a is greater than 1\n");
} a is equal to 0
} a is equal to 1
a is greater than 1 MULTIPLE
That does start to get pretty long-winded though, INCREMENTS
so C provides a neater way of doing this, called Not what you expected! This is another common
a switch statement. bug in C code; forgetting the break statements in your As with
multiple
cases can result in very unexpected behaviour. initialisations,
#include <stdio.h> you can have
Leaving a loop early multiple
increments in a
void main (void) The break statement has one other use; it can be for loop, also
{ used inside while and for loops to break out of them. separated by
int a = 0; Look at this example: commas for
(a = 0; b = 1;
switch (a) <test> ; a++,
{ #include <stdio.h> b *= 2). This is
case 0 : printf ("a is equal to 0\n"); useful if there
are two or
break; void main (void) more variables
case 1 : printf ("a is equal to 1\n"); { that change
break; int a = 5; consistently
while the
default : printf ("a is greater while (1) loop runs.
than 1\n"); {
} printf ("a is equal to %d\n", a);
} a++;
if (a == 5)
This does exactly the same as the example above { CONTINUE
with multiple if statements, but is a lot shorter. break;
The keyword
The opening line consists of the keyword switch, } continue can
with the name of a variable in round brackets; this } be used in a
variable will be tested against the various cases. printf ("a is equal to %d and Ive loop instead of
break. Instead
The body of the switch statement is a number of case finished", a); of breaking
statements. The variable a is compared against each } out of the
case in turn; if it matches the value just after the word loop, however,
continue skips
case, then the lines of code after the colon are executed. So we have a while loop in which the test is just the all the rest of
The final case is just called default; every switch value 1; this is a non-zero value, so is always true. If you the code in
statement should include a default case as the final enclose code inside curly brackets after a while(1) the current
iteration, and
one in the list, and this is the code which is executed if statement, the loop will never end; it will keep running returns to
none of the other cases match. for ever. But in this case weve provided an alternative the test case
Notice that the last line in each case section is the way to end the loop. We test the value of a inside the at the start
of the loop.
word break; this is very important. This keyword tells loop itself in an if statement, and if a is equal to 5, we Among other
the compiler that you want to break out of the switch call the break command; this causes the loop to end and things, this
statement at this point; that is, to stop executing code execution to continue with the statement after the loop. can be useful
to speed up
inside the switch. If you forget to include the break A break statement like this can be useful to leave a loop your code.
statements, every case after the one you wanted will early in the event of an error, for example.

raspberrypi.org/magpi October 2016 53


Tutorial WALKTHROUGH
MIKE COOK

MIKES PI BAKERY
Veteran magazine author from the old
days and writer of the Body Build series.
Co-author of Raspberry Pi for Dummies,
Raspberry Pi Projects, and Raspberry Pi
Projects for Dummies.
magpi.cc/259aT3X

DANSE MACABRE
THE SKELETON DANCE
Make a skeleton dance to your music in front of the fires of hell, for Halloween
he Danse Macabre is a piece of classical music Building your marionette
Youll T created in 1874 by the French composer
Camille Saint-Sans. Its often known by the
The idea is to take an image of each component of
a skeleton and draw it on the screen so that each
Need popular name of The dance of the skeletons and it component links up together. However, like any
inspired this years Halloween project. Weve used marionette, the limbs arent fixed but jointed. In
> Spectrum display the hardware from our Spectrum display project in computing terms, this involves plotting each limb
hardware (see issue 46 to get data from sound, which is in a specific rotational orientation. This presents us
The MagPi #46)
then used to make an animated skeleton dance to with a problem, because the CPU power needed to
> Or thumb the music. Alternatively, theres a version that uses rotate an image is a bit heavy, even for a computer
joysticks (see
The MagPi #49)
last months twin joystick interface. So theres no as powerful as the Raspberry Pi. Whats more, a
new hardware this month, but quite a bit of software, simple rotation often leaves the image with jagged
so lets see what we need. artefacts that change with the rotation, making

The fires of hell

Skeleton dances
to the music

Spectrum input board

54 October 2016 raspberrypi.org/magpi


DANSE MACABRE Tutorial
any resulting animation look fuzzy and noisy. The
solution to this is to rotate a much higher-resolution
image and then scale it down to the size you want.
Unfortunately, this adds even more to the burden
on the CPU. So, to get over this, the images of the
various limbs are precalculated. Weve used this
technique on several occasions before, for example
in the Olympic Swimming Simulator of The MagPi #48.
Each frame was prepared beforehand, then loaded
into the program at runtime. We initially tried the
same technique with our skeleton, but it soon became
clear that not only was this tricky to do in the graphics
package, but also a lot of images needed creating. In
addition, for each image, you need data saying where
the plot and connection points are for that image.
We thought, like the Little Princess said, there must
be something better, and so we let the program
generate all the intermediate images from the one
starting prototype image. The only downside to this
isthe amount of time it takes to initialise the program
at the start.

Graphics
If you search the internet for cut out skeleton, youll
find a wide variety of graphics designed to be printed
onto card, cut out, and then assembled using paper
fasteners as joints. We chose the one shown in Fig 1,
and set about cutting it up in a graphics package. Each
limb was isolated and made into a single image on
a transparent background. We used the same image
for the upper arm bone and thigh bone, and just

Fig 1 The original


cut-out skeleton
Pygame Ploting Point Centre of Square Image
Fig 2 Plotting of
an outer limb
is in the same
location despite
any rotation

raspberrypi.org/magpi October 2016 55


Tutorial WALKTHROUGH

the centre of the image is simply offset by half the


Pygame Ploting Point Centre of Square Image
width, or height, of this square image.
While thats fine for the end limbs, theres another
problem for limbs that need another limb hanging off
them. Fortunately, this has a simple solution. You just
need to have the pixel coordinates of this point and
as you rotate the image round the centre point, you
also rotate these coordinates and save them in a list
corresponding to each rotation position. This list is
the plotting position of the hanging limb and is used
to determine where in the Pygame window to plot it.
This is shown in Fig 3 note how most of the image is
just a transparent background.
All these limbs are hung off a body image. This
will have some x-y position in the Pygame window,
and there are pivot points that are relative to the
body image. To find the place to plot an inner limb
(an arm or thigh), you have to add the x-y position
to the pivot point offset. Now, to find the place to
plot the outer limb, you add the appropriate offset
from the list of outer limb hanging positions. This is
shown in Fig 4 and while it may seem complex, the
Hanging Limb Position
place to plot the outer limbs is found by building up
(Centre of Forearm
Square Image) the relevant offsets.

Software
A program that just tests out the skeletons limb
movement is on our GitHub repository and is a subset
of the full dance.py code shown overleaf. The idea is
Fig 3 Hanging an used the same image flipped for the two forearms. that each limb rotation, and the skeletons position on
outer limb on an
inner limb All the images, with the exception of the body, were the screen, is controlled by one of the music channels
made square with the pivot point at the centre. Any from the Spectrum hardware. This has left and right
other pivot points on the image were noted using the stereo information and, basically, this is used to
pointer position window in the graphics package. Each control the left and right side of the skeleton. This
part was kept at a large size and scaled down by 33% gives a mainly symmetrical look to the movement.
in the Python software. The exception to this was the However, the snag is that with no sound on a channel,
body: as this didnt need rotating, it was scaled down we wanted some limbs to be at the middle point of
directly in the graphics package. their rotation range. So we had to see if there was

The idea is that each limb rotation, and the skeletons


position on the screen, is controlled by one of the
music channels from the Spectrum hardware
Graphics strategy a zero or small value in the data channel and if so,
So, each limb has a single image associated with it. set the limb to the centre point. The data from the
This image is on a transparent background, but the Spectrum hardware is scaled into a floating point
key to making it work is that the joint, or plotting list, with values between 0.0 and 1.0; this is called a
position, of the limb is at the centre of the image. That normalised number. The skeletons x-y position on
way, we can rotate it around the centre but still draw the screen is controlled by the difference between left
it in the same place independently of the rotation and right channels of the lower frequencies. This kept
see Fig 2. Now, Pygame uses the top-left corner of an the movement from being too jerky across the screen.
image for its plotting position and with this way of To make the software easier to follow, each limb
drawing the image, the plotting point we want to use rotational position is defined by its own variable.

56 October 2016 raspberrypi.org/magpi


DANSE MACABRE Tutorial

A more compact way would be to use a list to mop up Fig 5 A trio of dancing skeletons
Fig 4 Joining limbs to the body
the repeated code in the main loop. As it takes about a
minute to create and rotate all the images, progress is
printed out on the console. Since the program runs in X-Y Window Offset
fullscreen mode, however, this is obscured, so in order
to see the progress, the fullscreen window is iconified.
Unfortunately, there is no un-iconify command and
so the user is prompted to click on the icon bar when
the code is ready to display. The space bar will toggle
between a full-size window with icon bar and a full
screen. The skeleton dances in front of a picture of
Shoulder Pivot Point
a real-life pit of hell in Turkmenistan, which has
been burning for over 50 years. Youll find that if the
volume is too loud, then the skeleton bunches up;
if too quiet, it doesnt move much.

Taking it further
We restricted the limb movements to what we
considered realistic, although there is a certain
suspension of disbelief with the concept of a dancing
skeleton anyway. You can easily change the limb
rotation to the full 360 degrees to get far more crazy
positions. Theres lots to tinker about with regarding
the mapping of the sound to the movement. Also,
theres a manual version in the GitHub repo that
uses the twin thumb joystick from last months
project. How about having two skeletons that dance
in perfect synchronisation? Or have each one with its
own unique mapped data so theyre different? In fact,
we have produced two- and three-skeleton versions
that you can find on GitHub as well. These seem to
be even funnier than the solo skeletons see Fig 5.
Hanging Limb Position
By having more than one skeleton, the moves seem
more choreographed.

raspberrypi.org/magpi October 2016 57


Tutorial WALKTHROUGH

dance.py 51.
52.
legPosR = legMax/2
if rightData[5] >moveThresh:
01. import pygame, time, os, math 53. legPosR = int(float(legMax/2) + float(legMax)*(
02. from pygame.locals import * rightData[5]-0.5))
03. import wiringpi2 as io 54.
04. 55. showPicture(ArmPosL,ArmPosR,foreArmPosL,foreArmPosR,
05. pygame.init() # initialise graphics interface thighPosL,thighMax-thighPosR-1,legPosL,legPosR,pan,tilt)
06. screen = pygame.display.set_mode((0, 0)) 56. checkForEvent()
# with window bar - use for debugging 57.
07. pygame.display.iconify() # hide window 58. def getSpectrumData():
08. xPovitBodyLarm = 17 ; yPovitBodyLarm = 153 59. global leftData, rightData
09. xPovitBodyLleg = 37 ; yPovitBodyLleg = 306 60. io.digitalWrite(pinReset,1)
10. xPovitBodyRarm = 126 ; yPovitBodyRarm = 159 61. io.digitalWrite(pinClock,1)
11. xPovitBodyRleg = 98 ; yPovitBodyRleg = 322 62. time.sleep(0.001)
12. xPovitBodyThighL = 37 ; yPovitBodyThighL = 306 63. io.digitalWrite(pinClock,0)
13. xPovitBodyThighR = 98 ; yPovitBodyThighR = 321 64. time.sleep(0.001)
14. noiseFloor = [[200, 200, 200, 200, 200, 200, 200], 65. io.digitalWrite(pinReset,0)
[200, 200, 200, 200, 200, 200, 200]] 66. io.digitalWrite(pinClock,1)
15. leftData = [ 0.1,0.1,0.1,0.1,0.1,0.1,0.1 ] 67. time.sleep(0.004)
16. rightData = [ 0.1,0.1,0.1,0.1,0.1,0.1,0.1 ] 68. for s in range(0,7):
17. 69. io.digitalWrite(pinClock,0)
18. def main(): 70. time.sleep(0.004) # allow output to settle
19. print"Danse Macabre skeleton initialising" 71. leftData[s] = scaleReading(io.analogRead(70),s,0)
20. initGPIO() 72. rightData[s]= scaleReading(io.analogRead(71),s,1)
21. loadImages() 73. io.digitalWrite(pinClock,1)
22. initWindow() 74.
23. xbase =((xs/2.2)-100.0) 75. def showPicture(armLpos,armRpos,farmLpos,farmRpos,thighRpos,t
24. print"Now click on iconified Danse tab" highLpos,legLpos,legRpos, x,y):
25. print"the space bar controls full screen display" 76. #pygame.draw.rect(screen,(0,0,0),(0,0,xs,ys),0)
26. foreArmMax = 36; ArmMax = 36 # fast alternative to background plot
27. thighMax = 40; legMax = 36 77. screen.blit(background,(0,0))
28. moveThresh = 0.08 78. screen.blit(bodyFrame,(x,y))
29. while True: 79. screen.blit(thighFrames[thighRpos],(
30. getSpectrumData() x - thighPlot+xPovitBodyThighR,y-thighPlot+yPovitBodyThighR))
31. pan = int(xbase+float(xs/16)*(leftData[0]-rightData[0])) 80. screen.blit(rightLegFrames[legRpos],(
32. tilt = int((ys/4)*(leftData[1]-rightData[1]))+40 x - rightLegPlot + xPovitBodyThighR+dXthigh[thighRpos],
33. ArmPosL = ArmMax/2 y-rightLegPlot+yPovitBodyThighR+dYthigh[thighRpos]))
34. if rightData[2] > moveThresh: 81.
35. ArmPosL = int(float(ArmMax/2) + float(ArmMax)*( 82. screen.blit(thighFrames[thighLpos],(
leftData[2]-0.5)) x - thighPlot+xPovitBodyThighL,y-thighPlot+yPovitBodyThighL))
36. foreArmPosL = int(float(foreArmMax/2) + float( 83. screen.blit(leftLegFrames[legLpos],(
foreArmMax)*(leftData[3]-0.5)) x - leftLegPlot + xPovitBodyThighL+dXthigh[thighLpos],
37. thighPosL = thighMax/2 y-leftLegPlot+yPovitBodyThighL+dYthigh[thighLpos]))
38. if leftData[4] > moveThresh: 84.
39. thighPosL = int(float(thighMax/2) + float(thighMax)*( 85. screen.blit(armFramesL[armLpos],(
leftData[4]-0.5)) x - armPlot+xPovitBodyLarm,y-armPlot+yPovitBodyLarm))
40. legPosL = legMax/2 86. screen.blit(foreArmFramesL[farmRpos],(
41. if leftData[5] >moveThresh: x - foreArmPlot + xPovitBodyLarm+dXarmL[armLpos],
42. legPosL = int(float(legMax/2) + float(legMax)*( y-foreArmPlot+yPovitBodyLarm+dYarmL[armLpos]))
leftData[5]-0.5)) 87.
43. 88. screen.blit(armFramesR[armRpos],(
44. ArmPosR = ArmMax/2 x - armPlot+xPovitBodyRarm,y-armPlot+yPovitBodyRarm))
45. if rightData[2] >moveThresh: 89. screen.blit(foreArmFramesR[farmRpos],(
46. ArmPosR = int(float(ArmMax/2) + float(ArmMax)*( x - foreArmPlot+xPovitBodyRarm+dXarmR[armRpos],
rightData[2]-0.5)) y-foreArmPlot+yPovitBodyRarm+dYarmR[armRpos]))
47. foreArmPosR = int(float(foreArmMax/2) + float( 90. pygame.display.update()
foreArmMax)*(rightData[4]-0.5)) 91.
48. thighPosR = thighMax/2 92. def loadImages():
49. if rightData[3] > moveThresh: 93. global foreArmFramesR,foreArmFramesL,foreArmPlot,
thighPosR = int(float(thighMax/2) + float(thighMax)*( armFramesR,armFramesL,armPlot,dXarmR,dYarmR,dXarmL,dYarmL
50. rightData[3]-0.5)) 94. global thighFrames, thighPlot, dYthigh, dXthigh,

58 October 2016 raspberrypi.org/magpi


DANSE MACABRE Tutorial
Language
leftLegFrames, leftLegPlot,rightLegFrames, rightLegPlot, bodyFrame 137. rot_image = rot_image.
95. print"creating and scaling images" 138. subsurface(rot_rect).copy()
>PYTHON 2.7
96. bodyFrame = pygame.image.load( 139. return rot_image
DOWNLOAD:
"skImages/body.png").convert_alpha() 140. magpi.cc/1NqJjmV
97. print"creating legs" def initWindow():
98. leftLegFrames = [ pygame.transform.smoothscale( 141. global screen,xs,
PROJECT
rot_center(pygame.image.load( 142. ys,debug,fullScreen,background
VIDEOS
"skImages/leftLegzero.png").convert_alpha(),angle),(360,360)) debug = True
99. for angle in range(90,-90,-5)] 143. os.environ['SDL_VIDEO_WINDOW_ Check out Mikes
100. leftLegPlot = leftLegFrames[0].get_width()/2 144. POS'] = 'center' Bakery videos at:
magpi.cc/1NqJnTz
101. rightLegFrames = [ pygame.transform.smoothscale( 145. xs, ys = screen.get_size()
rot_center(pygame.image.load( 146. fullScreen = False
"skImages/rightLegzero.png").convert_alpha(),angle),(360,360)) if not debug :
102. for angle in range(-90,90,5)] 147. pygame.display.toggle_fullscreen()
103. rightLegPlot = rightLegFrames[0].get_width()/2 148. fullScreen = True
104. 149. pygame.display.set_caption("Danse Macabre")
105. print"creating thighs" 150. pygame.event.set_allowed(None)
106. thighFrames = [ pygame.transform.smoothscale( 151. pygame.event.set_allowed([pygame.KEYDOWN,pygame.QUIT])
rot_center(pygame.image.load( background = pygame.transform.smoothscale(pygame.image.
"skImages/thighzero.png").convert_alpha(),angle),(267,267)) 152. load("skImages/background.jpg"),(xs,ys))
107. for angle in range(100,-100,-5)] 153.
108. thighPlot = thighFrames[0].get_width()/2 154. def scaleReading(reading,band,side):
109. dYthigh = [ 101.56*math.cos(math.radians( 155. reading -= noiseFloor[side][band]
angle)) for angle in range(100,-100,-5)] 156. if reading <0 :
110. dXthigh = [ 157. reading = 0
101.56*math.sin(math.radians(angle)) for angle in 158. scaled = (float(reading) / (
111. range(100,-100,-5)] 1024.0 - float(noiseFloor[side][band])))
112. 159. return scaled
113. print"creating arms" 160.
armFramesR = [ pygame.transform.smoothscale( 161. def initGPIO():
rot_center(pygame.image.load( 162. global pinReset,pinClock
114. "skImages/armzero.png").convert_alpha(),angle),(224,224)) 163. pinReset = 23
115. for angle in range(150,-30,-5)] 164. pinClock = 24
116. armPlot = armFramesR[0].get_width()/2 165. try :
117. dYarmR = [ 85.2*math.cos( 166. io.wiringPiSetupGpio()
math.radians(angle)) for angle in range(150,-30,-5)] 167. except :
118. dXarmR = [ 85.2*math.sin( 168. print"start IDLE with 'gksudo idle' from command line"
math.radians(angle)) for angle in range(150,-30,-5)] 169. os._exit(1)
119. armFramesL = [ pygame.transform.flip(armFramesR[i], True,False) 170. io.pinMode(pinReset,1)
120. for i in range(0,36)] 171. io.pinMode(pinClock,1)
121. dYarmL = [ 85.2*math.cos( 172. io.mcp3002Setup(70,0)
math.radians(angle)) for angle in range(150,-30,-5)] 173.
122. dXarmL = [ -85.2*math.sin( 174. def terminate(): # close down the program
math.radians(angle)) for angle in range(150,-30,-5)] 175. print "Closing down please wait"
123. 176. pygame.quit() # close pygame
124. print"creating forearms" 177. os._exit(1)
foreArmFramesL = [ pygame.transform.smoothscale(rot_ 178.
center(pygame.image.load("skImages/forearmzero.png").convert_ 179. def checkForEvent(): # see if we need to quit
125. alpha(),angle),(334,334)) 180. global fullScreen
126. for angle in range(60,240,5)] 181. event = pygame.event.poll()
127. foreArmPlot = foreArmFramesL[0].get_width()/2 182. if event.type == pygame.QUIT :
foreArmFramesR = [ pygame.transform.flip(foreArmFramesL[i], 183. terminate()
128. True,False) 184. if event.type == pygame.KEYDOWN :
129. for i in range(0,36)] 185. if event.key == pygame.K_ESCAPE :
130. 186. terminate()
131. def rot_center(image, angle): 187. if event.key == pygame.K_SPACE:
132. """rotate an image while keeping its center and size""" 188. pygame.display.toggle_fullscreen()
133. orig_rect = image.get_rect() 189. fullScreen = not fullScreen
134. rot_image = pygame.transform.rotate(image, angle) 190. # Main program logic:
135. rot_rect = orig_rect.copy() 191. if __name__ == '__main__':
136. rot_rect.center = rot_image.get_rect().center 192. main()

raspberrypi.org/magpi October 2016 59


Tutorial STEP BY STEP
IOANA CULIC
Ioana is an Internet of Things specialist
and has written several IoT tutorial
books and articles. She focuses
on IoT in education.
wyliodrin.com

BUILD A CAR
MONITORING
SYSTEM
Following on from last issues tutorial, we use a Camera Module
PART 02

Youll to recognise the number plates of the cars passing by


Need ts time to take the previously built traffic >STEP-01
> Wyliodrin
STUDIO
I monitoring system and spice it up by making
it really smart. Well connect it to the internet
Connect the Camera Module
First of all, we will start with the previously built
magpi.cc/1Q5i4il
and, by accessing an open-source image processing system that detects cars passing by using the Hall
> SS441A Hall service, well display the number plate of the detected sensor (see issue 49 of The MagPi). The next step is to
sensor
car. The project is built on top of the one described in connect the camera in order to take a picture of each
> Camera Module the previous issue of the magazine, simply by adding car passing by the sensor.
> 220 resistor the Camera Module. The Raspberry Pi board has a port specially designed
> 162 LCD to connect the camera. Its located between the HDMI
port and the 3.5mm headphone jack. We need to place
> Potentiometer The side of the cable The Camera Module the side of the cable with the silver connections
> Jumper wires with silver connections port is located
faces the HDMI port between the jack towards the HDMI side of the port.
> Breadboard and the HDMI port

>STEP-02
Create an OpenALPR account
For this application, well use a web service in order to
extract the number plate from the pictures taken with
the Pi Camera. The web service is OpenALPR; it allows
us to upload pictures and get details such as the car
model, colour, and licence plate.
In order to use the service, we need to create an
account on openalpr.com, which requires a valid
email address. We have to confirm the email address,
then we can log in and use the service.

Above We use Python code to take a picture of the passing car

60 October 2016 raspberrypi.org/magpi


CAR MONITORING SYSTEM Tutorial

Language
>STREAMS
(NODE-RED)

DOWNLOAD:
magpi.cc/2blRrtf

Top-left Here's the


new code for this
part of the tutorial

Left The previously


created code can
be copied to a
subflow, creating
a new node

Once logged in, we go to Cloud API and check the the camera, then it takes the picture and stores
Cloud API credentials. We will need the secret key it as /home/pi/image.jpg.
later on. The piece of code uses the PiCamera module.
However, this module is not installed on the Pi by
>STEP-03 default. In order to install it, we need to open a
Update the application terminal window and type the following command:
We will start with the streams application that we sudo pip install picamera
created previously.
To make the code more modular, well create our >STEP-05
own new subflow. Go to the Options menu in the top- Recognise the number plate
right of the workspace and select Subflows > Create Once the picture is saved, well access a web service
Subflow. Once the subflow is created, we select the to process it. The read image file node parses the file
edit properties option and name it car passed. We and, further on, sends a message storing the files
also set the number of outputs to 1. contents in a buffer.
The code we have to insert in the subflow is the one Next, we send a POST request to OpenALPR. For this,
created in the previous article, except the counter, we use a function node. There, we store the image file
which is missing. The final behaviour is that each time in a variable under Base64 encoding, then we create a
a car passes, the node outputs a message. new payload consisting of a JSON structure.
The JSON asks for the secret_key and for a list of
>STEP-04 processing tasks you need the service to do. After the
Take a picture of the car payload is created, it goes to the http request node,
The node connected to car passed is a Python node. which will do a POST request at the following address:
Its similar to the function node, but it allows us to api.openalpr.com/v1/recognize.
write code in Python instead of JavaScript. The Python
code initialises the connection to the Pi camera, waits >STEP-06
for five seconds to finish initialising and calibrating Print the number plate
The request returns a JSON structure under a string
format. We use the JSON node to obtain a structure
containing the plate.results property. That is a list
of possible plate numbers, the first element being the
most likely to be correct.
Next, we create a function to extract the first
element of the list and get the plate property. That
is a string representing the plate number. We use the
print function to display it on the LCD.
We can test the prototype by placing a picture of
a number plate in front of the camera, while passing
Above The HTTP request payload must contain the picture file a magnet next to the Hall sensor.

raspberrypi.org/magpi October 2016 61


Tutorial STEP BY STEP
WESLEY ARCHER
Self-taught Raspberry Pi enthusiast,
founder of Raspberry Coulis, and
guide writer for Pi Supply and Cyntech.
raspberrycoulis.co.uk
@RaspberryCoulis

Youll BUILD YOUR OWN


RASPCADE:
Need
> RaspCade

CABINET
designs
(magpi.cc/
21jHT61)

> Access to a
laser cutter

ASSEMBLY!
> Wood glue
(DIY store)

> 2 3-inch, 4,
3W speakers
(ModMyPi.com)

> 8 countersunk
M4 nuts and bolts

> A drill with a In this fourth part of the build, well be showing you how to assemble
countersink
head your laser-cut cabinet as part of your RaspCade home arcade machine
> Various 12.7mm
n the first part of our build, we talked about
I
standoffs
(ModMyPi.com) our custom-designed RaspCade cabinet so
> 2 small jewellery that you could download the designs and laser
box hinges cut your own. In this guide, we will look at this in
more detail and provide an overview of assembling
our RaspCade, so that we can take a giant step towards
playing our retro video games. Well also look at
adding speakers to our RaspCade and mounting all our
kit inside in preparation for the next edition, where
well finally get our arcade machine up and running!

>STEP-01
Our RaspCade designs
Youre going to need a laser-cut RaspCade to get started,
but we designed one so you dont have to. Designed
in Adobe Illustrator and saved as an Encapsulated
PostScript (EPS) file, our RaspCade cabinet is
optimised for online laser cutting services,
so getting your own cabinet is as simple as
downloading our design (magpi.cc/21jHT61)
and then uploading it to your chosen
The cabinet service. Jason Barnett (@boeeerb) at
simply slots
together and is Cyntech kindly helped with our first
held firm with prototype, and we used Just Add Sharks
some strong
wood glue (justaddsharks.co.uk) for our final cut,
which cost us around 15 including delivery.

Weve designed
this cabinet so
>STEP-02
it can be laser Some drilling necessary
cut quickly and To allow for some wiggle room when assembling
without breaking
the bank! the RaspCade, you may have to drill your own
mounting holes to suit. As we used the Qubit case for
the screen, we glued a layer from this to our base, as

62 October 2016 raspberrypi.org/magpi


BUILD YOUR OWN ARCADE MACHINE Tutorial
This is how our base panel looks
when everything has been
mounted in place, including a
layer from the Qubit case we
mentioned in the last edition

The speakers are attached to


the sides of the case

it meant we could mount the LCD driver board and


Pi very easily, but its equally easy to add your own
mounting holes and standoffs. In our build, we used
a small drill bit to add several mounting points on the
base unit, so that we could install standoffs for the
Picade PCB, as well as holes for the two speakers.

>STEP-03
Mounting the speakers >STEP-05 BE PATIENT
Its very easy to mount the speakers, as the ones we Let the glue dry! WHEN
used come with four holes that are ideally suited to M4 The hardest part for us was waiting for the glue to
GLUING!
bolts. After placing our speaker in the correct position dry properly before starting the next panel! However,
first, we marked the positions for our holes with a its worth waiting to be sure that the glue has dried Think where
you will
pencil, drilled the holes, and then used the countersink properly, otherwise it could ruin your build. When we put your
bit to countersink the hole so that the bolt would sit added the top panel, we tied string around the sides RaspCade
flush with the cabinet when assembled. It was then and placed a small weight on top (a tin of beans would when the glue
is drying and
very simple to solder the positive and negative wires to do!), to hold the panel together whilst the glue dried. dont mess
each speaker, ready to connect to the Picade PCB. Its This meant that we had a perfectly square cabinet with it for at
useful to put some coloured electrical tape around the frame once everything had dried, and now we could least 24 hours!
positive wires, so you can find them quickly later. add some internal parts, including our Raspberry Pi!

>STEP-04 >STEP-06
Assembling the cabinet Connect your wires
Our RaspCade design includes simple box joints, so Before gluing all the panels together, we found it easier DONT
assembling the cabinet is pretty straightforward. We to put our electronics in place first. We connected our OVERTIGHTEN
recommend doing a test run before gluing together, buttons, joystick, and speaker wires to the Picade PCB and
SCREWS
just so you are confident you get each panel the right then screwed the Picade PCB onto the standoffs so it was Our cabinet
way round! Using a strong wood glue, start by gluing secured inside. We then glued the front panel in place, is made from
one of the side panels to the base unit and then let then the joystick panel, and then the screen, ensuring MDF, so dont
overtighten
that dry. We propped ours against a wall whilst the we waited for the glue to dry each time. Lastly, we added any screws,
glue dried (which can take 24 hours) to ensure it was two small jewellery box hinges to the back panel and otherwise you
held in the correct position. We then added the other a magnetic catch, so we could get to the insides of our could damage
the wood.
side panel, repeating the same process. RaspCade quickly and easily if needed!

raspberrypi.org/magpi October 2016 63


F.A.Q. YOUR QUESTIONS ANSWERED

NEED A
FREQUENTLY PROBLEM
SOLVED?
ASKED QUESTIONS Email magpi@raspberrypi.org or
find us on raspberrypi.org/forums
to feature in a future issue.

Your technical hardware and software problems solved

BUYING A WHERE CAN I BUY A PI ZERO?


Online

RASPBERRY PI
The Raspberry Pi Zero is stocked in a few places
online, such as Pimoroni and The Pi Hut in the
UK, and Adafruit in the US. Canakit in Canada has
recently begun selling them as well. Check stock on
whereismypizero.com when you want to buy one.
WHERE CAN I BUY A RASPBERRY PI?
In store
Online So far, Micro Centers in the US are the only places you
Most versions of the Raspberry Pi are available can buy the Pi Zero in person. This may change in the
online, from many electronics and big online stores. future now that supply is keeping up with demand,
You canbuy them on Amazon, hobbyist stores like but for now youll have to find your local Micro Center
Pimoroni, or go to electronics providers such as to get one: magpi.cc/2cies2o.
Element14 and RS Components.
Subscribe to The MagPi
In store If you buy a six- or twelve-month print subscription
Some big electronics stores sell Raspberry Pi hardware to The MagPi, you will receive a Pi Zero v1.3 (the one
in-store. In the UK, this includes Maplin; in the USA, with a camera port) for free, along with a bundle of
places like Micro Center are your best bet. You can also cables to use it. Read more about the offer on page 66.
get them at most Raspberry Jams with merch tables.

What does the Raspberry Pi come with? WHERE CAN I BUY ACCESSORIES?
It depends where you buy it from, but it will either be

Below The brand


the core board with no accessories, or you could get a Raspberry Pi add-ons
new official starter case bundle or even a full kit bundle to get you started. Official HATs, cameras, and other add-ons for
kit comes with They all vary in cost, of course. the Raspberry Pi can be purchased from any good
everything needed
Raspberry Pi hobby website, such as Pimoroni, The Pi
Hut, or Adafruit. You can also get them from official Pi
distributors Element14 and RS Components.

Electronics components
While components and bits you need for electronics
are available at Pi hobby sites, you can also get them
from any electronics supplier or store that specialises
in them. Breadboards and components that work with
the GPIO pins are standard parts.

Input devices
The Raspberry Pi will work with any standard USB
mouse and keyboard combo, along with most wireless
versions that use a dongle or a Bluetooth connection.
If you have a computer at home, you can always borrow
the parts from there!

64 October 2016 raspberrypi.org/magpi


YOUR QUESTIONS ANSWERED F.A.Q.

FROM THE RASPBERRY PI FAQ


RASPBERRYPI.ORG/HELP
What is the user name and password The Model A+ is a low-cost variant of the
for the Raspberry Pi? Raspberry Pi. It has one USB port, 40 GPIO pins,
The default user name for the standard Raspbian and no Ethernet port. The original version came
operating system is pi, and the default password is with 256MB of RAM, but the new model (launched
raspberry. If this doesn't work, check the information in August 2016) has 512MB. The Model B+ is the
about your specific distro on the downloads page: final revision of the original Raspberry Pi. It has
raspberrypi.org/downloads. 512MB RAM, four USB ports, 40 GPIO pins, and an
Ethernet port. In February 2015, it was superseded
Why does nothing happen when I type in my by the Pi2 ModelB, the second generation of
password? Did my Raspberry Pi freeze? the Raspberry Pi. The Pi 2 shares many specs
To protect your information, Linux doesn't display with the Pi 1 B+, but uses a 900MHz quad-core
anything when typing in passwords in the Bash ARM Cortex-A7 CPU and has 1GB RAM. The Pi 2
prompt or the terminal. As long as you were able to is completely compatible with first-generation
see the user name being typed in, your keyboard boards. The Pi 3 Model B was launched in February
is working correctly. 2016; it uses a 1.2GHz 64-bit quad-core ARM
Cortex-A53 CPU, has 1GB RAM, plus integrated
What are the differences between models? 802.11n wireless LAN and Bluetooth 4.1. Finally, the
These are the current models of the Raspberry Pi Pi Zero is half the size of a Model A+, with a 1GHz
available: the Pi 2 Model B, the Pi 3 Model B, the Pi Zero, single-core CPU and 512MB RAM, plus mini-HDMI
and the Pi 1 Model B+ and A+. and micro-USB ports (requiring adapters).

THE MAGPI APP


Having trouble with The MagPi on the App Store or Google Play?
Here are your most common questions answered:

How do I find The MagPi on Google Play or the App Store?


All you have to do is go to the search bar and type The MagPi
or Raspberry Pi to find us.

Ive subscribed to the digital edition and I cant sign


in to restore my purchases. Please help!
Since your The MagPi purchases are linked to your Google or
Apple accounts, theres no need to sign in at all. If youd like to
redownload your purchases on your current device, or make your
purchases available on other devices, all you need to do is press
Subscribe on the home screen, then Restore Purchases on the
next screen.

How can I search the digital magazine for keywords?


Finding direct references is really easy with The MagPi app: all you
have to do is tap the screen to get the apps GUI to show, and then
press the small magnifying glass icon in the top-right corner of the
screen. Just type in your search term to find the relevant results.

raspberrypi.org/magpi October 2016 65


FREE PI ZERO!
Tutorial WALKTHROUGH

Subscribe in print for six or 12 months to receive this stunning free gift

Subscribe today & receive:


A free Pi Zero v1.3 (the latest model)
A free Camera Module connector
A free USB & HDMI cable bundle
Delivered with your first issue!

Other benefits:
Save up to 25% on the price
Free delivery to your door
Exclusive Pi offers & discounts
Get every issue first (before stores)

SAVE
UP TO

25%

66 October 2016 raspberrypi.org/magpi


SUBSCRIPTION FORM
Tutorial
Pricing
YES! Id like to subscribe to The MagPi magazine & save money

This subscription is: n For me n A gift for someone* Mag#50

YOUR DETAILS Mr n Mrs n Miss n Ms n


Get six issues: First name ............................................ Surname ........................................................

Address ........................................................................................................................

30 (UK) ....................................................................................................................................

Postcode ............................................... Email .............................................................

45 (EU)
Daytime phone ..................................... Mobile ............................................................

*If giving The MagPi as a gift, please complete both your own details (above) and the recipients (below).

n n n n
$69 (USA)
GIFT RECIPIENTS DETAILS ONLY Mr Mrs Miss Ms

First name ............................................ Surname ........................................................

Address ........................................................................................................................

50 (Rest of World) Postcode .................................................... Email ..................................................................

PAYMENT OPTIONS

Subscribe for a year: 1 DIRECT DEBIT PAYMENT 12.99 every 3 issues (UK only)
Instruction to your bank or building society to pay by Direct Debit

Please fill in the form and send to:


The MagPi, Select Publisher Services Ltd, Service user number 8 3 8 7 7 3

55 (UK) PO Box 6337, Bournemouth BH1 9EH

Name and full postal address of your bank or building society:

80 (EU)
To: The Manager Bank/building society .......................................................................

Address ...........................................................................................................................

........................................................................................................................................

$129 (USA) ..................................................................................... Postcode ....................................

Name(s) of account holder(s) ............................................................................................

90 (Rest of World) n n n n n n Account number n n n n n n n n


Branch sort code

Reference n n n n n n n n n n n n n n n n n (Official use only)


Instruction to your bank or building society
Please pay Select Publisher Services Ltd Direct Debits from the account detailed in this instruction
subject to the safeguards assured by the Direct Debit Guarantee. I understand that this instruction

Get three issues: may remain with Select Publisher Services Ltd and, if so, details will be passed electronically to my
bank/building society.

n n / n n/ n n
12.99 (UK) (Direct Debit)
Signature ..................................................................... Date

Banks and building societies may not accept Direct Debit instructions for some types of account.

$37.50 (US) (quarterly) SUBSCRIPTION PRICING WHEN PAYING BY CHEQUE OR CREDIT/DEBIT CARD

6 ISSUES n UK 30 n Europe 45 n Rest of World 50


12 ISSUES n UK 55 n Europe 80 n Rest of World 90
How to subscribe: 2 CHEQUE
I enclose a cheque for ............................... (made payable to Select Publisher Services Ltd)

3 CREDIT/DEBIT CARD n Visa n MasterCard n Maestro n Switch


magpi.cc/Subs1 (UK / ROW)
Card number nnnnnnnnnnnnnnnn
Expiry date n n n n Valid from n n n n (if shown)
imsnews.com/magpi (USA) Issue number n n (if shown) Security number n n n
(last 3 digits on the back of the card)

Call +44(0)1202 586848 (UK/ROW) Signature ..................................................................... Date n n / n n/ n n

Call 800 428 3003 (USA)


I would like my subscription to begin from issue ............................................ (month + year)

RETURN THIS FORM TO:


MagPi Magazine Subscriptions, Select Publisher Services Ltd, PO Box 6337,
Bournemouth BH1 9EH
Please tick this box if you DO NOT want to receive any other information
from Select Publisher Services Ltd.
Please tick this box if you DO NOT want to receive any other information
from other companies.
Please tick this box if you DO NOT want to subscribe to The MagPi newsletter.

raspberrypi.org/magpi October 2016 67


Feature

HOW TO
BOOT YOUR
RASPBERRY PI

USB OR
WITH

ETHERNET
Discover two new ways to start up your Raspberry Pi
he trusty SD card has served us well, bless it [the Raspberry Pi] to search for bootcode.bin on an
T it. But now there are two new options:
USB and Ethernet.
attached USB drive.
As well as being easier to source, USB flash drives
Booting from the SD card isnt going away, so you are slightly cheaper than microSD cards, especially at
can still use it. But its worth experimenting with higher capacity.
these new features, as theyre both very interesting. The second [mode] to implement was DHCP/TFTP
We caught up with Gordon Hollingworth, boot. This allows the Pi to be booted over a network,
Raspberry Pis director of engineering. He helped continues Gordon.
explain whats going on. I began writing the changes to the boot ROM code
Inside the processor chip theres a little bit of around twelve months ago, but in total the work
ROM (read-only memory) which contains some required took around three to four months, he
software to begin the boot process, explains reveals. The main difficulty is having to implement a
Gordon. The boot process is what happens when complete USB host, including being able to enumerate
you power up a Raspberry Pi; its the instructions hubs and talk to all the devices in the USB network. It
hardwired into the computer to look for attached also needed to implement the USB SCSI protocol and
disks and start loading an operating system. the Ethernet setup, as well as all the network layer for
In the past, the main boot mode supported was UDP, DHCP, TFTP, and ARP protocols. All of that had to
by SD card, says Gordon. So when the Raspberry Pi be implemented in 32kB.
was powered up, it looked for an SD card and looked We think Gordons done a sterling job of fitting
for a special file (called bootcode.bin) on the FAT not one, but three different boot processes in the
partition of the card. small space allocated to the boot ROM. So lets take
Ive added a few more boot modes, he tells us. advantage of that effort and discover how to boot
The first is a mass storage device (MSD) that allows from USB and Ethernet.

68 October 2016 raspberrypi.org/magpi


BOOT YOUR RASPBERRY PI Feature

RASPBERRY PI 3
Youll need a Raspberry Pi 3 to take advantage of the new boot modes.
The boot code update is stored in the BCM2837 (the system on a chip)
and isnt included with other models of Raspberry Pi.

SD CARD BOOT ETHERNET BOOT USB BOOT


A microSD card is currently used An Ethernet cable is used to The operating system can be loaded onto
to boot a Raspberry Pi. You can connect your Raspberry Pi to the USB flash drive and used to start up the
still boot the Raspberry Pi from a network. Now it can load the Raspberry Pi. Youll need an SD card to set
the SD card, but now you have operating system image directly up the drive (for now), but it then allows for
two more options available. from the network. SD card-free booting.

raspberrypi.org/magpi October 2016 69


Feature

BOOTING
FROM USB
Turn a USB flash drive into a boot drive and start up your Raspberry Pi

Youll
n this tutorial were going to look at booting of /boot/config.txt (you can check it with cat
I a Raspberry Pi 3 using a USB flash drive. /boot/config.txt). Reboot the Pi with sudo reboot,
Need You can use any MSD (mass storage
device) to boot the Raspberry Pi, which includes USB
then check that the OTP has been programmed with:

> Raspberry Pi 3 flash drives and hard drives. vcgencmd otp_dump | grep 17:
> USB drive
You will, however, need a microSD card to set 17:3020000a
up the Raspberry Pi in the first instance. Start by
> microSD card
flashing a microSD card with Raspbian. Ensure the output 0x3020000a is correct.
If youre running Raspbian Lite, you will need to
run an rpi-update: Prepare the USB storage device
Attach a USB storage device (which will be
sudo apt-get update; sudo apt-get install completely erased) to the Raspberry Pi.
rpi-update Rather than downloading the Raspbian image
again, we will copy it from the SD card still in the
Now you need to switch the update branch from Raspberry Pi. The source device (SD card) will be
the default (master) to next: /dev/mmcblk0 and the destination device (USB disk)
should be /dev/sda, assuming you have no other USB
sudo BRANCH=next rpi-update devices connected.

Then we need to enable USB boot mode by sudo umount /dev/sda


adjusting the config.txt file:
Note the command umount, not unmount.
Below Here we
have a Raspberry echo program_usb_boot_mode=1 | sudo tee -a Next, you need to open Parted, pointing to the drive:
Pi running just /boot/config.txt
an attached USB
drive mounted sudo parted /dev/sda
on /dev/sda This adds program_usb_boot_mode=1 to the end
Youll see a Welcome to GNU Parted! message.
Youll also see (parted) instead of the $ symbol on the
command line, indicating that youre in Parted. Enter:

mktable msdos

Youll see: Warning: The existing disk label


on /dev/sda will be destroyed and all data on
this disk will be lost. Do you want to continue?
Enter yes.
Now create the two partitions: a FAT32 taking up
100MB of space, the second ext4 taking up the rest.

mkpart primary fat32 0% 100M


mkpart primary ext4 100M 100%

Use print to view the details of the partitions.

70 October 2016 raspberrypi.org/magpi


BOOT YOUR RASPBERRY PI Feature
Ours says: Now regenerate your SSH host keys:
Model: UFD 2.0 Silicon-Power8G (scsi)
Disk /dev/sda: 8054MB cd /mnt/target
Sector size (logical/physical): 512B/512B sudo mount --bind /dev dev
Partition Table: msdos sudo mount --bind /sys sys
Disk Flags: sudo mount --bind /proc proc
Number 1 2 sudo chroot /mnt/target
Start 1049kB 99.6MB rm /etc/ssh/ssh_host*
End 99.6MB 8054MB dpkg-reconfigure openssh-server
Size 98.6MB 7954MB exit
Type primary primary sudo umount dev
File system fat32 ext4 sudo umount sys
Flags lba lba sudo umount proc

Your Parted print output should look similar to the Edit /boot/cmdline.txt so that it uses the USB storage
one above. Create the boot and root file systems: device as the root file system instead of the SD card:

sudo mkfs.vfat -n BOOT -F 32 /dev/sda1 sudo sed -i "s,root=/dev/mmcblk0p2,root=/


sudo mkfs.ext4 /dev/sda2 dev/sda2," /mnt/target/boot/cmdline.txt

Our disk is formatted. Its time to mount the target The same needs to be done for fstab:
file systems on sda1 and sda2:
sudo sed -i "s,/dev/mmcblk0p,/dev/sda," /
sudo mkdir /mnt/target mnt/target/etc/fstab
sudo mount /dev/sda2 /mnt/target/
sudo mkdir /mnt/target/boot Finally, unmount the target file systems, and power
sudo mount /dev/sda1 /mnt/target/boot/ off the Pi:

Now we need to copy the running Raspbian system cd ~


to the target. Were going to download a program sudo umount /mnt/target/boot
called rsync and use it to copy Raspbian across. sudo umount /mnt/target
sudo poweroff
sudo apt-get update; sudo apt-get install rsync
sudo rsync -ax --progress / /boot /mnt/target Disconnect the power supply from the Pi, remove
the SD card, and reconnect the power supply.
The files will be displayed on the screen as they are If all has gone well, the Raspberry Pi will begin
copied across. The copy process may take some time. to boot after a few seconds.

USB BOOT OVERVIEW

>STEP-01 SWITCH TO NEXT >STEP-02 COPY RASPBIAN >STEP-03 UPDATE SSH


First, you need to install Raspbian using Next, you attach a USB flash drive and Finally, you need to regenerate the SSH keys on
an SD card and open it on a Raspberry use Parted to format it and create two your USB flash drive by deleting the old files and
Pi 3. Switch updates from the master partitions: FAT32 for booting and ext4 for reconfiguring openssh-server. OpenSSH is used
branch to the next branch. This enables Raspbian. Then use rsync to duplicate the to secure Linux, and this will enable the new flash
you to run the beta features, including the entire Raspbian image on the SD card to drive to run. Now when you reboot the Raspberry Pi,
new boot modes. the flash drive. you can boot directly from the USB flash drive.

raspberrypi.org/magpi October 2016 71


Feature

Youll
Need
ETHERNET
BOOT
> Two Raspberry
Pi boards (one a
Raspberry Pi 3)

> Ethernet cable Discover how to boot a Raspberry


> 16GB (or larger) Pi device (or several boards) over
microSD card
a network using network boot

he third available boot mode for the We use the network booting with our test
T Raspberry Pi 3 is network boot. With this
feature enabled, you can install Raspberry
subsystem, explains Gordon. This allows us to
completely reboot a Pi with no reliance on old boot
Pi on one computer and then use it to boot another software. So if they break something during testing,
Raspberry Pi on the same network. they can just reload the operating system.
In particular, you need two boards. One acts as Since you can easily create a shared filing
the server (booted using a microSD card containing system, he continues, it makes it very easy
Raspbian); the other is the client which will boot into to add Raspberry Pis to a server to provide a
Raspbian without any attached storage device. whole network of Raspberry Pis, with no fiddly
Only one of the Raspberry Pi devices (the server) SD cards.
requires a microSD card, although it has to be at
least 16GB capacity. This is because it must carry Network boot your Raspberry Pi
the image of Raspbian used to boot the board, This tutorial explains how to set up a simple DHCP /
and another image of Raspbian used to boot the TFTP server which will allow you to boot a Raspberry
computers on the network. Pi 3 from the network.
The big advantage with network booting, says This assumes you have an existing home network
Gordon Hollingworth, Raspberry Pis director of and want to use a Raspberry Pi for the server.
engineering, is with a small penalty for booting Install Raspbian Lite (or the full OS if you want)
time, you can boot a whole classroom of Raspberry from the Downloads page onto an SD card, using
Pi boards from a single server, with absolutely no Win32DiskImager if youre on Windows, or dd if
programming of SD cards. youre on Linux/Mac.

Right Dont forget


to expand the file
system so you have
enough space for
a cloned copy of
Raspbian (used by
the client)

72 October 2016 raspberrypi.org/magpi


BOOT YOUR RASPBERRY PI Feature

CLIENT
MICRO The client is the

SD CARD board booted from


the network without
Youll need a a microSD card
microSD card inserted. Instead, it
with at least 16GB loads the operating
capacity in the Pi system (and saves
acting as a server. files) from and to
the microSD card
in the server. The
client must be a
Raspberry Pi 3.

SERVER
The server is another
Raspberry Pi on the
network (it can be
any model). It has a
microSD card (16GB
or greater) containing
a modified version
of Raspbian. It runs
the server software, ETHERNET CABLE
and boots other Both Raspberry Pi devices must be connected to the same
Raspberry Pi devices network. The server waits for a connection from the client,
over the network. and then loads the operating system over the network.

Place the microSD card into the client Raspberry Pi The client configuration is almost done. The final
(the Raspberry Pi 3 that you intend to boot over the thing to do is to remove the program_usb_boot_
network and without the card in future). mode line from config.txt:
Just as with USB boot, youll first need to prepare
the /boot directory with experimental boot files. sudo nano /boot/config.txt
If youre using Raspbian Lite, you need to run an
rpi-update before you can use it: Scroll down to the end and remove the line marked
program_usb_boot_mode=1. Press CTRL+O and hit
sudo apt-get update; sudo apt-get install RETURN to save the file, then CTRL+X to return to the
rpi-update command line.
sudo BRANCH=next rpi-update Finally, shut down the client Pi with sudo poweroff.

Then enable USB boot mode with: Server configuration


Remove the microSD card and transfer it to the server
echo program_usb_boot_mode=1 | sudo tee -a / Raspberry Pi. Power it up and immediately expand the
boot/config.txt root file system to take up the entire SD card. Open
Menu > Preferences > Raspberry Pi Configuration
This adds program_usb_boot_mode=1 to the end and click Expand Filesystem. Click OK > Yes to reboot
of /boot/config.txt. Reboot the Raspberry Pi: the Pi. Alternatively, use sudo raspi-config.
The client Raspberry Pi needs a root file system
sudo reboot to boot from, which has to be separate from the file
system being used by the server. So before we do
Once the client Pi has rebooted, check that the anything else on the server, were going to make a full
OTP (one-time programmable) memory has been copy of its file system and put it into a directory called
programmed using: /nfs/client1.

vcgencmd otp_dump | grep 17: sudo mkdir -p /nfs/client1


17:3020000a sudo apt-get install rsync
sudo rsync -xa --progress --exclude /nfs /
Ensure the output is 3020000a. /nfs/client1

raspberrypi.org/magpi October 2016 73


Feature
Regenerate the SSH host keys on the client file Configuring the server
system by chrooting into it: Now were going to configure a static network
address on your server Raspberry Pi using sudo nano
cd /nfs/client1 /etc/network/interfaces. Change the line iface
sudo mount --bind /dev dev eth0 inet manual so that the address is the inet you
sudo mount --bind /sys sys wrote down, the netmask address is 255.255.255.0,
sudo mount --bind /proc proc and the gateway address is the number received
sudo chroot . using ip route. Ours looks like this:
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server auto eth0
exit iface eth0 inet static
sudo umount dev address 192.168.0.197
sudo umount sys netmask 255.255.255.0
sudo umount proc gateway 192.168.0.1

Now you need to find the settings of your local Use CTRL+O, RETURN, and CTRL+X to save the
network. First, locate the address of your router text file and return to the command line.
(or gateway), which you can find with: Next, we disable the DHCP client daemon and
switch to standard Debian networking:
ip route | grep default | awk '{print $3}'
sudo systemctl disable dhcpcd
This will be a four-digit number, and typically it sudo systemctl enable networking
ends in 1. Ours is 192.168.0.1.
Next, we need to find the IP address of our server Reboot for the changes to take effect:
Raspberry Pi on the network. This will be the same
address, but with a different last number. sudo reboot

ip -4 addr show dev eth0 | grep inet At this point, you wont have working DNS, so
youll need to add the server you noted down before
This should give an output like: to /etc/resolv.conf. Do this by using the following
command, where the IP address is that of the router/
inet 192.168.0.197/24 brd 192.168.0.255 gateway address you found earlier:
scope global eth0
echo "nameserver 192.168.0.1" | sudo tee -a
The first address (inet) is the IP address of your /etc/resolv.conf
server Pi on the network. Ours is device 197. The
second part (the brd) is the network size (the Then make the file immutable (because otherwise
numberof total devices allowed on the network, dnsmasq will interfere) with the following command:
which is almost always 255).
The part after the slash is the network size. Its sudo chattr +i /etc/resolv.conf
highly likely that yours will be a /24. Write down
boththe inet and brd numbers. Next, were going to install some software we need:
Finally, note down the address of your DNS server,
which is the same address as your gateway. You can sudo apt-get update
find this with: sudo apt-get install dnsmasq tcpdump

cat /etc/resolv.conf Stop dnsmasq breaking DNS resolving:

You will see nameserver followed by another sudo rm /etc/resolvconf/update.d/dnsmasq


number. You may have more than one nameserver sudo reboot
address. We get:
Now start tcpdump so you can search for DHCP
nameserver 194.168.4.100 packets from the client Raspberry Pi:
nameserver 194.168.8.100
sudo tcpdump -i eth0 port bootpc
Write down the nameserver address(es).
Connect the client Raspberry Pi to your network

74 October 2016 raspberrypi.org/magpi


BOOT YOUR RASPBERRY PI Feature
and power it on. Check that the LEDs illuminate on the
client after around 10 seconds, then you should get a
packet from the client, BOOTP/DHCP, Request from ...
It will have lines that look like:

IP 0.0.0.0.bootpc > 255.255.255.255.bootps:


BOOTP/DHCP, Request from b8:27:eb...

Now we need to modify the dnsmasq configuration


to enable DHCP to reply to the device. Press CTRL+C
on the keyboard to exit the tcpdump program, then
type the following:

sudo echo | sudo tee /etc/dnsmasq.conf


sudo nano /etc/dnsmasq.conf

Replace the contents of dnsmasq.conf with:

port=0
dhcp-range=192.168.0.255,proxy
log-dhcp Set up root Above Note network
settings when you
enable-tftp We now have a Raspberry Pi that boots until it tries set up the client.
tftp-root=/tftpboot toload a root file system (which it doesnt have). These need to be
added to the server
pxe-service=0,"Raspberry Pi Boot" Allwe have to do to get this working is to export the so it can locate
/nfs/client1 file system we created earlier: your client Pi on
thenetwork
Make sure the first address of the dhcp-range line
is the broadcast address (brd) number you noted down sudo apt-get install nfs-kernel-server
earlier (the number typically ending in 255). echo "/nfs/client1 *(rw,sync,no_subtree_
Now create a /tftpboot directory: check,no_root_squash)" | sudo tee -a /etc/
exports
sudo mkdir /tftpboot sudo systemctl enable rpcbind
sudo chmod 777 /tftpboot sudo systemctl restart rpcbind
sudo systemctl enable dnsmasq.service sudo systemctl enable nfs-kernel-server
sudo systemctl restart dnsmasq.service sudo systemctl restart nfs-kernel-server

Now monitor the dnsmasq log: We need to edit the cmdline.txt file:

tail -f /var/log/daemon.log sudo nano /tftpboot/cmdline.txt

You should see several lines like this: From root= onwards, replace it with:

raspberrypi dnsmasq-tftp[1903]: file root=/dev/nfs nfsroot=192.168.0.197:/


/tftpboot/bootcode.bin not found nfs/client1 rw ip=dhcp rootwait
elevator=deadline
Next, youll need to copy bootcode.bin and start.elf
into the /tftpboot directory; you should be able to do You should substitute the IP address here with the
this by just copying the files from /boot, since they are inet address you noted down earlier (found using ip
the right ones. We need a kernel, so we might as well -4 addr show dev eth0 | grep inet).
copy the entire boot directory. Finally, enter:
First, use CTRL+Z to exit the monitoring state. Then
type the following: sudo nano /nfs/client1/etc/fstab

cp -r /boot/* /tftpboot Remove the /dev/mmcblkp1 and p2 lines (only


proc should be left).
Restart dnsmasq for good measure: Good luck! If it doesnt boot first time, keep trying.
It can take a minute or so for the Raspberry Pi to boot,
sudo systemctl restart dnsmasq so be patient.

raspberrypi.org/magpi October 2016 75


Review SUGRU REBEL TECH KIT

Maker
Says
Stick it.
Shape it. It
turns into
rubber
Sugru

SUGRU REBEL
TECH KIT Billed as mouldable glue, is Sugrus new Rebel Tech Kit
the ultimate introduction for makers and tinkerers?

Related
ugru has long struggled to and gizmos, rather than anyone involves 3D printing a mould which
S make an impact outside of
maker circles. Its original
looking to fix a leaky tap or make
a sieve more comfortable to use.
can be used to shape Sugru cable
strain-relief grommets but each
OOGOO incarnation was billed as soft- Inside, the kit follows the is clearly detailed, though perhaps
Created by
touch silicone rubber that moulds existing formula: four individual a bit briefly given the limit of two
mixing silicone
caulk with corn and sets permanently, a somewhat sachets of Sugru in white, black, pages per project.
starch, Oogoo is wordy but accurate summary of grey, and red are housed in a Flicking through the booklet
a DIY alternative
its capabilities. Nowadays, that neat little reusable tin, as is a small gives an insight into the various
to Sugru which
can be made in has been condensed to mouldable plectrum which can aid in the ways in which Sugru can enhance
volume for very glue, which still somehow fails to moulding and shaping process. your existing technology.
little money.
quickly capture the attention and Its the bundled booklet, Showcased fixes, as the Sugru
get across just how useful Sugru though, thats the real star of community terms them, include
can be in a variety of situations. the show. Printed in full colour, hanging media playback boxes
Thats where, its creators hope, the guide book runs through on the back of TVs, customising
the Rebel Tech Kit comes in. 14 individual projects to help console gamepads, creating a
Created following the success of showcase the capabilities of Sugru. hook on which to hang your
the Home Hacks Made Easy kit, the Theres nothing particularly headphones, and even adding
Varies
Rebel Tech Kit is designed to appeal groundbreaking the most multicoloured bumpers to an old
magpi.cc/2cCL9fg
to those who prefer their gadgets advanced of the listed projects digital camera to make it suitable

76 October 2016 raspberrypi.org/magpi


SUGRU REBEL TECH KIT Review
sugru.com

10 / $15

Above The handy guide shows you the many different ways you can use Sugru

for kids use; though the latter, Theres a value concern to raise,
sadly, requires far more Sugru than too. At 10/$15, the kit costs nearly
is provided in the kit. as much as an eight-pack of Sugru
The bundled sachets of Sugru (12.99/$22) while providing less
are used like any other: wash than half the raw material. Yes,
your hands; cut open the foil the booklet is of a particularly
sachet and remove the Sugru, high quality and the tin is nice too,
which has a texture slightly but the Sugru website and regular
softer than Blu-Tack; knead newsletter both include far more
the Sugru between your fingers, project ideas than the booklet,
mixing multiple packets together while the tins usefulness is limited
if you want a different colour or a by the advice to keep unused
higher volume of Sugru; press the sachets of Sugru in the fridge to
Sugru against the surface to be extend their shelf life. Those who
covered, or between two surfaces do wish to carry sachets of Sugru
if youre taking the mouldable in their bag or pocket using the tin
glue tag line to heart; and finish are, of course, free to do so, but can
by smoothing the Sugru using tools expect to be replacing unused but
or your fingers, both wetted with stale sachets as a result.
soapy water. After around a day, The Rebel Tech Kits true
the Blu-Tack texture has given focus lies in two areas: as a
way to a firm yet flexible rubber gift, and as an introduction.
texture, with strong adhesion to As a gift its a great bundle: the
the surface on which it dried. inclusion of the tin, regardless
Its here that the first issue of its questionable utility, raises
becomes apparent: Sugru is quite what would otherwise be a fairly
difficult to remove from your utilitarian collection of mouldable Last word
fingers, and the dyes used can glue into something worthy of a
The Sugru Rebel Tech Kit is a fantastic idea,
stain. If you follow the bundled stocking filler. As an introduction
and the booklet makes a great introduction
instructions properly and rub your to Sugru, the booklet fires up the
to its use. Better value can be found, however,
hands down with a paper towel imagination without the need to
in buying a standard multipack and browsing
before applying soap and water, launch a web browser, though the
projects on the website.
youll find it easier, but it can still four Sugru packs included will
take considerable scrubbing before likely be quickly used up in the
youre properly clean. initial burst of enthusiasm.

raspberrypi.org/magpi October 2016 77


Review IOT PHAT
magpi.cc/2cl06BV

10 / $13

Maker
Says
Provides
WiFi and
Bluetooth
connectivity
for the
Raspberry Pi
Red Bear

IOT PHAT
An easy way to add WiFi and Bluetooth to your Pi Zero
ne of the best new While on our early model we board antenna were fine, but can
O features of the Raspberry
Pi 3 is its built-in
needed to update the pHATs
firmware via several terminal
be improved by adding an optional
external antenna kit ($9/7) if
wireless LAN and Bluetooth. commands to get more stable needed. As the pHAT only uses
Wouldnt it be great to have the WiFi and functional Bluetooth, 15 GPIO pins and leaves 11 free,
same convenience on a Pi Zero any new boards shipped should including the I2C and SPI pins (see

Related
(and other Pi models)? Thats already have this pre-installed and magpi.cc/2ckXvYH for details),
the thinking behind Red Bears so work perfectly from the start. its possible to stack it on top of
IoT pHAT. When mounted on One caveat is that, at the time of most other add-on boards, such
OFFICIAL the GPIO pins, this Zero-size writing, youll still need to add a as the Enviro pHAT or Analog
WIFI board provides WiFi (802.11bgn line to the /boot/config.txt file Zero, equipped with an extra-long
DONGLE / 2.4GHz) and Bluetooth (4.1 and to set the UART clock to 48MHz stacking header.
Youll need
BLE) connectivity. So you dont to activate Bluetooth, but this is
Last word
a USB OTG
adapter to need to use a dongle plugged into due to be added to the next official
plug it into
the Pi Zeros solitary data micro- Raspbian image. Once Bluetooth
the Pi Zero, The IoT pHAT is a neat and
but it provides USB port via a USB OTG adapter. is working, you can pair devices
convenient way to add WiFi
reliable WiFi The IoT pHAT is pretty such as a keyboard, mouse, and
connectivity, and Bluetooth connectivity
much plug-and-play, coming gamepad via the desktop panel
though not to your Pi Zero, while freeing
Bluetooth. pre-soldered with a 40-pin icon or command line, as usual.
up the data port. Using the
female header. Upon booting In our tests, the IoT pHAT
same wireless radio chip as
up, the Linux kernel reads the provided reliable and fast the Pi 3 results in reliable
configuration from the on-board connections for both WiFi and signal strength and quality
EEPROM and turns on the WiFi Bluetooth, which is hardly via an on-board or optional
driver. You can then connect to surprising since it uses the same external antenna.
your wireless router as usual, Broadcom 43438 wireless radio
6 / $8
via the desktop panel icon or chip used in the Pi 3. The signal
magpi.cc/2cl1btk
command line. strength and quality from the on-

78 October 2016 raspberrypi.org/magpi


MICRO DOT PHAT Review
magpi.cc/2cfq7Ob

22 / $29

Maker
Says
An
unashamedly
old-school
LED matrix
display board
Pimoroni

MICRO DOT PHAT A versatile mini LED display with retro appeal
he LTP-305 LED matrices Dots own Python library, however, this is a very versatile
T used with the Micro Dot
pHAT boast a substantial
plus optional example scripts,
although for some reason we
retro-style display and certainly
a cut above the standard seven-
heritage, having been introduced ended up having to download segment alternative. And since
in 1971 by Texas Instruments. Now them manually. Running the each pair of matrices is driven
manufactured by Lite-On, they flash.py script is recommended by an IS31FL3730 chip, talking to
come in green and red varieties first, to check all the pixels are the Pi via I2C on addresses 0x61,
and feature 57 pixels plus a working. Other code examples 0x62, and 0x63, you should be
decimal point. Up to six can be demonstrate the displays able to use the display alongside
mounted on the Micro Dot pHAT, considerable capabilities and many other boards, such
included in the full kit (22) or possible uses, including an as the Enviro pHAT.

Related
purchased separately for 5 per excellent digital clock, animated
pair (the bare pHAT is just 8), bar graph, sine wave, and scrolling Last word
so you could opt for fewer to suit text horizontal and vertical. The
SCROLL your projects needs. Youll need comprehensive Python library Apart from the slight difficulty
PHAT to warm that soldering iron up, enables you to light individual in reading horizontally
While not quite as the full set requires connecting pixels; it also includes options
scrolling text due to the gaps
so fancy, this between matrices, this is an
118 pins: 13 each for the matrices, to alter brightness to fade text
all-in-one 115 excellent, highly versatile
array of white plus a standard 40-pin female in and out, and use a tiny text
retro-style LED display.
LEDs is easier header. Since each matrix has a mode to write smaller characters,
to assemble Superior to seven-segment
leg missing on one side, mirrored rotated 90.
and ideal for LED displays, it renders
scrolling text. on the board, theres no chance of While the displays high
characters in great detail and
accidentally inverting them. Youll number of small pixels results in
could come in useful for all
want to ensure theyre sitting well-defined digits and letters, manner of projects. You might
flush, though. which look excellent when shown even be able to play simple
With the soldering done, its one per matrix, horizontally games on it, like Pong.
simply a matter of installing the scrolling text isnt quite so easily
10 / $13
software with a single terminal read due to the gaps between
magpi.cc/2c38LH3
command. This loads the Micro matrices. Other than that,

raspberrypi.org/magpi October 2016 79


Review BOOKS

RASPBERRY PI RASPBERRY PI manual), network configuration,


the config tool, and advanced

BESTSELLERS USER GUIDE configuration. Only parts of this


will be needed by most users,
but when you do need to dip into

WROX PROFESSIONAL Author: Eben Upton


& Gareth Halfacree
this reference, Tip boxes and
the occasional warning combine
Publisher: Wiley
Take your nascent coding skills up to the Price: 16.99 with clear listings and tables, and
professional level with Wroxs popular ISBN: 978-1119264361 just enough screenshots, to help
Professional Guides. magpi.cc/2cCfdoi anyone get up and running.
The chapter on setting up a web

PROFESSIONAL The unofficial


official guide
server has been dropped possibly
reflecting both the diversity of web
PYTHON reaches a fourth edition, reflecting server options and the simplicity of
Author: Luke Sneeringer the rapid pace of Raspberry Pi setting up common configurations
Publisher: Wrox development, but remains focused but media centre and productivity
Price: 33.99
on the opportunity to learn the chapters remain. The short
ISBN: 978-1119070856
creative act of programming. programming chapters (Scratch,
magpi.cc/2cCfozG
Given that aim, the bare-bones Python, Minecraft) are model
One of the best intermediate
board needs a manual, particularly introductions, with good pointers
Python books this one really fills for users and families with little to further reading. Hardware and
the gaps in your knowledge after experience of GNU/Linux, coding, physical computing round off a
your first tutorials and projects.
Read the full review in issue 42.
or physicalcomputing. reference which will become as
Part I, The Board, will get you essential as its three predecessors.
started; theres chapters on the
PROFESSIONAL range of boards, connecting up,
EMBEDDED ARM using Linux, troubleshooting (with Score
DEVELOPMENT its own chapter, as befits a serious

Authors: James A Langbridge


Publisher: Wrox ELECTRONICS through practical projects. Clear
diagrams throughout complement
Price: 33.99
ISBN: 978-1118788943 FOR KIDS a text full of explanations and
project-based learning. The
magpi.cc/2cCfJm8
first project, an intruder alarm
Author: yvind Nydal Dahl
for your room, is delightfully
A comprehensive introduction Publisher: No Starch
to Assembly language Price: 17.99 hands-on, with an aluminium
development on ARM-based ISBN: 978-1593277253 foil strip on the door and
boards like the Raspberry Pi, magpi.cc/2cCf7wN a guitar string as trigger
with plenty of background and
information on essential tooling,
wire. Each project features
though lacking updates on most Looking for a book which a troubleshooting section.
recent processors. teaches electronics practically Electromagnets, motors,
through projects, without neglecting shake generators, fruit batteries,
PROFESSIONAL the theory and component destroying an LED, flashing a light,

CLOJURE knowledge, and does it in a way that


will keep young readers interested,
soldering, a transistor-based touch
switch, and a sunrise wake-up
Authors: Jeremy Anderson, without talking down to them? alarm: these short projects lead you
Michael Gaare, Justin Holgun,
Here it is. In the introduction, Joe through discrete electronics. Then
Timothy Pratley & Nick Bailey
Publisher: Wrox Grand talks about the hacker it explores integrated circuits with
Price: 33.99 mindset solving problems with 555 timer-based musical projects,
ISBN: 978-1119267270 unconventional solutions, pushing digital electronics with simple
magpi.cc/2cCf3gz the limits of technology, harming no games, and a great introduction to
one, and learning through constant logic gates and memory circuits,
A book that makes you
think, from the first chapters
questioning and experimentation. culminating in a reaction game.
dive into thoughtful code- This book will help children to Enlightening and fun.
led examples, and covers embrace that curiosity.
web services, testing, and
Its clear and logical progression
performance. Brings you
closer to functional thinking. gives a good grounding in the Score
basics of electronics, reinforced

80 October 2016 raspberrypi.org/magpi


BOOKS Review

RASPBERRY PI the Linux sound architecture, ESSENTIAL READING:

SQL
and then using its components
FOR SECRET AGENTS for a number of pranks in bite-
Relational databases
remain the essential but
size projects. Video
unglamorous workhorses
Author: Matthew Poole follows, both with
Publisher: Packt
behind the Web of Things
the Pi Camera and
Price: 23.99
ISBN: 978-1786463548
controlling a TV through Beginning SQL Queries:
magpi.cc/2cCfOWM the HDMI interface. From Novice to Professional
Then the Pi goes off- Author: Clare Churcher
road with some stealthy Publisher: Apress
Learning by doing reconnaissance missions. Price: 19.99
goes even better From radio jamming to ISBN: 978-1484219546
magpi.cc/2cCgwmY
when fun and motivation tracking the Pi, projects
combine in mini-projects: here are fairly software-centric, and Great coverage of all the key topics
the projects are spy gadgets therefore require little in the in querying SQL databases, in a
reasonably beginner-friendly style.
or simple pranks, and this way of other components until
update over the previous edition the final chapters GPIO-based
(reviewed in issue 32) adds in projects, including a laser trip
MySQL Cookbook
Author: Paul DuBois
the miniaturised Pi Zero for even wire and an LED matrix to display
Publisher: OReilly
better gadgets, as well as the Pi secret messages. Along the way, Price: 56.99
3. Its an interesting collection of readers can pick up tips about real ISBN: 978-1449374020
projects, which reaches areas of random number generation, along magpi.cc/2cCfpUt
Linux and computing not touched with useful ways of connecting the
DuBois gives the right balance between
upon by many similar titles. Pi to the world, like SMS gateways. great examples and clear explanations
The first chapter introduces the of the theory behind them.
Pi and setting up, but jumping to
chapter 2 for the audio projects Score Introduction
there you get an introduction to to Databases
Author: Jennifer Widom

CREATING
Jekylls competitors, including Publisher: Stanford OpenEdX
Price: Free
the Python-powered Pelican,

BLOGS
ISBN: N/A
get a fair examination, and magpi.cc/2cCh3Fu
technologies necessary for static
WITH JEKYLL blogging Markdown, Git, and
styling tools like Bootstrap,
One of Stanfords three inaugural MOOCs,
now split into self-paced mini-courses,
covering different aspects of databases.
Author: Vikram Dhillon Foundation, SASS, and LESS
Publisher: Apress are introduced, before Jekyll PostgreSQL
Price: 27.99 itself is installed and examined Server Programming
ISBN: 978-1484214657 in a conciseroundup.
magpi.cc/2cCeUcO Author: Usama Dar, Hannu Krosing,
The Projects section presents Jim Mlodgenski & Kirk Roybal
interesting use cases which Publisher: Packt
If youre fed up walk through the practicalities Price: 30.99
with WordPress in a more applied way and, after ISBN: 978-1783980581
magpi.cc/2cCguLO
plugin problems and skimming earlier sections, are
slow page loads, youve probably probably where most readers Very good guide to working with
thought about a static blog. Static will spend their time. This PostgreSQL in Python, Perl, Tcl, C,
and C++, as well as PLpgSQL.
blogging, with its philosophy of section combines the practical
leveraging your coding knowledge (tags, Git, theming, Mailchimp,
The Practical
and letting almost nothing get in gem, Bundler, etc.) with food
SQL Handbook
the way of the writing, is a great for thought on platforms for
Author: Sandra L Emerson,
way of getting back control of your open debate, open research, and Judith S Bowman & Marcy Darnovsky
publication platform. This book open healthcare. Walk through Publisher: Addison Wesley
is about much more than simply the examples to gain a real Price: 43.99
setting up a static blog, starting appreciation of Jekylls potential. ISBN: 978-0201703092
magpi.cc/2cCg1tk
with somewhat laboured chapters
of background on how the internet This edition after 15 years in print
got where it is, but it contains Score remains one of the best SQL references,
whatever implementation you use.
useful material of real interest.

raspberrypi.org/magpi October 2016 81


Community FEATURE

THE MONTH IN
RASPBERRY PI
Everything else that happened this month in the world of Raspberry Pi

CREATE
YOUR OWN
VIRTUAL
ASTRO PI
Image courtesy of the ESA
The next ISS crew member to
take on Astro Pi will be French
ESA astronaut Thomas Pesquet

s weve said many times, while Tim Peakes


A mission may be over, Astro Pi lives on.
The next step involving French astronaut
Tom Pesquet is gaining steam. One way in which
Dave Honess, head of Astro Pi at the Raspberry Pi
Foundation, wants to improve participation is by
creating a virtual version of the Sense HAT that you
can use to program with Python.
There are two versions: a web-based one that
can be used anywhere (magpi.cc/2cA6bIb) and a
module for Python that you can actually program on
Above The browser version code can be the Raspberry Pi (magpi.cc/2d6vXaa). This Python
copied straight into a Python script and
used on a Pi with a Sense HAT attached! module variant also works better with older Raspberry
Pis, without needing the extra bit of oomph required
SCIENCE WITH SENSE HAT to power the web version.
The software allows students to program the Sense
Want to find out just what you can do with HAT without actually owning one and as its all
theSense HAT? We have an Essentials book Python-based, it works exactly the same and allows
just for you Experiment with the Sense the code to be loaded onto a Raspberry Pi with a Sense
HAT takes you from the basic steps, all the HAT attached, albeit with the line of code to import
way to controlling Minecraft Steve using the relevant module removed.
one. Its available as a free PDF ebook as This means it also works with other projects that
well as a printed book. Find out more here: bridge the Sense HAT with another piece of software
magpi.cc/Sense-HAT-book via Python, such as Minecraft. Theres no time like
the present to start playing with a Sense HAT!

82 October 2016 raspberrypi.org/magpi


THIS MONTH IN PI Community

CROWDFUND THIS!
The best crowdfunding hits this
month for you to check out COOL BUTTONS
kck.st/2cy2u4f

This is a fun little Kickstarter: Cool Buttons are light-


up buttons for hobby electronics projects, just like
the kind people make on the Raspberry Pi. Its creator
Jessica Kedziora believes the ones shes crowdfunding
here are the perfect project buttons: easy to install and
with the perfect press feeling to them. They come in
pre-arranged strips so you can easily scale 3D-printed
control cases for them. Give them a look; they may be
the thing your project is needing.

UART HAT
kck.st/2cTF1uC

During development/research for a project which


needsmore than one UART port, the common
replacement for the Raspberry Pi is the Arduino MEGA,
the Kickstarter pitch goes. This is because the MEGA
provides four UARTs which can be used at the same

BEST OF THE REST


time, creating a multi-UART device.
Instead of making that switch and to keep using the
Raspberry Pi, Tony Chang has created a series of HATs
that can add one, two, or four UARTs to a Raspberry Pi.
At the time of writing, its nearly funded, so maybe you
Here are some other great things we saw this month
can make the difference?

magpi.cc/2cA3EOp WORLDS
SMALLEST MAME
ARCADE CABINET
This is amazing. No larger than
a Raspberry Pi Zero, this ever so
tiny MAME cabinet can play many
classic games using tiny buttons
and a tiny joystick, all displayed
on a 0.96 OLED screen. Fiddly but

HUBPIWI BLUE
extremely cute. We want ten (as
well inevitably lose some).

kck.st/2bsXrEw

What the Raspberry Pi Zero does for its size and price
magpi.cc/2cA4bQe
FIRE PONG
Were reminded of the episode of
is absolutely amazing. The HubPiWi Blue (say that Friends with Fireball, though this
three times fast) offers to make it even better with has no real balls involved. The
a diminutive HAT that adds an extra few USB ports, aim of the game is to bat back
along with a wireless LAN and Bluetooth radio chip. the flame with the correct timing.
The USP of the HubPiWi is that you dont need to If you miss, a huge puff of flame
attach it to the GPIO ports: just screw it to the Pi Zero goes off. First to three wins. Just
and it makes contact with the USB and power pads on dont set yourself on fire.
the circuit board to add the extra features.

raspberrypi.org/magpi October 2016 83


Community FEATURE

MOSI MAKEFEST:
LEARNING MAKING INSPIRING
How do you get children excited about science,
coding, and making? Just take them to
a MakeFest for some hands-on fun

akeFests and Maker Faires, Making sounds


M along with other hands-
on events that combine
Another MOSI replica ran outside:
Robert Stephensons 1830 Planet,
Raspberry Pis, fun science, and the first steam locomotive to
imaginative hardware projects, employ inside cylinders. Inside the
Video games always seem to interest are a family-friendly way of trying station building you could make
the younger makers in the audience your hand at a range of skills your own planet from Plasticine, and
and, with bit of imagination, Bolton-based community enterprise

MINECRAFT, STEAM,
seeing what you can produce. The Brightmet Long Arm Quilting Studio
MakeFest at MOSI, Manchesters appealed to all ages with plenty

AND PATTERNCRAFT Museum Of Science and Industry,


benefits from a backdrop of
of tactile materials and colourful
acrylic paint, to produce printed
historic science and engineering; fabric pieces to take away. Between
Minecraft filled MOSIs entrance hall with the event was buzzing with excited them, The Hives Pi-based pop-
kids creating and coding. FACT Liverpools children, inspiring projects, up coding studio had Python and
Foundation for Art and Creative Technology and a mellifluous cacophony Scratch introductions.
and digital artist Ross Dalziel filled the place with of mechanical sounds. Making a musical instrument
Raspberry Pis. Every table had kids and families Beneath a giant screen of involves a long apprenticeship, but
absorbed in using Python, via Martin OHanlons Minecraft modder Mr Brutals deconstructing one is something
mcpi API, to create 1830s carriages to go with the recreation of the historic 1830s all makers can try! Noisy Toys,
Liverpool to Manchester railway theme. Liverpool to Manchester rail a star of last years MakeFest
Their Pi HAT links sensors from the real journey was everything from [see The MagPi #38], used wires
world to that of Minecraft; with its own wireless 3D printing demonstrations to attached to CPU fans to pluck piano
connections, it can be used in schools to potato balancing (food allergy strings; the sound was fed through
bypass locked-down networks, and in other notice: Potatoes are used in this the modulators of an old synth.
projects. Children also discovered the pleasure experiment). The Raspberry Throughout the weekend, you could
of hammer + punch = noise at Gemma May Pi was seen attached to several help to build and code a string
Lathams PatternCraft, a collaboration with STEM screens full of Minecraft, but section for the Manchester Robot
ambassador David Whale (the well-known was also quietly keeping score on Orchestra; to hear the completed
@WhaleyGeek on Twitter). This has produced a DoES Liverpools NERF shooting orchestra, look for announcements
punch card reader for the Pi, bringing together range of MakeInvaders. The 50th on the @robotsmcr Twitter feed.
the links between textiles, code, and Minecraft. anniversary working recreation For lower-tech instruments,
of Baby, the worlds first stored- Musical Carrots were constructed
RESOURCES program computer, filled one end from hollowed out root vegetables,
of MOSIs foyer; once again, it was a paper reed, and an elastic band.
Adventures in Minecraft: magpi.cc/2cymqYJ kept company by York Hackspaces The glove-a-phone, bagpipes
By David Whale, Martin OHanlon Baby emulator, as well as their made from a length of plastic
game of co-operative shouting, plumbing pipe and a surgical glove,
Minecraft of Things: magpi.cc/2cyjFGP the Pi-powered SpaceHack [see was demonstrated against the
The MagPi #39]. The soundtrack backdrop of the mighty industrial
PatternCraft: magpi.cc/2cylmE7 of the room was an anvil chorus engines in MOSIs Power Hall,
of hammering at PatternCraft. while The MagPi watched a team of

84 October 2016 raspberrypi.org/magpi


MOSI MAKEFEST Community

Noisy Toys hooked hardware to piano strings and processed


the sounds through analogue synth boards for intriguing new tones There were a lot of kids getting involved at the MakeFest

volunteers training young people Hack Oldhams work with Age UK


aged 12 and up to solder, making a training kids in these traditional
flashing light badge. Nearby were skills through cross-generational
laser cutter demonstrations with workshops, and talked about the
wooden robots, people making create, dont consume ethos
metal detectors, a micro:bit which unites all of the diverse
robot which responded to hand community of makers found at
claps, and CodeBug workshops the event. With a chance to make
for children as young as five, as textile art, try embroidery, and
well as KNEX models of steam hand-stitch (and re-engineer)
engines and some old-school toys, some families spent
Meccanomodels. hours here. FACTs digital artists created the Minecraft of Things
with eager young Python programmers

Nearby, everything from LEGO


to plastic figures was repurposed
and motorised by John Walton
The fabric of makers Nearby, everything from LEGO to
In the Textiles gallery, clustered plastic figures was repurposed and
around the cotton looms of the motorised by John Walton, and no
industrial revolution cranked one could walk past his Toy Hacker
into rather noisy life by museum stall without pressing a button to
staff, several MakerSpaces were make one of the toys come to life.
Moving melanges of motorised toys make
demonstrating their spin on some Next door was another stack of Pis an irresistible button press
of humanitys oldest technologies on the Exa Foundations stall. There,
with threads and fabrics. Weaving Alan Donohoe of Raspberry Jam
your own phone case on the fame used Monk Makes kits, Python,
Lancaster And Morecambe Minecraft, and an inexhaustible
Makers (LAMM) table was an ideal supply of handy metaphors, and
introduction to the pre-industrial spent a busy weekend introducing
version of what was seen at scale families to coding and physical
in the MOSI displays. computing. In this, he was ably
Hack Oldhams Mike Healy assisted by 16-year-old Louis, a
told The MagPi: People have a veteran of many Raspberry Jam
perception of making as all about events who has a real passion for
digital and physical computing, computing. If theres a maker
but traditional skills are just as event coming up near you, dont
MakeFest provided plenty of quirky fun who knew you could
important: the maker community miss the chance to take your family make a clarinet out of a carrot?
is about skills. Mike told us about and inspire the next generation.

raspberrypi.org/magpi October 2016 85


BERLIN
Community INTERVIEW

RASPBERRY JAM:
AN INTERVIEW WITH JAMES MITCHELL
JAMES Practical tips for setting up a Raspberry Jam

MITCHELL from James Mitchell, a Scot living in Berlin


e catch up with James into place. I started to build a
A Scottish-born, Berlin-based,
software quality assurance
W Mitchell, a face you may
recognise from the pages
lot more projects mainly using
the Pi camera; I have a little
engineer, hes the organiser of TheMagPi, about the Raspberry obsession with photography
of the Raspberry Jam Berlin Jams he stages in Berlin. and Imparticularly fond of
running for the last two years. timelapse. My kids also started to
How did you find out about get involved with the Raspberry Pi.
Raspberry Pi? Theyre still a little young yet, but
I love that they stay enthusiastic.
I had been following the
Raspberry Pi since the first Why did you decide to start
BBC news report showing the the Berlin Raspberry Jam?
prototype. At the time, I was
looking for an affordable solution It really was the lack of events
to learn Linux without having to in and around Berlin that got me
reinstall my laptops operating going. I really wanted to attend
system. You could say it was love one of the UK Jams, as it seemed
atfirst sight. full of like-minded people willing
After owning a Raspberry Pi to help each other and learn new
for a few months, I started to things, something we sorely
search like others do for tips, lacked here.
tricks, and tutorials online. Its I did later manage to attend
then I started to notice Raspberry the Raspberry Pi Birthday Parties
Jams being set up all over the in Cambridge. While considerably
UK. We didnt have these events larger than most Jams Ive heard
in Berlin, so I decided to start about, it was totally amazing
a Jam of my own. Thankfully, I to meet the community and it
had loads of support from Jam reinforced the sense of belonging
leaders, and even got the chance I had been looking for.
to meet Ben Nuttall when he On 5 July 2014, I held the first
visited Berlin shortly before he Raspberry Jam Berlin in a co-
joined the Foundation. He was a working office that offered their
great inspiration! space on the weekends for free
After getting started with the if you didnt charge for tickets.
Jamess Zero360 project has been a
big hit read more about it in issue 49 Jam, lots of things started to fall I had some Pis set up with various

86 October 2016 raspberrypi.org/magpi


JAMES MITCHELL Community

James opens the Berlin Jam with a welcome talk

add-on boards and we also had a My favourite thing about


few talks about the Raspberry Pi.
The first Jam had some talks
Raspberry Jam is meeting different
people and seeing those projects SETTING UP
about how to use the Raspberry
Pi, others highlighting certain
that are getting pushed beyond
my own understanding. Also,
YOUR OWN JAM:
add-on boards, and a talk about
installing Flask. I also had some
being able to help new people get
interested in the Raspberry Pi is
JAMESS TOP TIPS
workstations set up so people that rewarding. Its very satisfying
didnt have a Pi could just take a to know someone has left the 01. GET HELP:
look and see what its all about. Jam inspired! Its OK to start things off on your own, but it can get
quite overwhelming when you get to an event with

Find your like-minded corner over 15-20 people. Make sure you have someone
around who is willing to take tasks from you.

of the community and, with


02. COMMUNICATION IS KEY:
their help, expand if you want Make sure you get out there and communicate
with your little part of the community. If they dont
know whats going on, they wont be able to attend
Later, we got robots and project What advice would you have your Jam. Give dates well in advance and if you
show-and-tells. for someone setting up a Jam need help, make sure your community knows. You
The Berlin Jam does alright in their area? never know whos willing to help.
on average, 25 people but
I had found that in summer Start small and have a clear idea
months there are a lot fewer of what you want from your Jam. 03. KEEP SOCIAL:
people attending. I guess they Invite a few friends and maybe the It still amazes me how effective social media is in
tend to be on holiday or would local schools computing teacher. bringing new faces to my Jam. Really keep tabs on
rather enjoy the awesome Berlin Find your like-minded corner of your accounts and keep them up to date.
summer weather. the community and, with their
It does get a little stressful help, expand if you want.
when you have low numbers, but Dont be intimidated by the
04. DONT FORGET TO HAVE FUN:
Its easy to get lost in all the items you have to take
the key is to ignore the numbers size of other Jams. They come in
care of for a Jam. Make sure you make time for
and just enjoy the moment. If one all shapes and sizes and some can
your own projects, too.
person shows up and they walk be really large. Just keep in mind
away inspired, its a job well done. youre in it to have fun!

raspberrypi.org/magpi October 2016 87


Community EVENTS

RASPBERRY JAM
EVENT CALENDAR 4 RAIDER
RASPBERRY JAM
Columbia, SC, USA

Find out what community-organised, Raspberry Pi-


themed events are happening near you

PUT YOUR EVENT


ON THE MAP
Want to add your get-together?
List it here:
raspberrypi.org/jam/add

FIND OUT
ABOUT JAMS
Want a Raspberry Jam in your
area? Want to start one?
Email Ben Nuttall about it:

ben@raspberrypi.org

HIGHLIGHTED EVENTS REGULAR EVENTS


EAST LONDON NEWHAVEN RASPBERRY JAM RASPBERRY JAM
RASPBERRY JAM When: Sunday 23 October PRESTON
When: Saturday 22 October Where: Hillcrest Community Centre, When: Monday 3 October
Where: Barking Library, Barking, UK Newhaven, UK Where: Media Innovation Studio,
magpi.cc/2ci9Mdd magpi.cc/2cvTGjn Preston, UK
A four-hour event for those who An event for people who want to magpi.cc/2bmQZfA
like programming, coding, and get their hands on and try out the Learn, create, and share the
technology. Learn how to program Raspberry Pi, while seeing some potential of the Raspberry Pi
Minecraft and GPIO Zero. great projects. at a family-friendly event.

RAYLEIGH RAIDER RASPBERRY JAM RASPBERRY JAM LEEDS


RASPBERRY JAM When: Saturday 5 November When: Wendesday 5 October
When: Saturday 22 October Where: WJ Keenan High School, Where: Swallow Hill Community
Where: Rayleigh Library, Columbia, SC, USA College, Leeds, UK
Rayleigh, UK magpi.cc/2cvURzs magpi.cc/2bmQXEI
magpi.cc/2cvTiBf An event that will bring students, Everyone is invited for a couple
See projects from Rayleigh Library teachers, makers, hobbyists, and of hours of computing fun,
Code Club and get a hand with others together to learn about the talks, demonstrations, and
programming your own stuff. Raspberry Pi. handsonworkshops.

88 October 2016 raspberrypi.org/magpi


EVENTS Community

JAM HEAT MAP JAMS


EVERYWHERE!

6 RASPBERRY JAM
LEEDS
Leeds, UK

5 RASPBERRY JAM
PRESTON
Preston, UK

2 RAYLEIGH
RASPBERRY JAM
Rayleigh, UK

1 EAST LONDON
RASPBERRY JAM COULD USE
MORE JAMS
Barking, UK

8 12TH EGHAM
RASPBERRY JAM
Staines-upon-Thames, UK

3 NEWHAVEN
RASPBERRY JAM
Newhaven, UK

7 TORBAY
TECH JAM
Paignton, UK

FILL IN THE GAPS!


TORBAY TECH JAM
When: Saturday 8 October
Where: Paignton Library and
Information Centre,
Paignton, UK SCOTLAND NEEDS RASPBERRY JAMS
magpi.cc/2ci8aQx
A fun, informal, and family-friendly Raspberry Pi community The Glasgow Raspberry Pi Day was great
lets get more Jams in Scotland!
event that aims to inspire people to get manager Ben Nuttall would
into code and take up STEM subjects. like you to help us spread
Raspberry Jams around the
12TH EGHAM country; one area that could
RASPBERRY JAM do with more is Scotland. If
When: Sunday 16 October youre handy with a Raspberry
Where: Gartner UK HQ The Glanty, Pi and know others who are,
Staines-upon-Thames, UK why not start your own Jam?
magpi.cc/2ci9rH6 If youre keen, email ben@
The theme of this Raspberry Jam raspberrypi.org about it and
is Winter Fun think Halloween, see page 87 for some top tips
Bonfire Night, and cold weather! on how to get started.

raspberrypi.org/magpi October 2016 89


Community COMMUNITY PROFILE

COMMUNITY
PROFILE
TIM RICHARDSON
& MICHAEL HORNE
Tim and Michael are the guys responsible
for the Cambridge Raspberry Jam, CamJam
kits, and the Birthday Bash extravaganzas!

Tim & M
ichael Horne and Tim
Richardson have become
resources on the CamJam website,
EduKits provide the components

Michael regular faces within the


Raspberry Pi community, and with
good reason. For those local to the
necessary for newcomers to the
Raspberry Pi to understand physical
computing. From sensors to traffic
Names: Tim Richardson Cambridge area, the pair are best light LEDs, the affordable kits offer
& Michael Horne known for running for the citys everyone the chance to get to grips
Category: Event organisers Raspberry Jam The CamJam as with digital making, regardless of
well as events such as the Birthday their skills or experience.
Day job: Michael is a web
Bash and the successful Pi Wars, the And if thats not enough, the
developer while Tim works
next instalment of which is due in online presence of Tim and Michael
as a performance architect.
April 2017. Theyre also responsible continues to permeate the social
Website: c amjam.me for many photos and videos youll platforms of the Raspberry Pi
@Geeky_Tim
have seen on our blog over the years. Foundation. Both are active within
@recantha
Those further afield may have the Twittersphere: youll no doubt
found themself in possession of a have shared a joke or received
Below Tim is most proud of this
Weather Clock, a swish-looking display CamJam EduKit from The Pi Hut. advice from either @Geeky_Tim
of numbers and icons that indicate the
Available in several varieties, or @recantha. And if you happen
date and time, along with both current
and forecast weather conditions and accompanied by educational to look for information or updates

Michaels Music Box is his favourite project: its a kit that fits neatly into his hand, allowing
for the playback and distortion of notes through various button presses and dial twists

90 October 2016 raspberrypi.org/magpi


TIM RICHARDSON & MICHAEL HORNE Community

HIGHLIGHTS

piwars.org
PI WARS
The popular robotics competition allows teams of
On 8 September, Michael and Tim demonstrated some of their projects
and kits at the #10MillionPi House of Commons celebrations Raspberry Pi enthusiasts to battle head to head in a
series of non-destructive challenges. Rolling into its
on Raspberry Pi products, projects, to the mix. Of future events, Tim third year, the next Pi Wars is set to run across the
or updates, Michaels website, notes, With two of us doing the firstweekend of April 2017.
recantha.co.uk, is most likely to organisation, we were able to do a
be sitting in your browser history. lot more. I wanted to get vendors
For the pair, the Raspberry Pi was to the event so people could buy
a subject of interest pre-launch, stuff for their Pis. They also put
with both ordering one from the together workshops and, later,
start. Tim, the eager tinkerer, began presentations. The workshops
his Pi journey from delivery day, in turn led to the creation of
while Michael admits to letting his the CamJam EduKit, a means
collect a little dust before finally for workshop attendees to take

I wanted to get vendors to CAMJAM & EDUKIT camjam.me

the event so people could From a small room at the Centre of Mathematical
Sciences to multiple rooms and hundreds of attendees,

buy stuff for their Pis the Cambridge Raspberry Jam continues to grow within
the birth town of the Pi. The EduKit range providing
everyone with the necessary components to learn LED
diving in. At first, Michael attended components home and continue coding, sensors, and more is available via The Pi Hut.
the Milton Keynes Raspberry Jam, their builds there. The transition
learning to solder in order to begin of the kits to The Pi Hut took place
work on a project, the Picorder. in July 2014, allowing for greater
Having noticed the Cambridge variety and fewer nights filling bags
Raspberry Jam would no longer on the living room floor.
be running in the home town of More recently, the pair joined the
the Raspberry Pi, and ensuring Raspberry Pi team in celebration of
he wouldnt step on a few toes in the #10MillionPi milestone, bringing
the process, Michael decided to their projects to the Houses of
launch his own Jam at the Centre Parliament to help introduce more
for Mathematical Sciences. It was to the Raspberry Jam scene. And of
so badly organised that I hadnt their continued future within the
magpi.cc/2cBFJy0
even visited and seen the room community? The much-anticipated RASPBERRY PI
beforehand, he admits. It was Pi Wars will be taking place over the BIRTHDAY BASH
just 30 people at that first one! first weekend in April 2017, offering Cake, project builds, and merriment: the Raspberry Pi
This lack of organisational skills all ages and abilities the chance to Birthday Bashs continued success draws people from
would soon be remedied by the put their robotic creations to the test across the globe to join the team in celebrating the
introduction of Tim Richardson against a series of challenges. Raspberry Pi, the community, and the future.

raspberrypi.org/magpi October 2016 91


Community YOUR LETTERS

YOUR LETTERS
Counting the votes
I think its really great that you have the community
involved with voting for the top 20 Raspberry Pi
projects for this issue. Theres a project missing
from the list of 30 Id have liked to have seen,
though. Is there any way we could have another
selection of excellent projects and add a few extra
ones to it?
Henry Simmons

We had a few people ask us if a project was going to


be in the list somewhere; hopefully, any ones you
thought should be on there ended up being one of the
50 projects we had in the final list. To be honest, we
could probably have another 50 projects in the list
that are just as good as the selection already there, but
we had to make some tough choices. When will we do
it again? Well, maybe watch this space for our 100th
issue; no promises, though.
There were a few projects people suggested which
were newer and hadnt been in the magazine; if you
do have a cool unique project, just drop us a line at
magpi@raspberrypi.org and well have a look at it.

Magic number
Congratulations on the sale of ten million Raspberry
Pis! I remember when there was five million last
February and how that was still an amazing number.
Above The
original 30
The MagPi legacy 20 million soon, hopefully! I was just wondering
issues of Hi there MagPi. I live in Australia and I have what sort of releases wed see over the next
TheMagpi are
available for
subscribed via the MagPi iOS app. The ad in couple of years now that marvellous milestone has
free on both The MagPi magazine suggests I can access all been achieved; will there be a Model 3A? Whats
the app and
the website,
30 previous editions, but that doesnt seem to happening with the Compute Module 3?
and will be be the case on the iPad. Can you please set me Its all very exciting.
freeforever
straight: what am I missing? Sue H
Damian Jolly
We briefly mentioned it here in the letters section last
Hi Damian: the ad is referring to the first 30 issue, but the Compute Module 3 is still very much
issues of The MagPi. If you scroll down on the main happening. According to Eben, production orders are
page with all the magazines listed, youll be able in, and were just waiting for output dates from Sony,
to find these issues and you can just download so hopefully it will be around in the next few months.
them. While theyre available on the app, you can As for the 3A, apparently theyre still being planned
also get them and every other issue of The MagPi and havent gone to production yet. They will be a
absolutely free on our website as PDFs, although thing, though! Keep an eye on the Raspberry Pi blog
the reading experience on tablets and phones is and the magazine for more info for when either are
slightly better on the app, we reckon. actually out.

92 October 2016 raspberrypi.org/magpi


YOUR LETTERS Community

FROM THE FORUM:

PIPIN
New Essentials
Ive seen that you have a new range of The MagPi
Essentials books, but theyre not in print yet. I really
love the print versions of the older Essentials books;
are you going to be bringing the next set out in print
to buy? They go down a storm at my Code Club!
FOR GPIO
The Raspberry Pi Forum is a hotbed of
Marie conversations and problem-solving for the
The printed versions of Learn to Code with Scratch,
community - join in via raspberrypi.org/forums
Hacking and Making with Minecraft, and Simple Electronics
with GPIO Zero are on their way! We dont have a set m a rank newbie at 60+ years old, and a tech by trade,
date for them at the moment, but as the last set of
printed Essentials books went down so well, were
I so I think I can get this stuff.
I saw a program in The MagPi a couple of months back -
really looking forward to doing it again. called pipin, I think - which shows the status of the GPIO inputs and
outputs. It uses the NPM packaging, but Im reading all this stuff
and it isnt making much sense.
Can someone tell me how to invoke (run) the program?
Ive installed NPM and pipin, and now Im lost.
Regards,
Chris M

It looks like pipin was on a Raspberry Pi weekly newsletter rather


than the magazine. Theres a helpful man page on the NPM website
for pipin that should be able to help you out; you can check it out
here: magpi.cc/2cCdu27.
Some of the useful commands include pipin --list, which will
list all available GPIO options. You can also bring up a schematic
with pipin --model rpi3, specifically for the Pi 3.
As for using it, it looks like you can set different pins to be a
particular state (high or low) or read the state of the pin (again,
high or low). Look at the man page for more examples; hopefully
they will help!

WRITE TO US
Have you got something youd like to say?
Get in touch via magpi@raspberrypi.org or on The MagPi
section of the forum at: raspberrypi.org/forums
Above If recent trends continue, the
3A will look a lot like the existing A+

raspberrypi.org/magpi October 2016 93


In association with

3
&
MODMYPI

OSMC
www.modmypi.com
modmypi.com osmc.tv

PIDRIVE KITS
MUST BE WON!
INTRODUCING THE OSMC PIDRIVE KIT
The stylish OSMC PiDrive keeps your media centre tidy, while maintaining access to all important
connectivity. The PiDrive Kit includes the PiDrive case, a Western Digital 314GB hard drive, a
SanDisk Class 10 8GB SD card preloaded with OSMC, a 3A power supply, and a Raspberry Pi 3!

ON WHICH
POPULAR
MEDIA PROJECT
IS OSMC BASED?

Tell us by 24 October
for your chance to win!
Simply email competition@raspberrypi.org
with your name, address, and answer!

Terms & Conditions


Competition closes 24 October 2016. Prize is offered worldwide to participants aged 18 or over, except employees of the Raspberry Pi Foundation, the prize supplier,
their families or friends. Winners will be notified by email after the draw date. By entering the competition, the winner consents to any publicity generated from the
competition, in print and online. Participants agree to receive occasional newsletters from The MagPi magazine (unless otherwise stated upon entry). We dont like
spam. Participants details will remain strictly confidential and wont be shared with third parties. Prizes are non-negotiable and no cash alternative will be offered.

94 October 2016 raspberrypi.org/magpi


Column THE FINAL WORD
MATT RICHARDSON
Matt is Raspberry Pis US-based product evangelist. Before
that, he was co-author of Getting Started with Raspberry Pi
and a contributing editor at Make: magazine.

THE IMPACT OF
TEN MILLION
Matt Richardson explains how the first ten million Pis
will have lasting effects
ast month, the Raspberry Pi Foundation hit a I feel very lucky that I had access to that
L major milestone by selling its ten millionth
computer. Besides taking the opportunity to
computer. That kind of early exposure had such
a huge impact on my life. For years I continued to
celebrate and that we did its also a good time to learn programming, both in school and on my own
reflect on the impact that the device has had over the time. Even though Ive benefited greatly from the
last four and a half years. As you may know already, mainstream, consumer-friendly technology that
we dont just make an ultra-affordable computer. Our has since become available, I still use and build upon
mission is to put the power of digital making into the the skills that I learned as a kid on that IBM PC.
hands of people all over the world; the Raspberry Pi Programming languages and hardware have changed
computer helps us do that. a lot, but the fundamental concepts of computing
There are many ways in which the Raspberry Pi has have remained mostly the same.
a positive impact on the world. Its used in classrooms,
libraries, hackspaces, research laboratories, and within The next generation
the industrial environment. People of all ages use I expect that the Raspberry Pi has a very similar
Raspberry Pi in these contexts and others, to learn impact on young people today. For them, it fills
about computing and to create things with computers the void that was left when computers became
that we never could have imagined. less like programmable machines and more
But I believe the biggest impact weve had was to like consumer products. I suspect that, just like
encourage more people to experiment with computers with me, this impact will linger for years to
once again. It used to be that in order to use a computer, come as these young people grow up and enter
you had to have a fairly good working knowledge of a workforce that is increasingly dependent on
how it worked, and often you needed to know how to their digital skills. And if even just a tiny bit of
program it. Since then, computers have become much interest in computing is the spark, then I believe
more mainstream and consumer-friendly. On the one that a tinker-friendly computer like Raspberry Pi
hand, that change has had an incredible impact on is the kindling.
our society, giving more people access to the power Heres where that ten million number comes into
of computing and the internet. However, there was a play. Admittedly, not everyone who is exposed to a
trade-off. In order to make computers easier to use, Raspberry Pi will be affected by it. But even if you
they also became lesstinker-friendly. guess conservatively that only a small fraction of all
When I was a kid in the 1980s, our family had an old the Raspberry Pis out in the world serve to inspire a
IBM PC in our basement, that was decommissioned young person, it still adds up to an incredible impact
from my fathers workplace. On that computer, I on many lives; not just right now, but for many years
learned how to use the DOS prompt to work with to come. Its quite possible that many of tomorrows
files, I created my own menu system out of batch computer scientists and technology specialists are
files, and most importantly, I learned my first ever experimenting with a few of the first ten million
programming language, BASIC. Raspberry Pis right now.

96 October 2016 raspberrypi.org/magpi


SIMPLE ELECTRONICS
GPIO ZERO
Get started today for CONTROL OF THE REAL WORLD

just 2.99 / $3.99


WITH
YOUR Raspberry Pi
From the makers of the
official Raspberry Pi magazine
ESSENTIALS

Find it on

digital app

www.Raspberrypi.org/MagPi

98 October 2016 raspberrypi.org/magpi


Expand your Pi
Stackable expansion boards for the Raspberry Pi

Serial Pi Plus
RS232 serial communication board.
Control your Raspberry Pi over RS232
or connect to external serial
accessories.

Breakout Pi Plus
The Breakout Pi Plus is a useful
and versatile prototyping expansion
board for the Raspberry Pi

ADC Differential Pi
8 channel 18 bit analogue to digital
converter. I2C address selection
allows you to add up to 32 analogue
inputs to your Raspberry Pi.

IO Pi Plus
32 digital 5V inputs or outputs. I2C
address selection allows you to stack
up to 4 IO Pi Plus boards on your
Raspberry Pi giving you 128 digital
inputs or outputs.

RTC Pi Plus
Real-time clock with battery backup
and 5V I2C level converter for adding
external 5V I2C devices to your
Raspberry Pi. Also
available
1 Wire Pi Plus for the
1-Wire to I2C host interface with ESD
protection diode and I2C address
selection.
Pi Zero

www.abelectronics.co.uk
SPY VS. SPI
CODE. CAPTURE. DEFEND.

Spy vs. sPi is a capture-the-flag style engineering


adventure that puts real purpose to basic design and
programming skills. It can be played individually or in
teams and is based on the GrovePi.
Each spy is assigned a series of missions, requiring
them to write code to control an assortment of
sensors that will allow them to protect their jewel
in different ways, or capture the jewel of a

GrovePi
competing spy.

Back us on Kickstarter Sept. 20-Oct 31, 2016!


www.dexterindustries.com/spy
Build your own spy device.

BrickPi
Raspberry Pi + LEGO MINDSTORMS

www.dexterindustries.com

You might also like