MagPi110 Raspberry Pi Magazine Oct 2021
MagPi110 Raspberry Pi Magazine Oct 2021
R A S P B E R RY P I
SMART GADGETS Hack home devices with super small computers!
H
ea
ter c ue
M eter B arbe Sno
Dog re D e t e c to r
Translator
Sm
ar t Bar tender
Ca er
t Spe
G u it a r P e d a l edo m et
USE
magpi.cc/store
GPIO
PINS
Immerse yourself in the game with the new Red Eagle #monitors4gamers.
Choose the height adjustable GB3266QSU with a 2560x1440 resolution or the G2466HSU
with 165Hz refresh rate and enjoy stutter-free gameplay on these 1500R curved VA panels.
WELCOME
to The MagPi 110
A
s time goes on, I’m increasingly becoming a militant 'right
to repair' advocate. I think it’s right to fix and improve things,
rather than chucking them in the bin and buying afresh.
It makes financial sense to build your gadgets or repair them,
and you can improve classic kit with Raspberry Pi technology. With Lucy
EDITOR
Hattersley
Raspberry Pi, you can make an outrageous idea work. You can’t buy a
dog translator, cat speedometer, or snore detector. With Raspberry Pi, We love our
subscribers and
your ideas – or the wild ideas of other makers – become reality. shower them with
free gifts. I suggest
And, it makes sense to know how something works. Build you take out a
subscription right
something with your own hands and it’s truly yours. away so the next
issue lands on
Your Smart Gadgets feature (page 30) has all the information you your doorstep.
need to transform classic devices into super-smart widgets, and build @LucyHattersley
your crazy gadgets for the home. And while you’re in a creative mood,
don’t forget Halloween is coming. Your spooky upgrades feature
(page 68) is packed with ideas for entertaining local kids
with electronics. GET A
I hope you enjoy this issue. RASPBERRY PI
It’s packed with great ideas and ZERO W KIT
fun makes. Let us know what
you repair, improve, or create
PAGE 28
for yourself.
Lucy Hattersley Editor
SPOOKY PROJECT UPGRADES FOR HALLOWEEN!
Issue 110 September 2021
R A S P B E R RY P I
SMART GADGETS
Raspberry Pi Smart Gadgets
H e
ea cu
ter
M eter B a r b e Sno
Dog re D e t e c to r
Translator
Sm
ar t Bar tender
Ca er
t Spe
G u it a r P e d a l edo m et
USE
GPIO
PINS
magpi.cc
magpi.cc 03
3 ISSUES FOR £10
+
FREE BOOK
magpi.cc/freebook
Subscribe to The MagPi, HackSpace magazine, or Custom PC. Your first three issues for £10, then our great value rolling subscription
afterwards. Includes a free voucher for one of five fantastic books at store.rpipress.cc/collections/latest-bookazines
UK only. Free delivery on everything.
CONTENTS
Contents
> Issue 110 > October 2021
Cover Feature
30
30 Raspberry Pi
Smart Gadgets
Regulars
08 World of Raspberry Pi
92 Your Letters
97 Next Month
98 The Final Word
Project Showcases
12 miniLIGO
16 Package Thief Deterrent
18 ML Prosthetic Arm 20
20 Solar System Display
22 Cyberdeck
26 Zippy
16
DISCLAIMER: Some of the tools and techniques shown in The MagPi magazine are dangerous unless used with skill, experience, and appropriate personal protection equipment. While
we attempt to guide the reader, ultimately you are responsible for your own safety and understanding the limits of yourself and your equipment. Children should be supervised. Raspberry
Pi (Trading) Ltd does not accept responsibility for any injuries, damage to equipment, or costs incurred from projects, tutorials or suggestions in The MagPi magazine. Laws and regulations
covering many of the topics in The MagPi magazine are different between countries, and are always subject to change. You are responsible for understanding the requirements in your
jurisdiction and ensuring that you comply with them. Some manufacturers place limits on the use of their hardware which some projects or suggestions in The MagPi magazine may go
beyond. It is your responsibility to understand the manufacturer’s limits.
magpi.cc 05
CONTENTS
Tutorials 38 62
38 Make retro noises
43 Ultimate home server - part 3
48 Surrogate TV project streams
52 Code Gradius Volcanos
55 Create GUIs in Python - part 10
Make retro noises Build an Android tablet
62 Build an Android tablet
The Big Feature 76
68
Keybow 2040
Spooky project upgrades
Reviews 86
76 Keybow 2040
78 PoE USB Hub HAT
80 Electronic clock for Pico
82 10 amazing instrument projects
84 Learn networking
Community
86 Matt Gray interview
88 This Month in Raspberry Pi Matt Gray interview
WIN A I R Q UA L I T Y K I T S FO R 95
1 OF 10 RASPBERRY PI
06 magpi.cc
THE WORLD OF RASPBERRY PI
The next
generation of
documentation
Raspberry Pi introduces a new documentation hub. By Lucy Hattersley and Alasdair Allan
R
aspberry Pi has launched the next restructured, and a great deal of non-Raspberry
generation of its documentation Pi specific documentation needed to be removed,
that can be viewed today while other areas were underserved and needed
(magpi.cc/documentation). to be expanded.”
The page is built Writing on the Raspberry Pi blog
automatically
following a push to
(magpi.cc/bringondocs), Alasdair Allan, Head Replacing Markdown
the master branch of Documentation at Raspberry Pi, says: “The The new documentation design “comes from
on the GitHub page, documentation repository itself had been left to the same team of folks that built the excellent
where anybody can
issue a pull request grow organically. When I arrived, it needed to be PDF-based documentation for Raspberry Pi Pico
and RP2040.”
The PDF documentation for RP2040 and
Raspberry Pi Pico was built off an Asciidoc-based
toolchain, and “we knew from the outset that
we’d want to migrate the current Markdown-
based documentation to Asciidoc. It’d offer us
more powerful tools going forwards, and a lot
more flexibility,” says Alasdair.
Get involved
The Asciidoc source for the new
documentation site is hosted on GitHub
(magpi.cc/documentationgit), and the
Documentation site is built and updated
automatically using GitHub Actions when
someone pushes to the master branch.
“However, we’ll mostly be working on the
develop branch in the repository, which is the
default branch you’ll now get when you take a
fresh checkout, and also the branch you should
target for your pull requests,” says Alasdair (see
magpi.cc/documentationpullrequest).
The new Astro Pi looks similar
to the original, although the
camera gives it away
M
ission Space Lab and Mission Zero are teams to investigate plant health with the higher
back once again: the challenge where quality optical filter used in conjunction with the
teams of students send code to the ISS IR-sensitive camera. Using the Coral machine
(International Space Station) to be run on a learning accelerator, teams will also be able to
couple of Raspberry Pi systems that are installed develop machine learning models that enable
on the station. These Astro Pi were launched in high-speed, real-time processing.”
2015, though, and are long due an upgrade.
Not only will the new Astro Pi computers use Taking part in Astro Pi
a Raspberry Pi 4, they’ll also receive a powered- There are two Astro Pi missions to choose from:
up Sense HAT and more sensors and features Mission Zero and Mission Space Lab. Young people
for students to use. This includes a High Quality can participate in one or both of the missions, and
Camera, Coral machine learning accelerator, entry is completely free.
colour and luminosity sensor, and a passive
infrared sensor. This joins the current sensors of Mission Zero
a gyroscope; an accelerometer; a magnetometer; In Mission Zero, young people write a simple
and humidity, temperature, and pressure sensors. Python program that takes a sensor reading and
“The new hardware makes it possible for displays a message on the LED screen. This year,
teams to design new types of experiments,” participation in Mission Zero also gives young
the Astro Pi team says. “With the Raspberry people the opportunity to vote for the names of
Pi High Quality Camera they can take sharper, the two new Astro Pi units being sent to the ISS.
more detailed images and, for the first time, Mission Zero can be completed in around an hour,
teams will be able to get full colour images of the and is open to anyone aged 7 to 19 years old. Every
beauty of Earth from space. This will also enable eligible entry is guaranteed to run on board the ISS
T
he Coral hardware
is a little add-on
that can be used
with Astro Pi.
Upgrade in Numbers
Team Mechabot - with the
m
iniLIGO fires lasers at a
beamsplitter to create an
interferometer used for
subatomic analysis
miniLIGO
gravitational
wave detector
A Nobel-prize winning concept inspired PhD students to make their own
gravitational wave tracker using Raspberry Pi. Rosie Hattersley explains
A
fter hearing about the science prize- how LIGO works. miniLIGO is designed to be a
winning LIGO (Laser Interferometer “simplistic and affordable” prototype mimicking
Gravitational-wave Observatory, the laser-interferometer gravitational wave
magpi.cc/ligo) six PhD students at Carnegie observatory experiment that won the Nobel Prize
Husni
MAKER
Quick FACTS
> The $1,000
budget was set by
Carnegie Mellon
University
T
eam miniLIGO – Oshadha > A space-based
Gunasekara, Aileen Zhai, version of LIGO –
Husni Almoubayyed, Alisa
Chang, Elliot Tuck, and LISA – is currently
Anirudh Mani – demonstrate being planned
their device at Build18,
Carnegie Mellon University
Schematic of the
interferometer used
for miniLIGO
Getting set up
A Raspberry Pi 3B, connected to a portable battery
and a Bluetooth speaker, and a GPIO library
are at the heart of miniLIGO. The team used an
Adafruit High Dynamic Range Light Sensor and
L
ayout additions will
see Pico controlling the
automatic running of
multiple locomotives Make it mini
To make your own miniLIGO, you’ll need a Raspberry
Pi 3B powered by a portable battery pack. The code
can be found at: magpi.cc/miniligogit.
Package
Thief Deterrent
Here’s a decidedly tongue-in-cheek make that is an extremely
humorous take on a home security system. Nicola King stands well clear
M
any of us are increasingly ordering Armed with a Raspberry Pi 4, a security camera,
goods online, with the consequence and various other ingredients, he set about
that more and more parcels and boxes making something that certainly caused a stir in
are landing on doorsteps everywhere. From a the neighbourhood, as his must-watch YouTube
security aspect, it can be a little worrying when video demonstrates (magpi.cc/packagetheft). “I
our precious new purchases are left in plain sight built the project more for entertainment value
waiting for us to return home. A fun and light- than actual use (since I’ve only ever had one
hearted project by Canadian maker Ryder shows package stolen), but I consider it a success either
Ryder,
MAKER
It’s great at detecting whether there is or “This is definitely a great project if you’re
looking to get your feet wet into machine learning
is not a package, but it also sometimes – though I don’t recommend you implement the
sprinkler, flour, or air horn components,” he says.
recognises my cats as packages! “All the participants in my video were friends and
neighbours of mine, and implementing the exact
same setup for the public will likely get you into
some sort of trouble,” he cautions. However, he
does suggest that you can modify the project to
send you an email when a package arrives, or has
been taken unexpectedly, which may be a more
prudent route to take!
Averting a cat-astrophe
Computer vision is central to Ryder’s project,
and he used Google Cloud AutoML to train the
machine learning model. “I wanted something
to include in my video that was easiest for those
getting started with machine learning to use,”
A Raspberry Pi 4 runs the software, with a
relay board used to control 12 V components
he reveals. “Training a model yourself can be
such as the flashing light, siren, and sprinkler quite intimidating.”
Warning!
Don’t Assault
You may get into trouble
if you attack innocent
porch visitors with flour,
or anything else for that
matter. Do not deploy
that aspect of the
project in a real-
world environment.
A garden sprinkler is
activated via a relay Quick FACTS
to spray the offender
> This project took
with water
Ryder around a
month to complete.
When a package theft is
detected by the camera and
> You’ll need quite
computer vision, a red flashing
a few items to
light and siren are triggered
make this…
Prosthetic Arm
This intelligent arm learns how to move naturally, based
on what the wearer is doing, as Phil King discovers
K
nown for his robotic creations, popular the suit’s Raspberry Pi Zero using AOgmaNeo
YouTuber James Bruton is also a keen Iron (magpi.cc/aogmaneo), a lightweight C++
Man cosplayer, and his latest invention software library designed to run on low-power
would surely impress Tony Stark: an intelligent devices such a microcontrollers.
prosthetic arm that can move naturally and “AOgmaNeo is a reinforcement machine
autonomously, depending on the wearer’s body learning system which learns what all of the data
posture and limb movements. is doing in relation to itself,” James explains.
“It’s a project I’ve been thinking about for a “This means that you can remove any piece of data
James Bruton
MAKER
while, but I’ve never actually attempted properly,” and, after training, the software will do its best to
James tells us. “I thought it would be good to have replace the missing piece with a learned output. In
Former toy
designer, current
a work stream of something that could be useful.” my case, I’m removing the right arm and using the
YouTube maker, learned output to drive the prosthetic arm, but it
and general Motion capture suit could be any limb.”
robotics, electrical
To obtain the body movement data on which to While James notes that AOgmaNeo is actually
and mechanical
engineer, James base the arm’s movements, James considered meant for reinforcement learning,“in this case
is a fan of doing using a brain computer, but this would be we know what the output should be rather
it yourself and unreliable without embedding electrodes in than it being unknown and learning through
innovation by trial
and error. his head! So, he instead opted to train it with binary reinforcement.”
machine learning. To train the model, James used distinctive
magpi.cc/
jamesbruton For this he created a motion capture suit from repeated motions, such as walking, so that the
3D-printed parts to gather all the data from his prosthetic arm would later be able to predict what
body motions: arms, legs, and head. The suit it should do from incoming sensor data. He also
measures joint movements using rotating pieces spent some time standing still so that the arm
with magnetic encoders, along with limb and would know what to do in that situation.
head positions – via a special headband – using
MPU-6050 inertial measurement units and New model arm
Teensy LC boards. With the machine learning model trained,
Collected by a Teensy 4.1, this data is then Raspberry Pi Zero can be put into playback mode to
fed into a machine learning model running on control the backpack-mounted arm’s movements
Quick FACTS
The motion capture suit comprises 3D-printed
parts, each equipped with a magnetic rotary
encoder, MPU-6050 IMU, and Teensy LC
> T
he project took
James a few
months to create
aspberry Pi Zero can be put into playback mode to control
R
> H
e designed and
the backpack-mounted arm’s movements intelligently 3D-printed the
robot arm parts
intelligently. It can then duplicate what the James admits that the project is highly
wearer’s real right arm was doing during training experimental and currently an early work in > It uses three high-
depending on the positions and movements of progress. “I’d like to develop this concept further,” torque XM540-
other body parts. he says, “although the current setup is slightly W270-T servos
So, as he demonstrates in his YouTube video overambitious and impractical. I think the next step
> T
he arm is
(magpi.cc/mlarmyt), if James starts walking on will be to have a simpler set of inputs and outputs.”
mounted on
the spot, the prosthetic arm swings the opposite While he generally publishes his CAD designs
2020 aluminium
way to his left arm as he strides along, and moves and code, the arm “doesn’t work all that well, so
extrusions
forward as raises his left leg. If he stands still, the I haven’t this time. AOgmaNeo is open-source,
arm will hang down by his side. The 3D-printed though (free for personal use), so you can make > T
hese are fitted to
hand was added purely for aesthetic reasons and something similar if you wished.” What would you a standard
the fingers don’t move. do with an extra arm? frame backpack
F
or centuries, astronomers have used positions based on the current time and date. It
orreries to simulate the motion of the then presents the planets revolving around the
planets around the sun. These mechanical sun, showing their relative circular orbits.
models of the Solar System originated around
150 BCE, but they gained their name when English
nobleman Charles Boyle, the Fourth Earl of Orrery, T he cool part is that no
commissioned his own planetarium in 1713 based
on a design by clock makers George Graham and external data is needed
Dmytro Panin
MAKER
Thomas Tompion.
Dmytro Panin would love to have one. “They’re “The cool part is that no external data is
a bit on the bulky side, but I may attempt to build needed,” Dmytro says. “The positions of the
Dmytro is a
programmer based an orrery one day,” he says. In the meantime, planets are calculated on board and the only
in Kyiv, Ukraine, and he has produced a digital version that is equally thing that the system knows is the current time,
he wrote his first
captivating and useful, powered by a Raspberry which comes from the RTC module.” It makes the
line of code aged
eight. He works for Pi Pico microcontroller. “Astronomy has always build a relatively straightforward one to replicate
a large provider of fascinated me, and I wanted something that I could and Dmytro has been more than happy to make
nearshore software look at and see the planets in the Solar System it open-source. He even shares his design for a
engineering services.
progress over time,” he continues. “So I built a 3D-printed case.
magpi.cc/ visual reminder.” But why choose the Raspberry Pi Pico for this
picosolar
project? “Microcontrollers are amazing: you have
A star build a tiny object which can execute your commands
His project is out of this world. As well as Pico, it and do virtually everything with extremely low
uses two other main components: a Waveshare power consumption. When I found out about the
Precision RTC expansion module with an on-board new RP2040 microcontroller and checked the
DS3231 chip and a Pimoroni Pico Display Pack. specs, I knew it could became part of my next
This allows the device to calculate the planets’ build,” he says. “I was particularly interested
Quick FACTS
> It depicts the
relative positions of
the planets
Space to think
Dmytro has also added some neat flourishes to his
creation. To start with, he wanted to figure a role
for Pluto – the celestial body demoted to the status
of dwarf planet by the International Astronomical
Union in 2006. “I decided to represent the seconds
by having Pluto bounce, starting from the full
amplitude to just rolling at the bottom of the
screen when a minute is about to end,” he says.
He also made use of the Pico Display’s tiny
buttons so that past and future planetary positions
can be viewed on the screen. Most of the time,
however, it just sits on a shelf in his line of sight,
allowing him to keep track of the current positions.
“It means I can always see it,” he says. “But the
downside is that I can end up mindlessly staring at
With just three main components and a
Pluto jumping around without realising how much 3D-printed case, the Solar System Display
time has passed.” is a simple, yet very effective, project
Cyberdeck portable
entertainment system
Action adventurers and sci-fi tales inspired a Raspberry
Pi-concealing portable box of tricks. Rosie Hattersley peers inside
T
hough more of a wordsmith than a tech
expert, Justin Forsythe had enough of an
interest in technology to take a master’s
degree focusing on our relationship with it. “I’ve
Justin
MAKER
Kodi TV streaming
software provides on-
the-go entertainment
A separate control
panel is used to
adjust the neon
lighting scheme
Quick FACTS
> Justin was
reading William
Gibson’s
Neuromancer
when inspiration
struck…
Case study
He sourced a Nanuk 910 waterproof case from
C4Labs, which has a fan inside and pins to connect
to Raspberry Pi, “so that when the board receives
power, it’s also being cooled”. Furthermore, the
The bespoke decal hints case design meant “I could throw this entire project
at something intriguing
inside, despite the case’s
in the river, pull it out and open it, and the setup
deliberately subtle colour would be dry and ready for use.”
xxxxxxxxxxxxx
On the case
A sturdy, ideally waterproof case, a handheld
gaming pad, a power pack, and a small screen to
connect to Raspberry Pi 3 or 4 form the basics of the
Cyberdeck setup.
he tantalises.
Zippy
Tomasz Burzy aimed for the stars with his latest project but reality brought his ambition
back down to earth. The result is no less impressive, as David Crookes discovers
S
ince February this year, NASA’s Raspberry Pi Zero W computer. “It’s helped me
Perseverance rover has been trundling become acquainted,” he says – although his dream
across the surface of the Red Planet as of replicating the rover is still very much in mind.
part of the space agency’s Mars 2020 mission. Its
cameras have taken many amazing photographs Game on
of a barren landscape and eerie sky, attracting Since starting the project, Zippy has evolved
millions of viewers and inspiring a new generation and the latest version – 3.0 – is an impressive
Tomasz Burzy of scientists and engineers. build. It makes use of a printable modular
MAKER
26 magpi.cc Zippy
PROJECT SHOWCASE
Quick FACTS
Zippy is an agile tank that’s easy
to control thanks to the integration > The components fit
of an Xbox One gamepad into the centre of
the tank
Zippy magpi.cc 27
SUBSCRIPTION
SUBSCRIBE TODAY
FROM ONLY £5
Subscriber Benefits
FREE Delivery
Get it fast and for FREE
Exclusive Offers
Great gifts, offers, and discounts
Great Savings
Save up to 35% compared to stores
FREE Raspberry Pi
Zero W Starter Kit
WITH YOUR FIRST
12-MONTH SUBSCRIPTION
Subscribe in print
today and you’ll
receive all this:
Raspberry Pi Zero W
Raspberry Pi
Zero W case with
three covers
USB and HDMI
converter cables
Camera Module
connector
This is a limited offer. Not
included with renewals.
Offer subject to change or
withdrawal at any time.
SUBSCRIBE
on app stores
magpi.cc 29
FEATURE
R A S P B E R RY P I
SMART
GADGETS Transform an ordinary object into a smart thing
by putting a Raspberry Pi in it - by Phil King
S
mart gadgets are everywhere these days, but
p33 you don’t need to buy them ready‑made. Using
Raspberry Pi as a brain makes it easy to transform
existing appliances and devices into smart ones. Or, you can
p33
even use it to build your own custom products from scratch,
to suit your own precise requirements.
Here we present a range of amazing projects to create
smart devices for every aspect of your life. We hope they
inspire you to make your own – let us know if you do!
Dog
Translator
p35 p34
p32 p32
G u it a r P e d a l
H
ea
ter c ue
M eter B arbe
30 magpi.cc Raspberry Pi Smart Gadgets
FEATURE
Home appliances
S
mart home appliances are really taking
off, but you don’t need to trash that old
washing machine or fridge. Make it smart
with a Raspberry Pi.
• Uber Home
Automation
Water Dispenser magpi.cc/uberhome
After calculating that he spent 15 hours a year filling water • Smart Waste Bin
bottles from his fridge’s painfully slow dispenser, Chris magpi.cc/smartbin
magpi.cc/
Maker: Joe Truncale electricalsafety
url: magpi.cc/thermos
Maker: Bryan Mayland PROJECTS a Raspberry Pi brain. With a suspended thermal sensor
array to detect the temperature of the pan below, and a
url: magpi.cc/heatermeter • Picrowave Camera Module to help monitor cooking progress using
magpi.cc/picrowave machine learning, a servo motor controls the dial on the
induction stove.
BrewPi
• Tea-Pi magpi.cc/teapi
• Voice-Controlled
Maker: Ben Cobley
The key to successful beer brewing is to carefully control Coffee Machine
url: magpi.cc/onionbot
the fermentation temperature. The documentation on magpi.cc/voicecoffee
the BrewPi site shows how to hack a standard fridge to
convert it into a smart fermentation chamber by adding
a heater and sensors. A ready-made BrewPi Spark unit
• Chamber Sourdough
Incubator Smart Bartender
monitors and controls the temperature, connected to magpi.cc/chamber For the ultimate in luxury, you could hire your own
a Raspberry Pi which logs data and provides a web personal bartender. But it’s far cheaper to just make a
interface, but it’s possible to build your own DIY version. robotic one using Raspberry Pi. With the ability to mix up
You could even use BrewPi for sous vide-style cooking. to six ingredients together
at the same time, this one
Maker: Elco Jacobs can serve you anything from
url: brewpi.com a rum and coke to a Long
Island iced tea. You could
customise the device to
change ingredients and add
more drinks, or even link it up
to a voice assistant.
Cat Speedometer
These giant hamster wheels for cats are brilliant for
indoor exercise, but have you ever wondered how fast
your cat can run on one, and how far? Shawn decided to
Tweeting Cat Flap find out by fitting his wheel out with a Raspberry Pi Zero
and a reed switch base to sense the six magnets around
Cat flaps are ideal for letting your furry feline friend the wheel passing it. From this, distance, speed, and top
wander in and out of the house as it pleases – which, let’s speed can be calculated and logged. Shawn discovered
face it, is what cats do. But what if a flap could do more? his cats were running 4–6 miles a night, at up to 14 mph.
Since Daphne was already active on social media, mainly
to complain about her ‘staff’ Kate Bevan. Bernie Sumption Maker: Shawn Nunley
thought she deserved a more tech-savvy cat flap. The url: magpi.cc/catspeedo RELATED
result is a portal that tweets a photo and message every
time Daphne passes through it (@DaphneFlap).
PROJECTS
• Hamster Fitness
Maker: Bernie Sumption & Kate Bevan Tracker magpi.cc
url: magpi.cc/tweetcatflap /hamsterfitness
• RaspiTrap humane
mousetrap
Maker: NerdStoke
url: magpi.cc/dogtranslator
IoT Kitteh “ The cat flap
Cats may wander miles around their neighbourhood. To tweets a
find out the location of his puss Lily, Jeremy invented a
vest to track her position using GPS. For communication photo and
purposes, he fitted it with a cellular connection. After
realising that a cat wouldn’t be able to answer the phone message
when called, he opted to send a message to the device
via AWS IoT and have it call him back automatically, as
every time
well as (perhaps more useful) sending GPS co-ordinates. Daphne
Maker: Jeremy Wall passes
url: magpi.cc/iotkitteh
through it ”
RELATED
Smart Wardrobe
Some people are
PROJECTS predicting that smart
• Pi Camera Cap wardrobes (aka closets)
Smart Watch
“ F or the Maker: Tan See Youu
url: magpi.cc/smartwardrobe
ultimate
Smartwatches are incredibly popular and the swankier
in one-
models are often worn as a status symbol. For the
ultimate in one-upmanship, however, you could be
upmanship,
Multi-effects Guitar Pedal
wearing your own custom-created, one-of-a-kind watch. For those who like to wear an electric guitar, a DIY effects
That’s what Tyler did, creating his Smart Watch to impress you could pedal will make it sound even better. We’ve seen a
a friend at work. It comprises a Raspberry Pi Zero W
and LCD screen, housed in a 3D-printed case that he be wearing few based on Raspberry Pi, but Raphaël’s is incredible,
featuring a touchscreen and offering serious sonic
designed. With the addition of a tiny joystick and buttons,
it can even play Minecraft!
your own capabilities with an innovative method for combining
effects. It is able to digitally create a complex parallel
custom- signal chain: “Something like the modular synth version
Maker: Tyler Suard
url: magpi.cc/smartwatch created, of guitar pedals,” he says. No off-the-shelf pedal can do
anything like it.
one-of-a- Maker: Raphaël Isvelin
kind watch url: magpi.cc/guitarpedalyt
”
• Containers Over-The-Air: Building Your First Edge AI Device the Easy Way
T
he Yamaha OPL2 FM synthesis chip – also Raspberry Pi’s Serial Peripheral Interface (SPI)
known as the YM3812 – was a powerhouse to be active. Open a Terminal and type sudo
of 1980s and early 1990s digital audio. raspi‑config. Select option 3 ‘Interface options’,
Released in 1985, it appeared on the classic AdLib, then ‘P4 SPI’. Select Yes to enable it, then Finish.
K.G.
MAKER
Game Blaster, and early Sound Blaster cards, as You’ll also need the WiringPi library, but this
Orphanides
well as Yamaha’s own keyboards. These relatively comes installed by default on current versions
K.G. makes, writes inexpensive OPL2 sound cards soon found favour of Raspberry Pi OS and will be pulled down
about and helps to among PC game developers keen to make up for automatically during installation if it’s not found.
preserve unusual the limitations of the timer-controlled internal
gaming software
and hardware. PC speaker. In this project, we’re going to relive
the heady days of 1980s computer music by
@KGOrphanides
Install and test the software
connecting Cheerful Electronic’s OPL2 Audio
Board to Raspberry Pi’s GPIO, playing classic
03 Open a Terminal window and type:
game soundtrack files and programming a simple
controller to play your own tunes. git clone https://github.com/DhrBaksteen/
You’ll Need ArduinoOPL2.git
cd ArduinoOPL2
> O
PL2 Audio Board sudo ./build
magpi.cc/opl2
Connect your OPL2 Audio Board
PL2 board libraries
> O 01 Use a jumper cable to connect VCC on the If all dependencies are met, you’ll be asked to
magpi.cc/opl2lib OPL2 board to board pin 2 (5 V) of Raspberry Pi’s choose which of Cheerful’s boards you’re using.
> 3
.5 mm to 3.5 mm GPIO. Connect GND to pin 6, A0 to pin 16 (GPIO 23), Select option 2 for the OPL2. Once built, the
stereo audio cable Data to 19 (GPIO 10), Latch to 15 (GPIO 22), Shift installer will show you a connection diagram. We’ve
peaker with
> S to 23 and Reset to pin 13 (GPIO 27). The pins have
3.5 mm input changed through various iterations of the OPL2
> 7
× female-female
board’s software, so check the documentation.
Dupont jumper Finally, use the 3.5 mm audio output on the board to
cables connect speakers or headphones. Powered speakers
are the best choice, as they’re less susceptible to
audible interference, but we’ve had no trouble using
headphones. For the sake of your ears, make sure
the board’s physical volume control is at minimum
before you start testing.
Set up Raspberry Pi
You can buy the OPL2
board as a kit to solder
02 We strongly recommend using a fresh install
together yourself of Raspberry Pi OS for this hardware project.
or, like us, as a fully
assembled item The OPL2 board controller software requires
DOWNLOAD
THE FULL CODE:
input-print_version.cpp magpi.cc/opl2git
> Language: C++
We’re going to include the opl2 library and playNote function to specify the channel we wish to
instruments header file, capture keyboard input, set play a note on (0 in this case), its ISO octave number
an instrument, and associate specific keys on the (5), and the note we wish to play. Useful examples
keyboard with notes to be emitted by the sound card. and explanations can be found in the Working with
Open Geany (or your preferred syntax- Instruments (magpi.cc/workingwithinstruments)
highlighting text editor) on Raspberry Pi’s desktop entry in the OPL2 board’s documentation and
and create a file called input.cpp in the same the indepth.md file that comes with its libraries.
directory that you copied midi_instruments.h to. These include instructions for creating your
own instruments and setting sustain – download
input_sustain.cpp (at magpi.cc/inputsustaincpp)
to see how this could work with our sample code.
Find your voice
07 To see which instruments are available for
you to use, open midi_instruments.h and take
Cutting keys
a look through it. In our example code, we load a
harpsichord voice from midi_instruments.h and
08 We’re going to handle key press detection
set it to a channel. We then use the OPL2 library’s with a popular, if limited, approach to keyboard
VCC
OPL2 board pin GND A0 Data Latch Shift Reset
(5V/3.3V)
Ready to compile
character capture using getch() from the
ncurses library. It works here because we
10 With your code in place, it’s time to Top Tip
only want to play one note at a time and will compile input.cpp. The online version of the file
be fixing the duration of each note in code. A includes an extra routine to display which note Take it to
more sophisticated control application would you’ve played. the bank
benefit from the SDL library (magpi.cc/sdllib), Open a Terminal in the directory containing
particularly its handling of KEYUP events. midi_instruments.h and input.cpp. Raspberry Pi To create and
Once a keystroke has been captured, it’s OS comes with the GCC compiler already installed. import OPL2
instruments,
written to a variable called key. We’ve then used We’ll tell it to use the OPL2, WiringPi, and ncurses
try Wohlstand’s
a short series of if/else statements to have each libraries. Type: OPL3BankEditor
keycode invoke a note from the OPL2. magpi.cc/
gcc -std=c++11 -Wall -o input input.cpp opl3bank
-lOPL2 -lwiringPi -lncurses
Ultimate home
Part 03
PJ Evans
MAKER
PJ is a writer,
software engineer,
and tinkerer. His
ambient music
collection has
been described
as “inspiring” (PJ
Create as many Plex provides a beautiful
Evans) and “just libraries as you like playback experience and
a load of random by dividing media won’t say a word about
noise” (Mrs Evans, into directories your musical taste
music teacher).
twitter.com/
mrpjevans
S
ound and vision is where we’re at for our (magpi.cc/109). We want to be sure our external
ultimate server project this month. Sure, drive is mounting on startup. Reboot and then issue
serving files is all very well (see The MagPi this one simple command in the terminal:
magazine issue #109, magpi.cc/109) but what
about a decent media interface? Luckily we’re spoilt df -h
for choice. We’re going to add two media serving
solutions, Plex and Mopidy, to our server. Plex is a The ‘df’ command is short for ‘disk free’ and
great choice for playing back your media anywhere shows you a summary of disk usage. If all is well,
in the world and Mopidy can turn your server into you’ll see the external drive (partition sdb1) mounted
a jukebox as well as a multi-room audio streaming to /mnt/huge (or whatever you decided to call the
system. We’ll also look at how to create your file mount point). If /mnt/huge does not appear in the
You’ll Need structure and how to add content from different list, refer back to the previous tutorial and make sure
sources. Let’s hit the play button. the entry in /etc/fstab is correct.
>R
aspberry Pi
ultimate server
magpi.cc/108
> Mopidy Before we plunge into the world of media Media streaming tends to involve a lot of
magpi.cc/mopidy streaming, let’s make sure your ultimate server is files. Before you find yourself in a mess, take some
correctly configured as per last month’s tutorial time to consider how you would like to structure
First-time Plexing
06 When we installed Plex, it started a web
server on port 32400. So all you need to do is open a
web browser on another machine (or the server itself
if you’ve installed a desktop) and go to:
http://ultimate.local:32400/web
Figure 1 Here’s an
example of a sensible (Replace the server name if you didn’t use
directory structure
for your media files. ‘ultimate’ when setting it up in part 01 of this series.)
Remember to create What you should see now is the Plex welcome
it on your external
mounted drive screen. Be patient: it can take a few seconds on
Initial setup
07 Plex will take you through a short wizard to
get things set up. Start by giving your Plex server
a name; we’ve chosen ‘ultimate’ to be consistent.
You can also opt for access to your Plex library from
anywhere on the internet. Plex will attempt to open
a port on our home router so you can access your
media from the plex.tv website. If you don’t want
to do this, ensure the checkbox is clear. Click ‘Next’
to start adding your libraries. One-by-one, select a
library ‘type’ (music, movies, etc.) when navigating
to the corresponding folder on your external drive;
Streaming to headless devices O
nce Plex is installed,
e.g. for ‘Music’, use /mnt/huge/Media/Music.
10 One restriction of Plex is that it requires
you need to add
each directory and
specify what type of
a device with some kind of interface to work and media it contains
plays audio to that interface. If we wanted to play
Library management
08 Plex will now start scanning your folders for
audio on the ultimate server itself, or stream to
another Raspberry Pi computer that is connected to
content. It will also access online databases to add speakers, we need to use Mopidy, a purpose-built
metadata to its library to make your collection as audio streaming solution. Luckily, Plex and Mopidy
complete as possible. Depending on the size of your can live side-by-side and even share libraries. To
collection, this process will take anywhere between install Mopidy and its user interface, Iris, follow the
seconds and hours. It’s a background process though, commands in the install_mopidy.sh listing. Once
so you can start using Plex right away as your media complete, you can access the user interface here:
appears. You’ll also notice that Plex will also offer
you online content – you can disable this if you wish http://ultimate.local:6680/iris/
or sign up for a ‘Plex Pass’ for a lot more features. If
you don’t like what Plex has ‘found’ for your media
types, you can always click the pen icon and edit the
metadata; Plex doesn’t always get it right. install_plex.sh DOWNLOAD
THE FULL CODE:
> Language: Bash magpi.cc/installplexsh
Mopidy is an
alternative to Plex,
designed for
local playback
and streaming
Warning!
Adding media to Mopidy
The laws covering the
ripping of CDs, DVDs
11 In the previous step we installed the
Add the following at the end of the file:
and Blu-rays vary from ‘local’ plugin, which allows Mopidy to access local [local]
country to country.
The private copying of file systems for media. One restriction is that it can media_dir = /mnt/huge/Media/Music
copyrighted material only support a single directory. Start by editing the
is illegal in the United
Kingdom. Check what config file: Remember to change this path if you’re using a
you want to do is legal different naming system or structure. Save the file
before proceeding!
sudo nano /etc/mopidy/mopidy.conf (CTRL+X), and instruct Mopidy to scan the contents,
magpi.cc/ripping
then restart:
Stream viewer-
controlled projects
with Surrogate.TV
Want a new level of interaction in your livestreams? Add Surrogate.TV
to your Raspberry Pi projects for super low-latency audience control
I
f you cast your mind back many years, you use. If you’re using a Raspberry Pi Camera
you’ll remember the craze of Twitch Plays Module or HQ Camera, plug it in the usual way
Pokémon. Using inputs from the user chat, via the CSI port, with the silver connectors on the
Rob Zwetsloot a computer would play through the video game connector ribbon facing in the direction of the SD
MAKER
and you’re logged in, it’s time to create a ‘game’ – of your wireless network. Enter the SSID and
the kind of thing you’ll have viewers interact with password of your home network and leave the rest You’ll Need
via Raspberry Pi. Click on ‘Create a game’ and it will of the options. Click Connect; you will be kicked
> Raspberry Pi 4
give you a checklist of stuff you’ll need – make sure off Raspberry Pi as it turns the hotspot off and
you have your wireless details to hand, like it says, attempts to connect to your wireless network. > Surrogate image
file: magpi.cc/
and then press Start. Reconnect to your own home wireless network
surrogateimg
Give your game a temporary name and URL – from your computer. Go back to surrogate.tv and
these can be changed later, but for now it will help click ‘Skip to dashboard’, where you should be able > Raspberry Pi
Camera Module:
us get all set up. Click Next. to find and control your ‘game’/Raspberry Pi.
magpi.cc/camera
you won’t need it connected to a monitor in this light should be showing next
part. From your other computer, copy the token
it displays, and then open your wireless settings to the controller name
and look for the hotspot that Raspberry Pi has
created – the SSID should be surrogate-rpi, and
Game testing
the password is surrogatetv.
When you’re connected to the hotspot from
06 If your Raspberry Pi doesn’t show up as a
Raspberry Pi, click Continue on your other controller in the Sets category, reboot Raspberry Pi Top Tip
computer. You will now be taken to a web page on and wait a few minutes. If that still doesn’t work, go
Raspberry Pi. back, reflash, and try again, double-checking your Compatibility
WiFi details.
If all is working, a yellow light should be showing The Surrogate
next to the controller name. If you click Preview, the image is based on
Raspberry Pi OS,
Set up Raspberry Pi
05 You should see a field to enter the token
camera you connected to Raspberry Pi should start
up and the feed will be displayed on screen.
so it should be no
problem to port
you copied in the previous step – paste it in and So far so good; now we need to check if the full your projects to it.
click Continue, and it will ask you to add the details system works and streams.
T
he game loop allows Stream testing
you to see how the
game is working in
07 On the game we set up, there’s a toggle you
everything, there’s nothing really to do right now;
however, you can see how it will work by going
real time
can click labelled Enabled. Do that and the yellow back to the dashboard in a separate tab and see
icon should turn green. Toggle the Game Online how it shows the current state of the stream.
setting above this as well, and then click on ‘Go to
game’ on the left and it will give you the stream
interface, hopefully with your camera feed.
Game templates
This feed is the watcher stream, which has
some delay; however, if you click ‘Play now’ you’ll
09 Included in Surrogate.TV are some
be momentarily allowed into the game. This in- templates for games to check out, including
game stream is very low-latency – saving that a simple robot using a fairly cheap robot kit.
bandwidth for when you need it. Change your Raspberry Pi settings by going to
the dashboard and clicking on its name under
Controller. Change it from Simple Game to ‘bot’
from the drop-down list.
Going for a loop
08 You may have heard the term ‘game loop’ in
Following the instructions here, you can build
the robot and wire it up to the GPIO on Raspberry
regards to game design – breaking the interactive Pi in the correct way. Mount your Raspberry Pi to
part of the game down to its core. In this instance the robot, turn it on with a mobile power supply,
it’s fairly similar, but with audience participation and you’ll be immediately be able to play with the
it’s showing what a viewer will do when controlling robot from your computer.
a game. As we’ve set up a simple game to just test
hook up a monitor and keyboard to it. Login with you can link to other Python code to pass on C
ontrolling simple
servos over
username pi and password creator1337, and then controls via the stream interface. the internet is
straightforward
type sudo raspi-config to open the command Otherwise, check out the handy tutorial with the right
line configuration tool. Go to Interfaces, SSH, and from Surrogate.TV (magpi.cc/customgame) bits of code and
Surrogate integration
enable it. for the basics you need on getting a fresh
Now is also a good time to change your script running. There’s also documentation
password by using sudo passwd pi. Before you for diving deeper in how to use Surrogate here:
disconnect the monitor and keyboard, type in magpi.cc/surrogatedocs.
hostname -I to get the IP address so you can SSH
in from your other computer.
Examples to try
12 If you don’t have a project in mind to hook
Custom game coding
11 In the case of the robot code from the
up, you can find some examples that might spark
your imagination at hackster.io/surrogatetv.
template, you’ll find it in games/bot/game.py in There’s some neat stuff involving robots and servos
the file structure of Raspberry Pi. Here you can to get you started. You can also check out some of
play around with the example code to see how it the games the Surrogate.TV folks stream on their
works. Of note is the Python library surrotg which website, as well as other users of the platform.
Top Tip
Playability
Make your game
engaging to
viewers by giving
them a high score
to go for!
T
his simple robot can
be entirely controlled
via Surrogate using a
template code
Wireframe
This tutorial first appeared in
Wireframe, our sister magazine
that lifts the lid on the world of
video games. Every issue includes
tutorials and in‑depth interviews,
along with news and reviews of
the latest indie and triple-A games.
To find out more, visit their website
at wfmag.cc.
Check out their subscription offers
at wfmag.cc/subscribe.
Source Code
Recreate Gradius’s
AUTHOR
rock-spewing volcanoes
MARK VANSTONE Code an homage to Konami’s classic shoot-’em-up
R
eleased by Konami in 1985, to provide the variations of trajectory that updated, we move the rock upwards by its
Gradius – also known as we need our rocks to have. We’ll need an speed and then reduce the speed by 0.2.
Nemesis outside Japan – actor created for our spaceship and a list This will make it fly into the air, slow down,
brought a new breed of to hold our rock Actors. We can also make and then fall to the ground.
power-up system to arcades. a bullet Actor so we can make the ship fire From this code, we can make rocks
One of the keys to its success was the way lasers and shoot the rocks. We build up the appear just behind both of the volcanoes,
the player could customise their Vic Viper scene in layers in our draw() function with a and they’ll fly in a random direction
fighter craft by gathering capsules, which star-speckled background, then our rocks, upwards at a random speed. We can
could then be ‘spent’ on weapons, speed- followed by the foreground of volcanoes, increase or decrease the number of rocks
ups, and shields from a bar at the bottom and finally the spaceship and bullets. flying about by changing the random
of the screen. In the update() function, we need to numbers that spawn them. We should
A seminal side-scrolling shooter, Gradius handle moving the ship around with the be able to fly in and out of the rocks, but
was particularly striking thanks to the cursor keys. We can use a limit() function we could add some collision detection to
variety of its levels: a wide range of hazards to make sure it doesn’t go off the screen, check whether the rocks hit the ship – we
were thrown at the player, including waves and the SPACE bar to trigger the bullet to may also want to destroy the ship if it’s
of aliens, natural phenomena, and boss be fired. After that, we need to update our hit by a rock. In our sample, we have an
ships with engine cores that had to be rocks. At the start of the game our list of alternative, ‘shielded’ state to indicate
destroyed in order to progress. One of the rocks will be empty, so we’ll get a random that a collision has occurred. We can also
first stage’s biggest obstacles was a pair of number generated, and if the number is check for collisions with the bullets: if a
volcanoes that spewed deadly rocks into 1, we make a new rock and add it to the collision’s detected, we can make the rock
the air: the rocks could be shot for extra list. If we have more than 100 rocks in and the bullet disappear by moving them
points or just avoided to get through to our list, some of them will have moved off-screen, at which point they’re ready to
the next section. In this month’s Source off the screen, so we may as well reuse be reused.
Code, we’re going to have a look at how them instead of making more new rocks. That’s about it for this month’s sample,
to recreate the volcano-style flying rock During each update cycle, we’ll need to but there are many more elements from
obstacle from the game. run through our list of rocks and update the original game that you could add
Our sample uses Pygame Zero and the their position. When we make a rock, we yourself: extra weapons, more enemies, or
randint function from the random module give it a speed and direction, then when it’s even an area boss.
Download
def drawRocks():
for r in range(0, len(rocks)):
rocks[r].draw()
def makeRock(pos):
r = len(rocks)
if r < 100:
rocks.append(Actor(‘rock’+str(randint(1,3)), center=pos))
else:
r = getOldRock()
rocks[r].pos = pos
rocks[r].speed = randint(6,12)
rocks[r].dir = (randint(0,60)-30)/10
def updateRocks():
if randint(0,10) == 1: makeRock((215,480))
if randint(0,10) == 1: makeRock((540,480))
shieldsUp = False
The Gradius volcanoes spew rocks at the player just before
VENTED
TUTORIAL
Stop-frame animation
Build your own stop-frame animated GIF creator
T
his project uses a Raspberry Pi Camera app = App(title="Stop frame animation")
Module and guizero to make a stop-frame
animation application (Figure 1). take_next_picture = PushButton(app,
To complete this project, you’ll need a Raspberry text="Take picture", command=capture_image)
Pi with an official Camera Module (or High Quality viewer = Picture(app)
Camera). If you need help connecting up the Camera
Module, take a look at the ‘Getting started with the app.display()
Camera Module’ guide at rpf.io/picamera.
Laura Sach
MAKER
You will need guizero installed with the optional Note that the higher the resolution, the greater the
Laura leads the ‘images’ functionality, which you can install by processing time. 400×400 is small but really quick
A Level team at running this command in the terminal: to process.
the Raspberry
The GUI contains a PushButton and Picture.
Pi Foundation,
creating resources pip3 install guizero[images] When the button is pressed, the capture_image
for students function is called. The function uses the camera
to learn about This project is broken down into stages: to capture an image and save it as frame.jpg. The
Computer Science.
picture is then displayed in the Picture widget.
@CodeBoom 1. Taking a picture with the camera and displaying Test the program (stopframe1.py, overleaf). When
it on a GUI you click the ‘Take picture‘ button, the image
2. Taking multiple pictures and saving them to a GIF should be displayed on the GUI (Figure 2).
3. Allowing the user to change the GIF
4. Tidying up the GUI Figure 1
Take a picture
Start by creating this program.
# Imports ---------------
Martin
MAKER
001. # Imports --------------- Each time a new image is captured, you will need to
002. open it and append it to your list of frames:
003. from guizero import App, Picture, PushButton
004. from picamera import PiCamera
def capture_image():
005.
006. # Functions ------------- camera.capture("frame.jpg")
007. viewer.image = "frame.jpg"
008. def capture_image():
009. camera.capture("frame.jpg") frame = Image.open("frame.jpg")
010. viewer.image = "frame.jpg"
frames.append(frame)
011.
012. # App ------------------- total_frames.value = len(frames)
013.
014. app = App(title="Stop frame animation") The len (length) of the frames list is then used to
015.
update the text in total_frames.
016. camera = PiCamera(resolution="400x400")
017. take_next_picture = PushButton(app, text="Take picture", Your program should now look similar to
018. command=capture_image) stopmotion2.py. Test it and make sure the number
019. viewer = Picture(app) of frames increases each time you take a picture.
020. .
021. app.display()
Save as a GIF
You can PIL to save all the frames as one animated
GIF. Create a new save_animation function to save
Take multiple images and save to a GIF the frames as animation.gif.
An animation is made of multiple pictures,
known as frames. Each frame in the animation def save_animation():
will be slightly different to the last and when if len(frames) > 0:
played together at speed, the animation will viewer.show()
appear to move. frames[0].save(
In this step, you will change your GUI to keep a "animation.gif",
list of all the frames taken and use PIL (Python save_all=True,
Imaging Library) to save the frames as an animated append_images=frames[1:])
GIF which will be displayed in the viewer. viewer.image = "animation.gif"
At the top of your program, import the Image else:
module from PIL: viewer.hide()
from PIL import Image There is a lot happening here, but by breaking
down the code you see how this works. If the
Create a list to store the frames of your animation: number of frames in the list is greater than 0, then
the viewer is shown, otherwise it is hidden.
frames = []
if len(frames) > 0:
To keep track of how many frames have been viewer.show()
taken, import a Text widget, add it to your app, ...
and set it to 0. else:
viewer.hide()
from guizero import App, Picture,
PushButton, Text The frames are then saved to a file called
animation.gif. The first frame (frames[0]) is saved,
total_frames = Text(app, text="0") the remaining frames (frames[1:]) are appended,
and all are saved to the animated GIF.
Figure 2
frames[0].save(
"animation.gif",
save_all=True,
append_images=frames[1:])
viewer.image = "animation.gif"
def capture_image():
camera.capture("frame.jpg")
viewer.image = "frame.jpg"
save_animation()
stopframe2.py
(overleaf). Test it out.
stopframe3.py
> Language: Python 3
Text(app, text="Duration")
duration = Slider(app, start=100, end=1000,
command=save_animation)
frames[0].save(
"animation.gif",
save_all=True,
append_images=frames[1:],
duration=duration.value) Figure 3 Controls stacked at the top
stopframe4.py
> Language: Python 3
Your code should now resemble stopmotion4.py. Aligning widgets to the left inside the box will
Try it out. make them stack up next to each other.
Repeat this for rest of the controls so they are
Align the controls all put into the top box and lined up next to
At the moment, the controls are taking up a lot of each other.
room stacked at the top of the GUI (Figure 3). Your complete program should look similar to
Create a Box and align it to the top of the GUI to 11-stop-motion.py (overleaf).
hold the controls, first adding it to the imports.
Create Graphical User
from guizero import App, Picture, Interfaces with Python
PushButton, Text, Slider, Box
For further tutorials on how
controls = Box(app, align="top") to make your own GUIs with
guizero, take a look at our
book, Create Graphical User
Modify the widgets so that they are in the
Interfaces with Python. Its
controls box and set the align parameter to 156 pages are packed with
"left". For example: essential info and a range of
exciting projects.
total_frames = Text(controls, text="0", magpi.cc/pythongui
align="left")
11-stopmotion.py
> Language: Python 3
Laura Sach
Create graphical
10/10
Face
Interaction
Tracking
pi-top.com/MagPi
Raspberry Pi is a trademark of the Raspberry Pi Foundation. †pi-top [4] and Robotics Kit with Expansion Plate sold separately. © CEED Ltd. 2021
Build an Android
tablet with Raspberry Pi
Emteria.OS is a version of Android for Raspberry Pi. Let’s use
it in its natural, portable environment, and use it for development
A
Build your tablet – part 1
ndroid on Raspberry Pi has been a topic
of discussion for years in specific spaces,
02 To make sure everything is working
and while there have been attempts in before fully committing to our build, we suggest
Rob Zwetsloot
MAKER
the past to port Android, emteria.OS has been just connecting Raspberry Pi 4 to the display at
the best way to use Android on Raspberry Pi for first. You may need to construct your screen,
Rob is amazing. He’s a few years now. With some recent great updates, however that is quite simple and there are full
also the Features
Editor of The MagPi, we’re revisiting this great OS to get it working as instructions here: magpi.cc/screenbuild.
a hobbyist maker, an Android tablet, and see how it can be used for You do not need to add the jumper wires between
cosplayer, comic Android dev. the control board and Raspberry Pi though, as you
book writer, and
will need to power Raspberry Pi and the display
extremely modest.
separately. You can use the special USB splitter
magpi.cc
cable that came with the SmartiPi Touch 2 case if
Raspberry Pi hardware
01 you wish to make it easier down the road, however
install – you may need to tell Windows to ‘run the and keyboard if you want to run through the
software anyway’ if a warning window pops up. process a little quicker. After setting your time You’ll Need
Once this is done, open the Emteria installer app, zone time, and date, you then need to select your
and you will be asked to login using the account WiFi network to connect to. Once again, if you’ve > Raspberry Pi 4
details you created earlier. From there, select your used Android this should be familiar. > Raspberry Pi Official
hardware (Raspberry Pi 4), choose the right SD card Now you need to activate your install (although Touchscreen
if you have multiple plugged in, and then click flash you can test it out for eight hours before doing Display magpi.cc/
officialdisplay
for the installer to do its job. this). We logged in via our account, but you can
enter a key if that’s easier for you. Skip the next > SmartiPi 2
Touch Case
two steps, agree to the EULA, and hit reboot for
magpi.cc/smartipi2
everything to be applied.
Initial emteria.OS boot > emteria.OS
04 Once the install has finished, plug your
emteria.com
A
ffixing Raspberry Pi to time of writing it is not supported in the OS. The for this stage), along with other settings for remote
the back of the official
touchscreen requires emteria team are working on it though, and some work, Ethernet connections, launching apps at
only screws and a DSI USB webcams are supported right now, so if you’re boot, etc.
ribbon cable
desperate to take photos there are ways.
A
ndroid Studio is the
development suite
for Android apps
C
hoosing specific
apps that can only be
used in Kiosk mode
can be great for kids
or cafés
Portability
11 As well as a portable battery, taking a
power supply with you can also work in case
you stop in a place with power. SmartiPi Touch
2 also has a stand, making it easier to use on
the go as well, however it does mean it’s not E
mteria uses a specific
program, much like Imager,
quite as slim when folded up – the stand part to burn the latest version of
can actually be removed with a screw to cut the OS to an SD card
down on this size, making the whole thing a
little easier to take with you.
Development tips
12 Emteria is based on the latest version
of Android – Android 11 – making it a great
development environment for Android apps.
Even just connecting it to a monitor, or using
the VNC functions, will allow you to test out
apps you’re creating.
Heading to developer.android.com will give
you some great beginner tutorials and sample
code on how to start, as well as the tools
needed to build apps.
p o ok
S up your
Rasp berr y P i
r a d e s f o r your
pg
Unnervinegsturian projects
ped
A
s dusk draws nearer and the days get
colder, we approach the most frightful
night of the year, where ghouls and
ghosts come out to play and witches and
werewolves can be heard in the distance. While
we can’t help you repel these repugnant ruffians,
we can enable you join them with some blood-
curdling builds.
This year we’re going to help you take your
regular projects and make them scary, allowing
you to save some time and put on the perfect
Halloween party. Read on, if you dare…
Malic ious
ag ic M irror
M
Add a serious scare to your
smart mirror – visitors beware!
M
agic mirror projects are very cool and
very practical, and also completely
terrifying if you program them to give
jump scares. When we first covered them in the
December 2016 issue, creator Bradley Melton
was already adding scary pictures to replace the
inspirational quotes.
Sadly, this module was never released for the
Magic Mirror system (magicmirror.builders), but
you can get a nice little module that adds seasonal
lights here: magpi.cc/mmlights.
If you do want to add something truly scary to
your existing magic mirror, though, look no further
than Charles Gantt’s ‘spooky surprise’ tutorial
here: magpi.cc/spookymirror. It has details on
how to add your own PIR sensor, and instructions
on how to program your mirror to do the scares.
Mirror in motion
How the motion sensing works in practice
Sho ck ing
nt a Detector
Sa
Go from ho ho ho to no no no
with this motion-sensing trap
– give it a go!
A new look
Instead of jolly old Saint Nick, we want a scary photo. We found this picture
T
he Santa Detector is a classic project from of a skull on black that is sure to give anyone the heeby jeebys. You can use
the Raspberry Pi Foundation, making use any other picture you like, or draw one yourself. To add a picture to Scratch,
of a PIR motion sensor hooked up to some go to the costumes tab, hover over the circle ‘Choose a Costume’ button at
Scratch code so you can find out when Big Red the bottom, and select upload costume. Delete the other costumes.
has arrived. Instead of Santa, though, what if it
just detected any passer-by to give them a fright?
Upgrading this project for our uses is fairly
simple. Instead of flashing a picture of Santa, we
can replace it with a scary picture. We can also add
a scream sound effect to Scratch to go with the
picture. Lastly, we’ll have to camouflage it so it can
1
reach the maximum number of people for a scare.
magpi.cc/santadetector
We all
scream
From our repository of spooky upgrades,
you will find a file called Wilhelm_scream.
mp3. In the Sounds tab, hover over the round
button at the bottom, and click Upload File
to upload this new scary scream to your
project. In the code, replace ‘whoop’ in the
play sound block with ‘Wilhelm_scream’.
2
70 magpi.cc Spook up your Raspberry Pi
FEATURE
Similarly spooky
Possessed portrait
This seemingly normal painting is actually a
monitor in a frame with a little PIR motion sensor,
activating an animation of the portrait screaming
at passers-by. It’s the same concept as the Santa
detector on a grander scale.
D ow n l o a
i m ag e s a d n e w magpi.cc/possessedpic
n
from ma d code
g
spookyu pi.cc/
pgrades
Hidden
from sight
When hiding your PIR sensor, you can go simple or advanced. We
like the simple method of secreting ours on a shelf nestled among
3
figures or DVDs. Make sure the monitor is visible to anyone who will
be passing by your hiding spot. If you want to go advanced, there are
some nice PIR cases you can print from Thingiverse. Haunted Jack in the Box
Instead of a PIR motion sensor, this project uses
a Raspberry Pi Camera Module to detect when
someone is specifically looking at it, setting off
an automated Jack-in-the-box with variable
speeds and sounds for maximum frights.
magpi.cc/hauntedjack
Frigh ten in g D ow n l o
i m ag e s a d n e w
a
from m nd code
h
s p o o k y ag p i . c c /
o ot
upgrad
o B
es
Ph ot
Create eerie images with these
cunning code tweaks – fun for Awful accessories
all ages! It’s quite simple to switch out the overlays for spooky props – simply add
any images you have (or ones from our repository) to the overlays folder of
A
familiar sight at official Raspberry Pi your All-Seeing Pi code. They should be PNG files with transparency. Give
events, the All-Seeing Pi is a fun photo them simple file names and then head to overlay_functions.py and change
booth that lets you add stickers to photos the contents of the overlays list to the names of the new images; e.g.,
of yourself and tweet them out into the world.
It’s a fun thing to replicate at parties and other overlays = ['witchhat', 'fangs', 'catears'].
kinds of events, including perhaps an upcoming
Halloween party of your own.
1
To make this appropriately alarming, a first
step will be to change the overlays from fun
sunglasses and wigs to fangs and witches’ hats.
We can add an extra, basic overlay filter with a
little trick as well.
magpi.cc/allseeingpi
Similarly spooky
Creepy Face Stomach shot
Tracking Portrait Freak out your friends by
making your camera and screen
Using a camera and a screen in a
portable so that you can see
much different way – to change
through yourself for the perfect
a creepy face so that it’s always
zombie costume.
looking at you. Always.
magpi.cc/stomachshot
magpi.cc/trackingportrait
Fearful filters
We’re going to cheat a bit here to make some filters. Draw or
find some photo borders with a clear centre and open them in a
photo editing program. Add a layer below the border and fill it in
with a light green or a light brown colour. Reduce the opacity of
the coloured layer to 30% and voilà, instant filter. Test it with a
photo on the layer below the border and colour to make sure it’s
2
what you want, and then save it to the overlays folder as before,
updating the list in overlay_functions.py. Alternatively, we’ve
created some you can use.
“I t ’
c
s
a
a
t e
f u
a
n
t
thing to
pa r t i e s
3
rep l i
kinds
and other
of events “ Double trouble
If you add an extra button to your All-Seeing Pi, you can have both the filters
and props show up at once. Create a separate folder for the filters called
filters and then copy the overlay_functions.py file to this folder, renaming it
filter_functions.py. Update the code inside with the new folder location name,
and change the overlays list to filters. Update allseeingpi.py by adding:
Follow the steps in the All-Seeing Pi tutorial to add the extra filters to the
images you take. There’s also a version of that code in our repository.
Das ta r dl y
p l ay Li ghting
Dis
Go from everyday LEDs to
haunted Halloween colours –
hang them from trees!
T
he amazing temperature-controlled
stair lights by Lorraine Underwood
(@LmcUnderwood) are a great way to set up
decorative lights anywhere – they don’t just need
to be on stairs. They also don’t have to be a rainbow.
We have a couple of options here to make it a
little more Halloween-themed, and that’s mainly
down to the colour palettes of the lights. Think
oranges, greens, and purples, classic colours for this
spooky time of the year.
“ Go all out an
d e c o r at e y o u r
d
h o m e w it h
l ig h t s a n d m u
s ic p o w e r e d
by Raspberry
Pi
“
Mysterious
music
You can have music dictate how your lights
move using LightShow Pi from Adafruit
(magpi.cc/lightshowpi). Even if you’re not going to
play the music, you can still use some tracks to help
randomise and animate your display – quicker than
programming it yourself.
3
Similarly spooky
Poplawski’s Holiday Lights
With an evergrowing selection of decorations, the
Poplawskis not only make their front porch spooky, they let
you control it over the internet.
magpi.cc/poplawski
Raspberry Pi Halloween
Lights and Music Show
Go all out and decorate your home with lights and music
powered by Raspberry Pi. We’ve also seen people hack
cheap projectors in recent years for this as well...
magpi.cc/hallolightsmusic
Keybow 2040
Pimoroni magpi.cc/keybow £50 / $57
E
ver since the release of Raspberry Pi swap them out for others if you’d like. There’s
SPECS Pico, we’ve been interested in its ability also a cheaper base kit for which you’ll need to
to power keyboards, both standard and provide your own switches and keycaps.
KEYS: custom. We’ve seen a couple of DIY projects
16 RGB LED
swappable
doing just this, and Pimoroni even released Lock on
keys in a 4×4 an add-on with a soft keys (RGB Keypad: Some construction is required, but it’s very
grid with magpi.cc/rgbkeypad) for Pico at its launch. It minimal – add the switches, sandwich the layers
mechanical, was only a matter of time before the RP2040 – together, and then put the keys on. We were
linear, and
the chip that powers Pico – would be used on done in a couple minutes, at which point you can
tactile key
options its own dedicated keypad with real keys. This actually start using the Keybow as a number pad
inevitable product ended up being another by plugging it in.
MICRO Pimoroni product: Keybow 2040. Unlike a standard Pico, the Keybow is
CONTROLLER: It comes with one of three sets of key switch connected via a USB-C cable to your computer of
RP2040 with
2MB of flash types depending on your preference: mechanical choice. There doesn’t seem to be any technical
memory (clicky-clacky), linear (silent), and tactile (silent
DIMENSIONS:
with some resistance). All versions have an LED
in the switch which is fully programmable, and
uch cheaper and more
M
76 mm × 76 mm
× 30 mm (L × W the keys are standard sized so you can easily hackable than some of the
× H, including
switches,
keycaps
commercial alternatives
and feet)
advantage to having USB-C; however, it does that change when pressed, and passing along a
mean the basic design has some forward specific combos of keys for when they’re pressed
compatibility for Pimoroni. Also, it’s nice to have rather than a single numpad key. Due to the way
more stuff making use of USB-C. A couple of it loads scripts, you can immediately test out
hardware buttons are also included: one to reset
the Keybow, and one to hold down to do the boot
your edits, making for very quick prototyping
and bug fixing.
Verdict
selection if you want to tinker with the code. We’ve been using a linear version for weeks
A premium-
now during streams as a custom stream deck, feeling product
Custom combo and it works perfectly with our custom setup (the that is easily
The code itself is written in CircuitPython, which code for which we’ll drop on magpi.cc/github). customisable and
is derived from the MicroPython – both can be It’s sturdy, turns on quickly, the LEDs are bright, priced much more
used on a regular Pico and they’re largely similar and we’ve had no noticeable lag on a button fairly than less-
open alternatives.
as well. Whatever changes you need can be press. With the removable caps, you can add
10
gleaned from the abundant example programs custom ones with specific labels like a mute icon
that are installed on Keybow 2040. or specific scene modes, etc., making it perfect
/10
With little effort we were able to change the for this, and much cheaper and more hackable
way the keys work – with constantly lit buttons than some of the commercial alternatives.
T
he PoE USB HAT for Raspberry Pi Zero
SPECS
not only adds an Ethernet port, but
POWER OVER enables you to power everything via the
ETHERNET: same standard RJ45 cable. A nice bonus is the
IEEE 802.3af- inclusion of three full-size USB Type A ports to
compliant PoE, connect peripherals.
37 V ~ 57 V DC
This double-decker HAT features the Ethernet
input, 5 V 2 A
output port and fully isolated SMPS (Switch Mode Power
Supply) on the bottom board, with a second board
CONNECTIVITY: stacked on top holding the three USB ports.
10M/100M RJ45
Ethernet port, Coming already assembled, the two boards are
3 × USB-A ports held together by hex pillars.
With Raspberry Pi Zero mounted on top, the double-decker HAT
Extra pillars and screws are supplied to mount adds three USB ports on the top board and PoE on the bottom
DIMENSIONS: your Raspberry Pi Zero on the top – maybe this
23.1 × 65 mm
should be called a HAB (Hardware Attached on
Bottom) rather than a HAT!
L eaves Raspberry Pi
Zero’s GPIO header free
Free header
Four pogo pins on The USB board has four pogo pins that connect to to connect other boards
the upper USB board
test pads on the underside of Raspberry Pi Zero,
connect to test pads
on Raspberry Pi Zero so you need to ensure it’s mounted tightly and underneath Raspberry Pi Zero is that it leaves the
accurately to make solid connections. latter’s GPIO header free to connect other boards
An obvious advantage of or electronic components.
mounting the HAT One caveat is that you’ll need an 802.3af
compatible router for Power over Ethernet to
Verdict
work. If not, you could always add a PoE switch
or injector between the router and HAT. With an
input voltage of 37 to 57 V DC and output of 5 V 2 A,
Adds both up to around 13 W of power can be supplied, which
PoE and extra
should be plenty for most uses. Alternatively,
USB ports to
Raspberry Pi Zero if you don’t need PoE, you could simply power
without using the Raspberry Pi Zero normally via micro USB, which
GPIO header. will in turn power the HAT.
8
While we’ve seen DIY solutions for adding PoE
or standard Ethernet connectivity to Raspberry Pi
/10
Zero, and USB ports via a hub, this HAT offers a
neat all-in-one solution.
T
he size of this Electronic Clock by
SPECS
Waveshare is impressive. At 21.9 by 7.9 cm,
it’s a chunky device and its 22×7 green LED
DISPLAY: display with large pixels is readable from a
22×7 pixel
green LED, fair distance.
plus status Lifting off the rear panel reveals the electronics
A Raspberry Pi Pico flashed with the software can
sidebar and and two female headers to mount your Raspberry be slotted into the clock’s rear female headers
top weekday
Pi Pico (not included). First, however, you’ll need
display
FEATURES:
to flash Pico with the software. The online manual
(magpi.cc/picoclockguide) is confusing, as
T he USP of this clock is
DS3231
RTC with
there’s no need to compile anything with terminal
commands if using a Raspberry Pi: just drag the
the ability to customise
temperature
sensor, backup downloadable UF2 across to the mounted Pico. the example code to
battery, You can then mount Pico onto the rear headers,
photosensor, close the rear panel (securing it with the supplied add extra functions
buzzer, 3 × screws), plug it in, and the clock will start working.
push-buttons,
the correct time even if disconnected from 5 V
DIMENSIONS: Customisable clock power (via the supplied USB to micro USB cable),
216 (W) x 79 (H) With settings adjusted using three push-buttons although you’ll lose any custom settings. There’s
x 25 mm (D) on the side, standard clock functions include two also an option to automatically adjust the LED
alarms, a timer, and an hourly chime option, all brightness based on the built-in photoresistor.
using the on-board piezo buzzer. There’s also the The unique selling point of this clock is the
option of scrolling the display every three minutes ability to customise the example code and add
to show the date and temperature (in °C or °F, read extra functions, which is done solely in the
Verdict from the on-board RTC chip’s built-in sensor). C/C++ programming languages - there’s no
That RTC (real-time clock), along with a CR2032 official MicroPython support.
Solidly built with a coin cell battery, means the clock will remember
large display, it’s
a cool clock, and
the demo code
is customisable
– although you’ll
need to know
your C++.
8 /10 The chunky LED display is impressive and has rear panel holes for
wall mounting
Code
Configure
Analyze
P R O FES S I O N A L CO N T R O L SYS T E M D E V E LO P M E N T TO O L
cdpstudio.com
Tel: +47 990 80 900 • [email protected]
CDP Technologies AS // Hundsværgata 8, 6008 Ålesund, Norway
REVIEW
10 Amazing:
Raspberry Pi
instruments Soundfighter
A new challenger
Get musical with these Raspberry Pi-
What do you do once you’ve mapped piano keys to a PS2 controller? You build
powered musical creations a second, identical piano and duke it out in Street Fighter. Go home and be a
piano man.
R
aspberry Pi is an incredible piece of hardware for
magpi.cc/soundfighter
audio, and we know many people that use it for
amazing sound systems. Did you know you can
also create music on it? Not just with code either, as these
projects show! Piano stairs
Up the scale
You don’t just have to make music
with your hands – with a little
inspiration from Big, you too can
turn a little fun stair workout into a
musical experience.
magpi.cc/pianostairs
Hex Keys
Trill MIDI Guitar
Isomorphic keyboard
New electric guitar
One of the great instruments designed by Mike Cook, this laser-
cut keyboard is quite different to a traditional piano keyboard, but Another invention from Mike Cook, this excellent MIDI guitar uses special Trill
can still make amazing tunes. touch sensors and a little display to create a cool, customisable guitar.
magpi.cc/pibakery magpi.cc/trillguitar
magpi.cc/pianovisualiser
MIDI Trumpet Robot
Automated jazz
This trumpet is played by robotic fingers depressing the
valves, with MIDI sound actually playing from a speaker at the
mouthpiece. It’s controlled over the web.
magpi.cc/miditrumpet
Pedal Pi
Effects via Raspberry Pi
Ultrasonic theremin
This amazing project isn’t an instrument per se, but it is part of one – a guitar
Spooky tunes
effects pedal with a huge amount of customisation.
With an ultrasonic distance
sensor, you can control notes
magpi.cc/pedalpi
on Sonic Pi to create eerie
tunes, perfect for a 1950s alien
invasion B-movie vibe.
magpi.cc/theremin
magpi.cc/xylophone magpi.cc/guitarrig
Learn networking
with Raspberry Pi
Discover more about computer networking
using these resources. By Phil King
An Introduction
to Computer
Networking
for Teachers
Raspberry Pi Computer networking gives around six hours to complete, of networking. Week one,
AUTHOR
Foundation us access to the internet and over three weeks, although ‘Creating Connections’,
allows us to communicate with you can work at your own pace. covers the basics of computer
Price:
people all over the world, but Signing up for a free account network connections; week two,
Free
how many of us know how it gives you five weeks’ access ‘Packets & Protocols’, explores
magpi.cc/
really works? to the course, but there’s IP address and packets, along
introtonetworking
Aimed at computer science the option to upgrade for with protocols such as TCP/IP,
GCSE teachers, this foundation continued access and to receive DHCP, and NAT. The final week,
course is a useful starting a certificate of achievement. ‘The Net as a Network’, covers
point for anyone curious about The self-guided course the World Wide Web, cloud
computer networks. It takes teaches you the fundamentals computing, and cybersecurity.
Online courses
Study networking with LINUX NETWORKING AND the use of sockets in network
ADMINISTRATION (LFS211) programming, including methods
these interactive courses Aimed at IT professionals, this for testing applications.
self-paced course from the magpi.cc/flpythonnetwork
Linux Foundation is pricey
($299) but offers 50 hours of A TO Z LINUX
course material including videos NETWORKING CONCEPTS
and assignments. This Udemy course (£59.99) aims
magpi.cc/lfs211 to improve your Linux network
administration skills by learning
NETWORKING WITH PYTHON to build, maintain, and secure a
Another free course from the computer network.
Raspberry Pi Foundation, it covers magpi.cc/azlinuxnetwork
Raspberry Pi
Networking
Cookbook
Rick Golden For a Raspberry Pi-specific
AUTHOR
Mastering
Reference manual is ideal
for learning a host of
Python
useful commands.
magpi.cc/
debianrefnetwork
Matt Gray
A YouTuber with a penchant for making, with an
amazing Raspberry Pi-powered Game Boy Camera
M
The Fast WiFi Adapter is att Gray has been making
a modern way to interact
with classic tech for years – both in terms
of cool projects and
also cool YouTube videos. He’s
recently been in the spotlight
for a great hack of a Game Boy
Camera; however, he deserves a
bit more fanfare than that for all
he does.
“I’m a Broadcast Engineer
by day, but I’ve been making
videos on YouTube for over a
decade now!” Matt explains to
us. “I’ve also helped organise
Electromagnetic Field Festival, a
non-profit UK camping festival
for those with an inquisitive
mind or an interest in making
things: hackers, artists,
geeks, crafters, scientists,
and engineers.
“I’ve been making bits and When did you learn about Boy like a game, but converts
bobs for years, the bigger Raspberry Pi? it into a camera. The photos it
projects generally being ones I found out about Raspberry Pi takes are really low resolution
that make me laugh: The when it very first came out, and (128 × 112 px) and greyscale but,
Webcycle, an exercise bike that I used the original Raspberry considering that, I’m always
only lets you use the internet Pi as part of the Freddie surprised by how clearly the
when you’re pedalling. Mercury Thermometer. photos can come out
“The Freddie Mercury It was only ever designed to
Thermometer, because it Where did the Game Boy take 30 photos, print them using
seemed like no-one had made Camera hack idea come from? the Game Boy Printer, then
that joke yet. I’ve had my Game Boy Camera delete them to make space for
“[And] the Hoverpub, where since the 1990s: it was my first more. But after years in a box, I
we converted a small hovercraft digital camera, and I love it! It’s a wanted to use it again, and after
into a pub!” cartridge that goes into the Game some searching online, I found
We’re
fans of the very
clean insides of the adapter
a long-winded way to get photos charger and a switch. I’ve Testing out various
functions of BMOctoprint
off the camera around 2013, and programmed [this] Raspberry
was able to start using it again Pi so that when you turn it on
to not only take photos, but also with the camera plugged in, it
share online. automatically runs the cartridge
Its 30-photo limit was getting reader’s software to extract
annoying after a while, and I photos from it, and save them
didn’t want to also have to lug a onto Raspberry Pi. Then it hosts
laptop and bunch of cables and a WiFi network, so you can
adapters around with me to be connect to it and download the
able to clear it off. Then it hit photos from its web page.
MagPi
Monday
Amazing projects direct from our Twitter! 01
E
very Monday we ask the question: have you
made something with a Raspberry Pi over
the weekend? Every Monday, our followers
send us amazing photos and videos of the things
they’ve made.
Here’s a selection of some of the awesome things
we got sent this month – and remember to follow
along at the hashtag #MagPiMonday!!
01.
This is a very neat project, and we do
appreciate it being able to monitor multiple
tanks at a time
02.
Hopefully it still retains some of that
Raspberry Pi 400 power though
03.
Sensors like this are slightly harder to make
than you’d think, so we appreciate this build
02
04. A companion rabbit robot – a rabbot?
Robbit?
05. More excellent use of weight sensors
with Hexabitz
06. This cute case has a secret surprise
07. A very fun project to do with people of
all ages!
08. ‘Robot chaos’ is what we call our drawer
with robots we’ve reviewed
09. The Model D looks very swish
10. We hope the fish appreciate their high-tech
living space
11. The full Planets Suite by our new
favourite orchestra
03 04
05
09
06
08
07
11
10
Raspberry Pi
Computing Education
Research Centre
The new University of Cambridge department will make learning better
I
f you’ve been paying attention to the work of Foundation and the invention of the Raspberry Pi Gender studies are
among those that have
the Raspberry Pi Foundation, you’ll have seen computer. More recently, we have collaborated on been commissioned
all the studies into how different backgrounds Isaac Computer Science, an online platform that from the Raspberry Pi
Foundation
effect the way people learn and interact with is already being used by more than 2500 teachers
computing. With this new initiative, this research and 36,000 students of A level Computer Science in
will be able to be applied to new learning. England, and that we will shortly expand to cover
“With computers and digital technologies GCSE content.
increasingly shaping all of our lives, it’s more “Through the Raspberry Pi Computing
important than ever that every young person, Education Research Centre, we want to increase
whatever their background or circumstances, understanding of what works in teaching and
has meaningful opportunities to learn about how learning computing, with a particular focus
computers work and how to create with them.” on young people who come from backgrounds
Philip Colligan, CEO of the Raspberry Pi Foundation, that are traditionally under-represented in
wrote in a blog (magpi.cc/rpcercblog). “That’s our the field of computing or who experience
mission at the Raspberry Pi Foundation.” educational disadvantage.
“The Research Centre will combine expertise
New research from both institutions, undertaking rigorous
“The new Research Centre is a joint initiative original research and working directly with teachers
between the University of Cambridge and the and other educators to translate that research
Raspberry Pi Foundation,” Philip continues. into practice and effect positive change in young
“[It] builds on our long-standing partnership peoples’ lives.”
with the Department of Computer Science and If you’d like to get involved, you can
Technology. That partnership goes all the way subscribe to the research newsletter here:
back to 2008, to the creation of the Raspberry Pi rpf.io/research-update.
90 magpi.cc Mondays
Coolest
This Month
Projects
are
in for
Raspberry
Pico
online! Pi
THIS MONTH IN RASPBERRY PI
The folks at Argon make great cases, and this four-bay NAS box for “Home Automation HAT is a home monitoring and automation controller
Raspberry Pi 4, that they’re crowdfunding, looks like an amazing HAT for the Raspberry Pi that can control up to two appliances/devices
piece of kit. This case will be made from aluminium with a triangular on a load of 250 VAC/7 A, 30 VDC/10 A, photo-coupling isolation
design, and will also be used for cooling. It even has a cute little Optocoupler EL357NC, allowing users to safely control high voltages or
OLED display. current devices.”
kck.st/3BR153B kck.st/3ksMnbY
Pallet Town
What-If machine Stock ticker sequencer
A 3D-printed Futurama prop that you can We always love a nice e-ink display project, Similar to our favourite digital orchestra,
ask any What If question, which it will and this one is a cool, simple one that this sequencer plays the Pallet Town music
answer with a random episode of Futurama. tracks your favourite stock. from the original Pokémon games.
Your
Letters
Universal projects
Now that Raspberry Pi 4 is out, what about an article about some
great projects for the old Raspberry Pi 3A+? I have a Raspberry Pi
3A+, and am having a hard time finding good projects to use it for.
Maybe a WiFi radio? Digital photo frame (though it might not have
enough RAM)? Anyway, just thought it might be a fun article.
Raspberry Pi 3A+ is
still a great computer
that can be used for
amazing projects
Credit: Pete
Birkinshaw CC BY 2.0
Wow, that is a long history with computers. Thank you for sharing
your story with us! We hope your great-grandson enjoyed his first
steps with Raspberry Pi, and will have fun making projects with one
for years to come.
Contact us!
> Twitter @TheMagPi
> Facebook magpi.cc/facebook
> Email [email protected]
The new Astro Pi are much more powerful > Online raspberrypi.org/forums
than the previous ones
SAVEUP
TO
35%
on the cover price
ISSUE #47
OUT NOW
hsmag.cc
COMPETITION
Competition magpi.cc 95
T H AT M A D E
OUT
“The Computers That Made Britain
is one of the best things I’ve read NOW
this year. It’s an incredible story of
eccentrics and oddballs, geniuses and
madmen, and one that will have you
pining for a future that could have been.
It’s utterly astonishing!”
- Stuart Turton, bestselling author
and journalist
Available on
Features Editor
Rob Zwetsloot
[email protected]
Sub Editor
Nicola King
ADVERTISING
Charlotte Milligan
[email protected]
+44 (0)7725 368887
DESIGN
criticalmedia.co.uk
Head of Design
Lee Allen
Designers
Lucy Cowan, Sam Ribbits
Illustrator
Sam Alder
CONTRIBUTORS
Alasdair Allan, Mike Cook,
David Crookes, PJ Evans, Tom
Hadfield, Martin O’Hanlon,
Rosemary Hattersley, Nicola
King, Phil King, KG Orphanides,
Laura Sach, Mark Vanstone
PUBLISHING
Publishing Director
Russell Barnes
[email protected]
RASPBERRY PI
Director of Communications
Liz Upton
CEO
Eben Upton
DISTRIBUTION
OPERATING SYSTEMS
Seymour Distribution Ltd
2 East Poultry Ave,
London EC1A 9PT
+44 (0)207 429 4000
SUBSCRIPTIONS
Unit 6 The Enterprise Centre
Kelvin Lane, Manor Royal,
Crawley, West Sussex, RH10 9PE
+44 (0)1293 312193
magpi.cc/subscribe
Plus!
system which has been assessed as
conforming to ISO 14001.
Walk a Spider
Raspberry Pi (Trading) Ltd., Maurice Wilkes
magpi.cc/subscribe
Building, St. John’s Innovation Park, Cowley
Robot
Road, Cambridge, CB4 0DS. The publisher,
editor, and contributors accept no
responsibility in respect of any omissions
A life in electronics
Who knows where the time goes? By Mike Cook
I
t was all a mistake, I was meant these were the only lessons I had in When Raspberry Pi took over the
to be a chemist. Back when I was programming, but I was hooked! running of The MagPi magazine, I was
five-years-old I knew I wanted to After graduation, I worked on a approached to see if I could write for
be a scientist, and by ten, various form of audio compression called it. Previously I had one article
science toys convinced me it was adaptive delta, pulse code published in The MagPi magazine
chemistry. But I was dyslexic, which modulation or ADPCM, later to be issue #5 (magpi.cc/5), which made
was not recognised in those days. used by Microsoft and Apple. the front cover. However, ‘Mike’s Pi
This caused my teachers to predict I was in the right place at the right Bakery’ began in The MagPi issue #33,
low-level manual work to my parents time. In 1976 I built my first and ran all the way to issue #109.
when I was five. Also dyslexia computer from just the information Having reached the grand old
resulted in me going to a Secondary in the data sheet of the Signetics age of 70, I felt it was time to catch
Modern school, but they had no 2650 microprocessor. I got a up on all those projects I had been
Chemistry Lab. So when it came to wanting to do for years but never
picking a science subject at the age of
thirteen, it was Physics.
I was in the had the time. The first one is to
convert all the Sony 8 videotapes of
I left school at the age of 16 and got right place at my children growing up into a digital
a job as an apprentice technician at a format. However, I am not going
small electronics company in the right time for good, I expect to return for the
Oldham, being paid the princely sum occasional ad-hoc article.
of £5.50 a week. They allowed me to lecturing position at Manchester It has been an absolute privilege to
do a day release where I took an ONC Polytechnic’s Physics department, write in The MagPi magazine, and
(Ordinary National Certificate) and one day I was contacted out of attending various Raspberry Pi
course in Electrical Engineering. the blue by Mike Bibby. He had been events, and shows, meeting some of
This, in turn, enabled me to take a asked to start a magazine about my readers. Thanks for having me.
combined Physics & Electronics home computers and an ex-student
degree at Newcastle upon Tyne had told him about me. I agreed to do
Mike Cook
AUTHOR