Raspberry Pi: Problems
Raspberry Pi: Problems
CC/STORE
l
Track locan
r & p ollutio
weathe
PBERRY PI
RAS
PR OB L EMS
D!
R
E
F IXES FO
L
QUICK FAULTS!
SO
TRICKY
£5.99
magpi.cc/store
WELCOME
to The MagPi 92
I
f you have a problem, if nobody else can help, and – crucially
– if it’s Raspberry Pi-related, maybe you should buy The MagPi
Lucy
EDITOR
magazine. OK, so we’re not quite the A-Team, but we are experts Hattersley
at troubleshooting computers. Rob has put together an incredible
Lucy is editor of The
Raspberry Pi Problems Solved feature (page 28). From fixing pesky boot MagPi and an expert
in her chosen fields
problems to advanced system support, there’s advice for every maker. of retro computing,
imaginary dogs, and
We’ve got some top tutorials too. PJ has now added facial recognition pasta making.
Self-isolating since
to his magic mirror (page 50). He’s also found time to hack a Morse code the 1980s.
key to send messages to Twitter (page 42). I’ve been continuing to delve magpi.cc
into Raspberry Pi Shake earthquake data (page 46). Rosie and Phil have
been looking at weather and pollution tracking (page 60).
And that’s before we get to the community projects: from a CNC
machine hacked to become an Etch-a-Sketch (page 14), to a useful GET A
sourdough incubator (page 20), to an amazing clock that uses Instagram RASPBERRY
images for its digits (page 22). ZERO W KIT
We solve Raspberry Pi-related
problems, and the incredible
PAGE 26
community never lets us down. So
hunker down, ignore the outside
world for a while, and enjoy a
cracking edition of The MagPi.
See you next month!
magpi.cc 03
Contents
> Issue 92 > April 2020
Cover Feature
28 Raspberry Pi
problems solved
Regulars
06 World of Raspberry Pi
92 Your letters
97 Next Month
98 The Final Word
Project Showcases
10 Instaclock
14 CNC Etch-A-Sketch
16 Solar-powered Camera
18 Flying Saucer Clock & NAS
20 Chamber: Sourdough Incubator
22 PiVidBox 28
10 18
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.
42 50
Tutorials
82 Reviews
72 1.3″ Color TFT Bonnet
74 Maker pHAT
76 SaniaBOX
78 Top 10 audio projects
80 Learn retro gaming
Community
82 Dr Wednaud Ronelus interview
84 This month in Raspberry Pi
Dr Wednaud Ronelus interview 88 Events calendar
ARGON ONE 95
WIN
COOLING CASES
THE WORLD OF RASPBERRY PI
Raspberry Pi
Imager released
New official tool makes it easy to write an OS image to your microSD card. By Rosie Hattersley
R
Until now, aspberry Pi has launched an OS imaging experience is trying to make it as easy as possible
beginners had been
advised to buy a
tool called Raspberry Pi Imager. It makes it to get started.”
kit with Raspberry simpler to reuse an existing microSD or SD Despite options such as NOOBS and Etcher,
Pi software pre-
installed on a card card with Raspberry Pi. “when it comes to microSD cards, programming
The new tool enables Raspberry Pi users to them with your favourite Raspberry Pi operating
install the free Raspbian OS (available in three system has always been a little bit tricky,”
versions) along with a range of other operating says Gordon.
systems (magpi.cc/introducingimager).
Gordon Hollingworth, Director of Software Free to download
Engineering at Raspberry Pi, explains: “One of To get your copy of Raspberry Pi Imager, head
the most important aspects of the Raspberry Pi to magpi.cc/imager and select and download
the version of the imager for Windows, macOS,
T he utility reads the relevant file directly or Ubuntu. Raspberry Pi Imager will be auto-
installed and launched on your computer.
from our website and writes it straight to Inside Raspberry Pi Imager, you’ll find Raspbian
as default operating system. Click on ‘Raspbian
the SD card (Other)’ to choose Lite and Full versions of
Raspberry Pi releases
SD Card Speed Test
Raspberry Pi diagnostic tool lets you check your card’s efficiency. By Rosie Hattersley
R
aspberry Pi has launched its first
diagnostic tool. The SD Card Speed Test
tool measures the write and read speeds of
the card in your Raspberry Pi. The utility gives a
far more accurate indication of data throughput
than the putative write/read capabilities claimed
by card makers. A Raspberry Pi operating system
runs from the microSD card on which it’s
stored, so the card’s data transfer speed directly
correlates to how fast programs and files can be
loaded and read, as well as how fast data can be
saved to the card.
Instaclock
Designed to celebrate a new home, Instaclock
uses two Raspberry Pi computers to great
visual effect. Rosie Hattersley finds out more
T
here’s nothing like a deadline to focus the
mind! Copenhagen-based illustrator and UX
designer Riccardo Cereser was about to move
into a new apartment with his girlfriend, and was
determined his new home would have a unique Instaclock displays fun images
timepiece. Instaclock (magpi.cc/instaclock) is of numbers, rather than being
a standard timepiece
the result.
Having studied at the Copenhagen Institute of
Riccardo
MAKER
10 magpi.cc Instaclock
PROJECT SHOWCASE
Quick FACTS
> Digital sketching
Pressing the button switches tools were
the image set used to display invaluable for
the numbers on that screen planning this
project
Instaclock magpi.cc 11
PROJECT SHOWCASE
Graphics from classic made a RetroPie games console. He also had a friend
games may be used
to tell the time – can on the interactive design course who might just be
you work it out? able to help…
Creative coder Andreas Refsgaard
Install Raspbian on 8GB microSD cards, boot up, (andreasrefsgaard.dk) soon got involved, and was
02 and connect each Raspberry Pi to your wireless quickly able to come up with a Processing sketch for
network. Set a script to sync folders via Dropbox
Instaclock (magpi.cc/instaclockgit).
and use the cron scheduler to change the displayed
image every two minutes (or another interlude).
T hey also added a rule that
shuts a screen down if the
button on top of it is pressed
for ten seconds or more
Having spent dozens of hours looking into how an
API might be used to pull in specific images for his
clock, Riccardo was grateful that Andreas immediately
grasped how it could be done. Riccardo then set
Set the Processing sketch to launch at
03 startup (see magpi.cc/process). Disable the
parameters in cron for each Raspberry Pi used, so the
Instaclock loaded images at startup and moved on to
screensaver (so it doesn’t interrupt the clock script)
and hide the cursor. Back up the microSD card, then the next image set every ten seconds.
switch on. Repeat steps for the other Raspberry Pi. Because Riccardo wanted Instaclock to be as user-
friendly as possible, they also added a rule that shuts
12 magpi.cc Instaclock
PROJECT SHOWCASE
Assembly time
One of the most fun aspects of this project was
the opportunity to photograph, draw, or source
online images that represent numerals. It was
also the most time-consuming, of course. Images
reside in Dropbox folders, so can be accessed from
anywhere. Deciding on a suitable set of screens
to display them, and boxes or frames for them,
could also have dragged on but for an impromptu
visit to Ikea. Riccardo fortuitously found that the
Waveshare screens he’d selected would fit neatly
into the store’s Dragan file organiser boxes. He
was then able to laser-cut protective overlays
Visitors to Riccardo’s apartment have been intrigued and challenged by the
secured with tiny magnets. displays, which even feature the occasional maths problem
Instaclock magpi.cc 13
PROJECT SHOWCASE
CNC Etch-A-Sketch
Engineer Quint Crispin has been drawing lots of attention
to his latest project, as David Crookes discovers
F
or 60 years, the iconic Etch-A-Sketch
toy, invented by French electrician André
Cassagnes, has provided a blank canvas
that has both enthralled and infuriated. Many
of us will go no further than drawing some simple
straight lines and shapes. But there are some
amazing practitioners out there (check out Jane
Labowitch and Dave Roberts) who can generate
Quint
MAKER
Solar-powered
Raspberry Pi Camera
Kaspars Dambis has put an eye in the sky using his Raspberry Pi, as David Crookes explains
B
uilding a new family home from scratch boats and cars. This, he figured, would gather
is not for the faint-hearted. Neither, on energy from the sun to charge a 12 V battery and,
reflection, is climbing up a tree to install a with the use of an inexpensive 12 V-to-5 V buck
solar panel and a CCTV camera, and yet Kaspars module, power the Raspberry Pi 3 Model B and an
Dambis has done both. eight-megapixel Raspberry Pi Camera Module v2.
One thing led to another. “I wanted to monitor At first, Kaspars attempted to build a case from
the construction site remotely because we a generic project box, but he found it was relatively
currently live 100 kilometres away,” he says. But difficult to find decent clear glass for the camera
Kaspars
MAKER
Dambis rather than buy an off-the-shelf CCTV system, window. “I then noticed a dummy security camera
he purchased a dummy camera case, creating his in a local hardware store which had perfect clear
Kaspars is a own way of capturing images using a Raspberry Pi 3 glass on one end, and full weather projection for
web developer Model B computer. the battery-powered LED system,” he says. And
and electronics
“From the start, I wanted to keep watch over the this worked a treat.
enthusiast who
enjoys creating building of our home and create a time-lapse of
simple, low-
power connecting
the process for fun,” explains Kaspars. “I knew it
had to be a battery-powered and wireless system
T he weather protection
projects that use
microcontrollers. because getting mains power to the device wasn’t proved to be great,
going to be possible on a site like that.”
kaspars.net
even during the
Seeing the light
Kaspars picked up a lightweight 18 V 5 A solar panel winter months
that was marketed as being perfect for charging
Using hook-and-loop fasteners, the Camera
Module could be attached to Raspberry Pi’s case
which, in turn, was secured to the inner housing
of the camera casing. “The weather protection
proved to be great, even during the winter months,
and [my] Raspberry Pi never had issues with the
temperature ranges either.”
To get as much energy as possible, the solar
panel and the 12 V battery were positioned up
high on a wooden frame, with the security camera
device attached too. This wasn’t ideal. “The
battery was heavy and the frame broke during
a storm, so I created two separate frames: one
for the solar panel with the camera unit below
Alert! and another for the battery and the solar charge
Batteries controller,” he says.
included
Please take care with Monitoring from afar
rechargebable car Kaspars configured his Raspberry Pi to connect
batteries: Fitting the system in a tree prevents tampering and makes
magpi.cc/carbat the setup look less intrusive to a nearby WiFi access point via a standalone
In using an
inexpensive dummy
case, the resulting
The components – including build had the bonus
the solar panel and the battery of looking like a
in its waterproof casing – are security camera
affixed to a wooden frame and
placed outside
A
12 V, 7 Ah lead-acid battery has been sufficient to provide
an average power consumption of 2 W since it can provide
84 watt-hours of energy
A Raspberry Pi 3
modem plugged in at his neighbour’s
Model B computer
house by setting the access credentials in the
with a Camera
wpa_supplicant.conf file in the root of the SD Module requires
card. “The most basic time-lapse functionality significant power for
was added using a simple Bash script which takes continuous operation, Quick FACTS
a picture from the raspistill tool at the desired hence the decision to
time intervals and stores it on the SD card.” use a solar panel > The project cost
Connecting remotely involved setting up Kaspars $222
an external server and using the SSH tunnel,
> He’s also paying
autossh. When up and running, a photo is taken
for 10GB of
every hour and it can be downloaded using SCP
monthly data
when connected to the same WiFi access point as
Raspberry Pi. Video capture and real-time feeds > It should run
can also be viewed in a browser. for two days
It all means Kaspars is now able to remotely log without charging
in to his Raspberry Pi and eventually see his new
home come into being. There is still an element > Getting it up a
of fear, though. “The ability to connect to a tree was the
Raspberry Pi which is up in a tree powered by the hardest part
Flying Saucer
Clock and NAS
If you’re thinking of fashioning yourself a new clock, have you considered
one with an extraterrestrial twist? Nicola King has a close encounter…
U
K-based Harry Tansey is a maker who’d
been considering creating some form of
clock project for a while, when he was
inspired to make something that did more than
just tell the time. “I have been experimenting
with WS2812B LEDs (aka NeoPixels) over the past
few years and knew they were going to be a key
component,” he says. “When my NAS (network-
Harry
MAKER
Tansey attached storage) box started playing up last year, A side view of the saucer. Transparent segments are used to
diffuse the LEDs, with light blockers between them for
I knew I had to make or buy a replacement. Given
crisp separation
A software that both a NAS and a clock tend to be on 24/7, I
engineer, DIYer, started toying with the idea of ring of 60 LEDs as both time and money with expensive, failed 3D
and maker, with
clock segments and arranging the NAS components prints. “Failure can be expensive when the weight
interests in music
visualisation, XR, (Raspberry Pi, HDDs, and PSU) inside.” of filament in the project is just short of 2 kg! This
3D design and equates to nearly 120 hours of printing time – or
printing, Raspberry
Pi, microcontrollers,
Print perfect about four days using two 3D printers running
electronics, and So, the concept for the Flying Saucer Clock was simultaneously for around 14 hours a day,”
blinky LEDs. born, and Harry set about designing a prototype he calculates.
planetzarg.com using Fusion 360. Given that he was going to Harry also set himself another challenge: “It
3D-print the clock, he knew it was critical to get was critical to give the pieces enough tolerance so
the design as precise as possible, in order to save they could be used straight from the printer and fit
together with minimal surface finishing.”
Despite a few hiccups with his first attempt,
Harry pushed on, and the finished article is
something to behold. So, how is it constructed?
“The outer ring has 60 RGB LED segments
constructed simply by cutting a length of a
standard WS2812B LED strip and mounted in a
3D-printed holder with protrusions to keep the
LEDs fixed in place,” he says. “Lighting one of
outer LEDs red indicates the seconds, and a green
one indicates the minutes. I found that lighting
the two LEDs to either side of the minute LED
improved the readability.”
Harry also created an inner ring of LEDs divided
The saucer was into twelve segments, and one of these is lit in
designed in Fusion blue to indicate the hour. He then lit up some
360 and its numerous
parts were then hour markers on twelve of the outer 60 LEDs,
3D-printed; the STL
making it easier to track the positions of the
files are on Thingiverse:
magpi.cc/flyingsaucerstl minute and second LEDs. Harry chose a Raspberry
Pi 4 to drive the LEDs as he was “really excited by F ailure can be expensive > It’s lit up by a total
of 84 NeoPixels
the capabilities of [its] full-speed Ethernet and
USB 3 ports.” when the weight of > The twelve body
The Flying Saucer’s NAS file-sharing
functionality comes by way of two 3.5-inch drives, filament in the project is panels were
printed in vertical
secreted inside, and a fairly simple Samba setup.
“I have created different file share areas for work, just short of 2 kg! orientation
family members, and storage for my Linux-based > See how Harry
satellite TV/PVR receiver,” reveals Harry. made it here:
magpi.cc/
flyingsaucernas
Udderly ingenious!
Harry says that the feedback from family and
> Harry has around
friends has been very positive, but, he’s not twelve Raspberry Pi
finished there with his flying saucer. “There is boards around the
another ring of twelve RGB LEDs on the bottom house, including
of the UFO. These all face inwards and the final one controlling his
effect runs these in a slow pulsating pattern. With central heating
a semi-transparent cup that I borrowed from
my daughter, it makes a really convincing beam
effect that appears to ‘travel’ down the cup as the The two NAS disk
drives and Raspberry
light intensifies. I am going to use this together Pi are housed within
the saucer, powered
with a 3D model of a cow for the ‘traditional’ cow
by a 12 V PSU via
abduction effect.” three buck converters
Chamber:
Sourdough
Incubator
Having issues with your sourdough starter? Read on and be inspired…
here’s a radical baker using his loaf. Nicola King delves into the dough
W
hen maker, and baker, Trent Fehl first
started making sourdough bread, he
realised that keeping the starter at the
correct, steady temperature could be a bit of a
minefield. “I read all about different techniques for
keeping a culture alive – of the different conditions
to monitor, temperature was chief,” he tells us.
“Bakers have all sorts of tricks to achieve that
Trent Fehl
MAKER
lots of compatible hardware, and helpful guides.” people with this problem temperature
between 16
PiVidBox
Recycling tech in a different way so that young
kids can use it. Rob Zwetsloot checks it out
W
hen it comes to recycling tech, we
usually think of upcycling and the
excellent work on Martin Mander.
Roiy Zysman took a different approach, though,
with his PiVidBox.
“My project is a simple-to-use Raspberry Pi
based media centre that even children as young as
three years old can use,” he tells us. “It provides
Roiy
MAKER
magpi.cc/pividbox
e have thumb drives with
W thumb drive with our old favourite shows when
me and my wife want to watch some reruns of
cartoons, anime, and youth nostalgic shows,” says Roiy.
22 magpi.cc PiVidBox
PROJECT SHOWCASE
Quick FACTS
> PiVidBox can
also take SD
Need to read an SD card? cards thanks to
Use the card reader an adapter
PiVidBox magpi.cc 23
PROJECT SHOWCASE
The list of
components is fairly
simple – the only
I had the aha moment
where I was cleaning up
slightly quirky part
is a USB A male to
USB A female cable
24 magpi.cc PiVidBox
PROJECT SHOWCASE
Playing a video
PiVidBox magpi.cc 25
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 SUBSCRIPTION
Subscribe in print
for 12 months today
and you’ll receive:
Raspberry Pi Zero W
Raspberry Pi
Zero W case with
three covers
USB and HDMI
converter cables
Camera Module
connector
Offer subject to change or
withdrawal at any time
SUBSCRIBE
on app stores
magpi.cc 27
FEATURE
PBERRY PI
S
P RO
RA
BL EMS
SOL ED !
ND FIX ISSUES
A
DIAGNOSRE RASPBERRY PI
ON YOU OB ZWETSLOOT
WITH R SETTING UP
YOUR FIRST
RASPBERRY PI?
R
aspberry Pi is an incredible computer,
and we love using ours to experiment CHECK OUT OUR QUICKSTART
like some sort of eighties movie LED and GUIDE FOR COMPLETE STEP-
robot scientist. However, like everything, it’s not BY-STEP INSTRUCTIONS
flawless. Same with us Raspberry Pi users. Due to magpi.cc/quickstart
the unpredictable nature of mixing machine and
human nature, sometimes things go a bit wrong.
This is where this article comes in. Everyone
needs to learn how to correctly solve their
computing issues, and through this easy-to-
follow guide we’ll show you some common fixes,
starting from the basics, all the way up to more
advanced issues. Put away the soldering iron and
get ready to read.
32 01 Cables
Make sure that everything is properly
BLEMS
plugged in to your Raspberry Pi – this includes
RASPBIATART
doubt, give it a gentle jiggle in the slot and firmly
push it in. Double-check the other end of the
NOT S cables as well.
LEVEL
microSD card
02 Make sure a microSD card is inserted
properly into the underside of your Raspberry
ORK PR OBLEMS
NETW E CT TO THE
ON N
CAN’T C K OR INTERNET 03 Monitor
NETWOR
Connect to a monitor or display and turn it
on before booting your Raspberry Pi – sometimes a
Raspberry Pi won’t output a video signal if there’s
LEVEL nowhere for it to output to.
FEATURE
SIMP LE
TOP 10IONS FOR
SOLUTPROBLEMS
SIM PLE
EVERYONE’S A NEWBIE AT SOME POINT. HERE ARE SOME
COMMON PROBLEMS YOU MAY NEED TO LEARN ABOUT
OT ISSUES
LVING BO
SO RASPBERRY PI NOT TURNING ON PROPERLY?
HERE ARE SOME THINGS TO LOOK OUT FOR
No power LED
Very simply, this
means not enough
or no power is getting to your
Raspberry Pi. If the power supply
drops below 4.65 V, this red LED will
not light up. You may need to check your
power supply for faults, including a broken
connector, and replace it.
If you’ve checked your power supply and it’s
all working (on another device), if the problem
Raspberry Pi isn’t turning on then it’s likely the
board is broken.
Note: the first-generation Raspberry Pi
model has a polyfuse – if this gets blown, it can
reset/repair itself, but you may have to wait a
few days for this to happen.
Boot
documentation
Need more advanced boot solutions?
Check the documentation for Raspberry
Pi on the Raspberry Pi website here:
magpi.cc/bootdocs
Raspberry Pi Zero
Power problems
Raspberry Pi Zero only
has an ACT LED, so
you will need to check your
power supply if it won’t boot
up. We suggest trying the
power and microSD card on
another Raspberry Pi when
in doubt.
Composite video
Raspberry Pi can
output a composite video
signal via the 3.5 mm headphone
jack. If you’re using an older pre-installed
NOOBS card, or still have some lying around,
it’s good to know that holding the number 3 key
on a connected keyboard will force it to output via
the composite output if that’s what you’re using. If NOOBS issues
you’re in the US or another NTSC country, hold Not all versions of NOOBS work correctly
the 4 key instead. with all Raspberry Pi Zero models. Instead
of relying on NOOBS for your Raspberry Pi Zero,
you should use the new Raspberry Pi Imager
Corrupt microSD card software to install Raspbian to a microSD card.
While uncommon, microSD cards can You can find it at magpi.cc/imager. See page 6
sometimes become corrupted while being used of this issue for more details.
in a Raspberry Pi. Unfortunately, there’s no solution
to this other than getting a
new microSD card, so make
sure to back up your card
regularly. You can do this by
saving any important files, or
even by making an image from
your current card. We have a
video on how to do this here:
magpi.cc/backupvid
ORK FIXES
NETW
CAN’T CONNECT TO YOUR LAN? NO INTERNET?
HERE ARE SOME THINGS YOU CAN DO
Desktop does not appear
If you don’t have a wired connection
handy, you can add settings for your
wireless network onto the boot folder of a
Raspberry Pi microSD card. Create a file there
called wpa_supplicant.conf and add your
network details like so:
ctrl_interface=DIR=/var/run/wpa_
supplicant GROUP=netdev
Understanding network symbols update_config=1
The network symbols in Raspbian are country=<Insert country code here>
pretty easy to read, and there are three
with which you should be familiar. The first network={
symbol is two grey lines with a red X on opposite ssid="<Name of your WiFi>"
ends – this denotes no network connection of psk="<Password for your WiFi>"
any kind. Two blue arrows facing in opposite }
directions means you have a wired connection
working, while the circle with waves emanating
from it means you have a wireless connection.
Speed differences
Different Raspberry Pi models have
different connection speeds, especially
on Ethernet connections. Raspberry Pi 3 and
below max out at about 100Mbps as they use a
100MB adapter over USB. Raspberry Pi 3B+ is
roughly 280Mbps, as it has a Gigabit Ethernet
connection on a USB 2 line. Raspberry Pi 4,
however, is a full gigabit. If you’re having
speed issues, make sure your router or switch
supports up to the speeds you’re expecting, and
test with different Ethernet cables.
Wireless testing
There are a lot of things
that can interfere with
your wireless reception in
your home. Distance from
your router, interference from
neighbours, walls, and even
just too many people on the
same channel. We like to use
apps like Wifi Analyzer to test
locations around our home
to find out the best spots to Networking
place wireless devices such as a
Raspberry Pi.
documentation
Not finding your problem here? Check
the configuration documentation for
SSH connection more info on networking with Raspbian
and Raspberry Pi: magpi.cc/configdocs
Many security precautions have been
implemented in the last couple of years to
make sure Raspbian and Raspberry Pi are more
secure – this includes making sure people change
the password on their Raspberry Pi, and keeping
SSH off. You can turn it on from the Interfaces tab
in Raspberry Pi Configuration – or, if you’re using
a headless Raspberry Pi, simple place an empty file
called ssh in the boot folder of the microSD card.
Available now
magpi.cc/codetheclassics
TUTORIAL
electronics: Sensors
One of the great things about Raspberry Pi is that it has GPIO
pins to attach your own electronic circuits
I
n this tutorial, you will learn how to sense The thermometer project
both temperature and light, using your
Install the code
Simon
Raspberry Pi and a few simple components.
01
MAKER
One project will allow you to measure temperature Before fetching the code from the internet,
Monk
using a component called a thermistor, and the you should run Mu, which you will find in the
Simon divides other project acts as a rudimentary light meter. Programming section of your main menu. If it’s
his time between Both display their readings in a window on your not there, update your system to the latest version
writing and Raspberry Pi’s screen using the guizero Python of Raspbian (magpi.cc/raspbianupdate).
designing products
for MonkMakes
library (magpi.cc/guizero). Running Mu ensures that the mu_code
Ltd. Some of his Both projects also make use of the PiAnalog directory is created, into which we will now copy
better-known books (magpi.cc/pianalog) Python library that lets the program code. To do this, open a Terminal
include Programming
you connect analogue sensors to Raspberry Pi window and run the commands:
Raspberry Pi (TAB)
and The Raspberry Pi without special hardware.
Cookbook (O’Reilly). Although these projects sense temperature wget http://monkmakes.com/downloads/pb1.sh
simonmonk.org and light, you could easily adapt them to use sh pb1.sh
other types or resistive sensor, including stress
sensors, variable resistors, and even some types This will copy the programs used in this tutorial into
of gas sensor. the mu_code directory, along with some others.
> The Mu
Python editor
codewith.mu
> Solderless
breadboard
Jumper wires with sockets on The time taken for the capacitor to
one end and pins on the other are charge up through the thermistor is
used to connect the GPIO pins of used to calculate the thermistor’s
Raspberry Pi to the breadboard resistance and hence its temperature
A thermistor is a special
type of resistor whose
resistance changes as
its temperature changes
Solderless breadboard is
used to hold the electronic
components and connect
them together
05_thermometer.py
In this project, none of the > Language: Python 3
components needs to be a
001. # 05_thermometer.py
particular way around 002. # From the code for the Box 1 kit for the Raspberry Pi by
MonkMakes.com
003.
Place components 004. from PiAnalog import *
02 onto breadboard 005. from guizero import App, Text
Using Figure 1 as a reference, push the jumper wires 006. import time
into the breadboard at the positions shown. Bend the 007.
resistor legs so that they fit into the holes. 008. p = PiAnalog()
The five holes in each row on the breadboard 009.
are connected together under the plastic, so 010. # Update the temperature reading
it’s very important to get the correct row for 011. def update_temp():
your component leg. In this project, none of the 012. temperature = p.read_temp_c()
components needs to be a particular way around. 013. temperature = "%.2f" % temperature # Round the
temperature to 2 d.p.
014. temp_text.value = temperature
015. temp_text.after(1000, update_temp)
Connect breadboard 016.
03 to Raspberry Pi 017. # Create the GUI
Again, using Figure 1 as a reference, connect the 018. app = App(title = "Thermometer", width="400", height="300")
GPIO pins on Raspberry Pi to the breadboard. A GPIO 019. Text(app, text="Temp C", size=32)
template will make this easier – if you don’t have 020. temp_text = Text(app, text="0.00", size=110)
one, you’ll need to carefully count the pin positions. 021. temp_text.after(1000, update_temp) # Used to update the
It doesn’t matter what colour jumper wires you use, temperature reading
but if you stick to the colours used in the diagram, 022. app.display()
it’s easier to check that your wiring is correct.
Figure 2
Top Tip if Beta is 3800 and R25 is 1 kΩ, you would use:
p.read_temp_c(3800, 1000).
After a few seconds, a window will appear, like
Using a the one in Figure 2, displaying the temperature.
photoresistor If you would rather have the temperature
displayed in degrees Fahrenheit, then run the
You can also use a
program 05_thermometer_f.py instead.
1 kΩ photoresistor
(sometimes
called an LDR –
light dependent
resistor) in place of Changing the temperature
the phototransistor. 05 The easiest way to change the temperature
Photoresistors
of the thermistor is to pinch it between your
are becoming
less common in fingers so that your body warmth heats it up. You
projects as they
Figure 2 Displaying the temperature using guizero should see the temperature steadily increase and
contain cadmium, then decrease back to room temperature when you
an element Running the program
whose use is 04 Load and run the 05_thermometer.py
let go of the thermistor.
restricted in the
program using Mu. The code is configured for the
RoHS (Restriction
of Hazardous thermistor supplied with the MonkMakes Project Light meter project
Substances) Box 1 kit. If you look near the top of the file, you
Disconnect the breadboard
legislation.
Don’t worry: a
will see the line: temperature = p.read_temp_c().
If you are using your own thermistor, you will
01 This project has almost the same layout as
photoresistor is need to add two new parameters to the method the thermometer, and we are just going to swap
not dangerous
call. The first parameter is the value of Beta for the thermistor for a phototransistor, but it is still
to touch, as it’s
the thermistor, and the second the value to R25 a good idea to disconnect the breadboard from
all sealed up
in plastic. (resistance at 25°C). You will find both of these your Raspberry Pi. First, pull the jumper wires off
values in the thermistor’s datasheet. For example, the GPIO pins on Raspberry Pi and then take the
thermistor off the breadboard.
Figure 3
Figure 3 The light
meter wiring diagram
2. B
efore we can use the capacitor (C) to measure the resistance of
the sensor, it first needs to be discharged (emptied). To do this, 2
GPIO 18 is set to be an input (so almost no current flows through
it) and GPIO 23 is set to a digital output at 0 V. This discharges C
through resistor R2
4
3. H
aving used GPIO 23 and R2 to discharge the capacitor, GPIO 23
is set to be an input (to monitor the voltage of the capacitor) and
GPIO 18 is now set to be a digital output at 3.3 V. The capacitor
(C) will now start to charge and the voltage across it will steadily 1
increase at a rate that depends on the resistance of R1 (fixed) and
the sensor (varying with temperature/light/etc. depending on the
sensor type)
4. O
nce the voltage across the capacitor and therefore at GPIO 23
reaches about 1.6 V, the input is read as high by the monitoring
Python program, and the time taken for this to happen is used
to calculate the resistance of the sensor
W
Configure and update
hen Samuel Morse created his
communication system in the mid-
02 This project has several steps, so don’t
1800s, it revolutionised wireless worry if you just want to practise Morse code –
PJ Evans
MAKER
communication. The original idea was that we’ll get to that first. If you want to complete
PJ is a writer and simple electronic pulses could be sent further everything here, you’ll need to set up an internet
software engineer and more reliably than voice, and so the Morse connection (wireless or wired) and enable I2C,
who seems to
alphabet was used to describe each letter and which is used to communicate with the LCD screen.
want to make
communicating with number as a combination of short pulses (dots) By running sudo raspi-config from the command
the outside world and long pulses (dashes). line, you can enable WiFi under ‘Network Options’
as challenging Learning Morse code is a challenge, but can be and I2C under ‘Interfacing Options’.
as possible.
rewarding and a lot of fun. As an introduction to Whatever it is that you’ve decided to do, always
@mrpjevans this classic way of communicating, we’re going to make sure you’ve updated the system by running
build a tweeting Morse code key. We’ll learn how sudo apt update && sudo apt upgrade. This may
to interpret input and also how you can create take some time; once complete, it’s important you
more complicated projects by breaking them reboot so that I2C is properly enabled.
down into small pieces.
You’ll Need
Get switched on
Let’s get set up 03
> Small breadboard
magpi.cc/ 01 First, select the right Raspberry Pi
Let’s try to emulate the Morse key by
using a tactile switch. These widely available and
minibreadboard
model for the job. Of course, we would heartily inexpensive switches make a satisfying ‘click’
> Tactile switch recommend a Raspberry Pi 4, but in fact this when pressed (hence the name). They have four
magpi.cc/switches project will not be too demanding on even the pins – two pairs that are connected on the longer
> Adafruit 16×2 oldest models, so it is great for upcycling an older side, so the switching is done between those with
LCD Keypad Kit Raspberry Pi computer. In fact, it will even work the shorter gap. Bearing this in mind, place the
(optional) with the original Model A and B. switch into the breadboard so the longer edge
magpi.cc/keypadkit
Start by installing the latest version of follows the connected rows. Don’t worry if you
> Morse key Raspbian. We’ve no need for a graphical user make a mistake: nothing can be damaged. Now
(optional) interface, so you can use Raspbian Lite if you connect the breadboard to your Raspberry Pi’s
magpi.cc/morsekey
wish; whatever is most comfortable. We’ll be GPIO. Run jumper leads on each side of the switch
> Twitter account doing everything in the command line. to the last two pins at the end (nearest the USB
(optional) ports) of the GPIO header: GND and GPIO 21.
twitter.com
> Jumper wires
Coding time
04 Once you’ve checked all your connections,
create a new file called morse.py in your favourite
editor and enter the code listed here. You can
also download it from magpi.cc/twitterkey if
This popular display
means we can see you don’t fancy the typing. The code will listen
our Morse code
for changes to the button’s ‘state’ (whether it is
without the need for
a monitor pressed or not) and measure the time differences
42 magpi.cc
TUTORIAL
morse.py DOWNLOAD
THE FULL CODE:
> Language: Python 3 magpi.cc/twitterkey
Raspberry Shake
seismographic data
Use your Raspberry Shake (or tap into the Shake community)
and work with seismographic data using Swarm
I
Open Raspberry Shake
n the previous tutorial, we looked at setting
up Raspberry Shake, a geophone-based
01 We’re going to use two Raspberry Pi devices
earthquake detector and checking out in this tutorial. The first is used in our assembled
Lucy
MAKER
data with the web-based ShakeNet service: Raspberry Shake unit (currently sitting in our
Hattersley magpi.cc/shakenet. conservatory). The second is used to remotely
Our shake has been running for a while now and access the Raspberry Shake and investigate its
Lucy is editor of The
MagPi magazine we’ve gathered together some data on earthquake data. You can perform much of this tutorial
and likes to explore activity in our local area. We don’t live in an using another Linux, Windows, or Apple macOS
science and data earthquake-prone part of the world, but it’s computer if your only Raspberry Pi is being used
with Shake and
Raspberry Pi. good citizen science and we can tap into other as Raspberry Shake.
Raspberry Shake devices around the globe. With both your computer and Raspberry Shake
magpi.cc
In this tutorial, we’re going to take a closer look on the same network, Start by opening the web
at the data provided by Raspberry Shake devices. browser and navigate to:
We’ll delve into how data is measured, stored, and
what you can do with it. We’re going to look at a rs.local/
You’ll Need helicorder and using Swarm to analyse live data.
This will open the Raspberry Shake Config window.
> A
ssembled Figure 1
Raspberry Shake
(or you can
access somebody
Open helicorder
else’s data)
02 Click on the helicorder icon (shaped as
> R
aspberry Pi
four wavy lines) in the bottom left of the window.
> R
aspbian OS You will see 14 blue links, each with a date-stamp
followed by either (12) or (00). These represent
Raspberry Shake readings for the last seven days,
split into 12-hour blocks. The ones marked ‘(00)’
are for the morning hours (midnight to midday),
Figure 1 The
Helicorder displays while the ‘12’ ones are for evenings (midday
seismic activity for to midnight).
twelve hours. Each
hour is divided into Click on one of the links to view the helicorder
four horizontal lines for that time frame. It’ll look like the image
(coloured black, red,
blue, and green). in Figure 1. The latter shows seismic data for
Each coloured line
12 hours. Each line represents 15 minutes of
represents a quarter-
hour of activity recording, and the lines vary in colour (black, red,
blue, and green). Down the left, you will see the
time local to your area; to the right, you’ll see UTC
E ach line represents 15
(Coordinated Universal Time). Our Shake unit is minutes of recording, and
located near the Prime Meridian, so both times
are the same. they vary in colour (black,
Look along the lines to view seismic activity.
Lines will typically be stable, and more motion red, blue, and green)
could indicate somebody walking nearby, or other
motion. Take a look this Maryland Geological retrospectively adjust the previous recordings. So
Survey website for more information on how to you will need to wait until the end of your 12-hour Top Tip
read helicorder records: magpi.cc/readhelicorder. recording for a fresh helicorder to display wholly
adjusted results. StationCode
The StationCode
Adjust helicorder scaling is generated
03 Swarm automatically
We found our helicorder settings initially
too intense (see Figure 2); conversely, you may find
04 The helicorder is not updated in real-time.
by using the last
four digits of
the helicorder on your Shake to be too mild. Either For real-time data, you’ll need to use another app. the Raspberry
way, you won’t be able to determine between There are many third-party apps available for data Pi computer’s
different periods of intensity. analysis, but Swarm (Seismic Wave Analysis / Real- unique hardware
Head into your Shake settings and adjust the time Monitoring) is the most commonly used by address
Helicorder Scaling Value to fine-tune your settings. Raspberry Shake owners. (commonly
referred to
Click on the Settings icon at http://rs.local and Swarm was developed by the USGS Volcano
as the ‘MAC’
choose the Data tab. Adjust the Helicorder Scaling Hazards Program (magpi.cc/usgs) and is the most
address) and
Value. The default setting is 0.5; adjust it down to widely used seismological application in the world. appending them
0.1 if the display is too intense, and up to 1.0 if it is Swarm is available for Linux, macOS, and Windows to the letter “R”.
too mild. You can fine-tune the levels to your taste operating systems, and Raspberry Shake provides a magpi.cc/
as you go. version that is preconfigured for Shake devices. stationcode
Click Save and Restart to put the new settings In the case of Swarm, you can also connect to
in place. the Raspberry Shake Community server to see
The helicorder will start displaying new waveforms from all of the other Raspberry Shakes
recordings using the new scaling value, but will not in the world.
Download Swarm
Top Tip 05 Visit rs.local in your web browser and click
myShake to reveal further subfolders, then click
the ‘+’ sign next to AM to reveal the StationCode
the SWARM Download button. Open a Terminal for your Raspberry Shake. Ours is R2E51.
Get the manual window and navigate to the Downloads folder: Double-click on the StationCode and the main
window will display a helicorder. This time,
Download the cd Downloads/ however, the lines will be blue, with darker blue
Swarm V3 User
and red colours used to indicate heavy periods
Manual and
Now unzip the downloaded swarm folder and move of activity. Each line represents a half-hour of
Reference Guide
directly from the the unzipped folder to your home folder: activity, and the helicorder displays live data.
USGS website.
magpi.cc/ unzip swarm-3.0.1
swarmpdf mv swarm-3.0.1 ~
The inset window
(If Swarm has been updated, replace the file name
08 Click on any part of the helicorder to open
with the appropriate latest version.) the Inset window. This shows a zoomed-in area
of the helicorder. The first time you click on it, it
will be in Wave view (this is the helicorder wave
expanded to make it easier to view). Right-click
Open Swarm
06 Now open the swarm folder in your home
with the mouse to switch to Spectra view; right-
click again to view a Spectrogram. Icons in the
folder and run the swarm.sh file script to start Status bar above the helicorder are also used to
the program. change views.
cd ~/swarm-3.0.1
sh swarm.sh Y ou can see the strength
If you are using a Windows computer, you will
of seismic activity in
need to install Java first (magpi.cc/javawindows)
and then run Swarm by double-clicking the
specific GHz bands
swarm_console.bat file.
Spectrogram view
09 The Spectrogram view displays the
frequency of waveforms concerning time and
Access your Raspberry
Figure 2 Our
helicorder setting 07 Shake in Swarm
amplitude (or power). The X-axis (horizontal) of
the spectrogram relates to time (as with a regular
was too intense,
requiring the When you first open Swarm, it will display a blank helicorder plot); the Y-axis (vertical) relates to
Scaling Value to be
reduced so values
blue window; to the left, a sidebar will display the frequency of the wave. A third data point is
could be inspected myShake and RS Community folders. Double-click displayed via the colour of the points on the graph:
blue is for the weakest energy, and red is for the
strongest. So you can see the strength of seismic
Figure 2 activity in specific GHz bands. The Spectrogram
is a very powerful tool for understanding the
seismic activity.
Ben Ferraiuolo has written a great article called
‘How to understand spectrograms’, which can
be used to get a better understanding of how to
interpret this data (magpi.cc/spectrograms).
Figure 3
Figure 3 The
Spectrogram displays
the frequency
of waveforms
concerning time, and
the colour of the data
points indicates the
amplitude (power) in
that frequency
Wave clipboard
11 You may find it useful to compare different
sections of the helicorder, or the same time using
different views: plot, spectrogram, and so on.
The Wave Clipboard is used to hold different clips
from several areas at once (even across different
Raspberry Shake models).
Choose Window > Wave Clipboard to view the
current selection (which should be empty).
Head back to the helicorder and click on an area
of interest to open the Inset Panel. Right-click
to get a View mode and click the ‘Copy inset to
clipboard’ button. The Wave Clipboard will return
to focus and now display the clipped wave. You
can add multiple waves to the Wave Clipboard and
remove them using the ‘X’ delete icon to the right
of each wave.
Facial recognition
Part 03
I
n the past two issues, we’ve built and To recap, we made a ‘budget’ version using the
configured a magic mirror using the Raspberry Pi official touchscreen, a small Ikea
PJ impressive MagicMirror2 software. Now frame, and a generous amount of gaffer tape.
MAKER
Evans we have our mirror constructed and configured Basic, but surprisingly functional. Having given
to our liking, it’s time to go to the next level of it all a bit of a polish (software speaking) in the
PJ is a writer, personalisation. Wouldn’t it be amazing if the second article, we’ll be building upon our current
tinkerer, and mirror’s display could be customised based on mirror. If you’ve gone your own way, that’s great:
enjoys installing
Raspberry Pi Zero the person standing in front of it? Wouldn’t it be the instructions will be roughly the same.
computers where even better if that could happen by the mirror
no-one asked for recognising the person standing there? Turns out,
them to be.
that’s well within the capabilities of a Raspberry
@mrpjevans Casing the camera
Pi computer. We’ll build multiple mirror
configurations that appear when the right person
02 If we’re going to add the ability to customise
is recognised. the display based on who is standing in front of it,
then we’re going to need some vision. The easiest
choice would be the official Raspberry Pi Camera
Module. It’s small, powerful, and easy to connect.
Magic up a mirror
01 This project is an enhancement to the
How you want to mount the camera to your project
is entirely your call. Here, we’ve 3D-printed a
tutorials we covered in the previous two issues of small case for the module so it fits in with its
The MagPi: 90 and 91. That means that you’re going surroundings. The small case matches the frame
to need a magic mirror before we go any further. and was easily secured with some strong tape. The
more ambitious of you may consider mounting a
camera directly in the frame.
Top Tip
Screen rotation
No luck with
face recognition?
The display can be
Train, train, and
completely customised to the train again. The
person looking at the mirror more data, the
more accurate
the result.
We now have a collection of tools to help train After the script has started up, have a look
Top Tip our mirror to the various faces it may encounter. into the camera at the same angle you took the
training photos. If all is well, you’ll see reports
PyImageSearch that your face has been identified! This means
the mathematical model has matched you with
Want to know Training time
more about image 07 Now it’s time to train our mirror. Run the
what it is currently seeing. If you don’t get
good results, try retraining or changing the
processing and
following commands: lighting. Repeat the process until you’re getting
recognition using
Python? There’s satisfactory results.
no better resource cd ~/MMM-Facial-Recognition-Tools
than Adrian python3 capture.py
Rosebrock’s
pyimagesearch.
Install the module
com.
Choose whether to capture live photos from your
webcam, or train from JPEG photos (you’ll need
09 Now we have our machine-learnt data,
to upload them in advance). You’ll be asked for we can go ahead and install the actual facial
your name. Keep it simple. Your author chose recognition module. To do this, we need to install
‘pj’, avoiding capitalisation, spaces, and special some code in the MagicMirror2 modules directory:
characters. You should now see your face on the
mirror’s display. Line up your face with how you cd ~/MagicMirror/modules
think you’ll be looking at the mirror (‘in situ’ is git clone https://github.com/mrpjevans/MMM-
best) and press ENTER to take a snapshot of your Facial-Recognition
face. Repeat this at least ten times before pressing
CTRL+C to stop. This installs all the files we need to add the module
Finally, run python3 train.py to convert the into the system. To complete the installation, we
images into mathematical data. When prompted need to add dependencies:
for an algorithm, select LBPHF.
cd MMM-Facial-Recognition
npm install
Testing time
08 To verify that the training worked, a testing
After a short time, all the files we need to run the
module will be installed.
script is provided. From the same directory, run Finally, make a copy of the training data from
these commands: Step 07 into the modules directory:
nano ~/MagicMirror/config/config.js
list1.js
{ and }, all of them grouped in [ and ]. You need to > Language: JSON
add the list1.js listing printed here into the [ and ]
group. Each group of { and } needs to separated by 001.
a comma (except for the final one). Don’t save the 002. {
file just yet. 003. module: 'MMM-Facial-Recognition',
004. config: {
fter a few seconds, the
A 005. // Array with usernames (copy and paste
006. from training script)
system should restart 007. users: ['pj']
008. }
and the ‘default’ modules 009. }
are shown
11 Customise the modules
Have a look at the config section you’ve just
list2.js
added. Where it says ‘users’, make sure the names
in the following square brackets match the ones > Language: JSON
you have trained for. Ours was ‘pj’ so it should
read [‘pj’]. If you trained multiple people, separate 001. var config = {
them with commas: [‘alice’, ‘bob’]. 002.
Now, for each module you want to customise per 003. ...
person, add an extra parameter of ‘classes’. This is 004.
a string with multiple entries separated by spaces. 005. modules: [
Add ‘default’ for always shown, ‘everyone’ for 006. {
every recognised face, and specific names if that 007. module: "clock",
module is only to shown for that person. See the 008. position: "top_left",
list2.js listing for an example. 009. classes: 'default'
010. },
011. {
012. module: "compliments",
Try it! 013. position: "lower_third",
12 Now it’s finally time to try out your mirror. 014. config: {
Restart MagicMirror2 by running this command: 015. compliments: {
016. anytime: [
pm2 restart MagicMirror 017. "Hey, PJ!"
018. ]
After a few seconds, the system should restart and 019. }
the ‘default’ modules are shown. Have a look into 020. },
the camera as you did for training and see if your 021. classes: 'pj'
modules appear. After a second or two, the mirror 022.
should refresh with your choice of display. 023. },
If you have any problems, use SSH to connect to 024. {
your mirror and run pm2 logs. This will show you 025. module: 'MMM-Facial-Recognition',
a live update of what’s going on. Typically, any 026. config: {
problems will be either not enough training or poor 027. // Array with usernames (copy
lighting. Just retrain by following the earlier steps and paste from training script)
and have another go. Soon you’ll have a cool mirror 028. users: ['pj']
that is unique to each of its visitors. 029. }
030. }
031. ]
032.
Thanks to Paul-Vincent Roll, author of the original 033. };
MMM-Facial-Recognition module.
Part 01 Simon
Safe Crack game
Use continuously rotating control for Raspberry Pi
to create a rotary encoder game
R
How do they work?
otary encoders are the digital equivalent
of a potentiometer, but unlike most
02 See Figure 1 – this shows a disc of metal
potentiometers they can be continuously with castellations on the perimeter. There are
Mike rotated. The big problem is that there is a lot of two spring contacts on the outer castellations,
MAKER
Cook misinformation out on the internet about how such that as the disc rotates, one and then both
to read them properly on a Raspberry Pi. So we contacts will be touching the metal plate. There
Veteran magazine thought we would take a look at how to really do is a third, common contact, which is permanently
author from the old this correctly. Along the way, we can also have a attached to the metal plate. The contact that
days, writer of the
Body Build series, bit of fun with a fun safe-cracking simulator. breaks connection with the plate first depends on
plus co-author of the direction of rotation. There are four possible
Raspberry Pi for ways the two contacts can be connected or not
Dummies, Raspberry
connected, and these are shown in Figure 1 as
Pi Projects, and
What is a rotary encoder?
Raspberry Pi Projects
for Dummies. 01 There are two types of rotary encoder:
well. The sequence of connections is determined
by the direction of rotation.
magpi.cc/mikecook absolute and incremental. The absolute type
normally have lots of outputs, and are very
expensive. An incremental type has two outputs:
The KY-040 board
it is up to your computer to detect the direction of
rotation, and count the pulses it produces in order
03 The low-cost KY-040 board consists of
to find out what rotation has occurred. Each type a rotary encoder with a built-in push switch.
can be made with optical interrupters or switch There are also on-board pull-up resistors for each
contacts. The switch contacts are a lot cheaper, but contact. The schematic of this board is shown
come with problems of false contact events due to in Figure 2, so if you want to use a bare switch,
contact bounce. These can come with or without this is how you wire it to be compatible with this
detents, which is a posh way of saying clicks. tutorial. With this configuration, when you wire it
CLK DT CLK DT
Common
contact
You’ll Need Metal
Anticlockwise Clockwise
> KY-040 rotary
CLK DT CLK DT
switch
magpi.cc/
rotaryswitch
Top Tip
The pigpio
version
While pigpio is
pre-installed
This is the finished
in Raspbian,
rotary encoder in a box this version will
not work with
Raspberry Pi 4.
For that, you need
version 74. To find
out what version
The Simon Safe Crack you have, enter
game interacts with pigpiod -v -V
the rotary encoder in a Terminal.
See magpi.cc/
pigpio for how to
upgrade to the
latest version.
A 1 1 A 1 1
the sides – see Figure 5 (overleaf).
B 0 1 D 1 0
C 0 0 C 0 0
D 1 0 B 0 1
DT
Finishing off
05
A 1 1 A 1 1
Lorem ipsum
dolor sit amet,
DT CLK DT CLK
DT
A B C D A B C
TUTORIAL
Detent position
Figure 4
CLK
CLK
DT
DT
A B C D A B C
A B C D A B C
Figure 4 The
detent resting
Detent position Detent position position on two
types of encoder
Software strategy
the other end was wired up to a 20-way header
CLK and wired up as shown in Figure 6 (overleaf).
socket
07 We need to have these edges trigger an Top Tip
You can wire up the board to any three GPIO lines, interrupt, but the normal Python mechanism
but you will have to change the pin assignment is way too slow to cope. Therefore, we have Wobbly
in the software to match. If your encoder has no to use something faster. To the rescue comes encoders
thread, or you have no matching nut, you can mount the pigpio library. This is written in C, and can
DTboard to the top of the box with two 10 mm
the detect a transition within 1 µs (a microsecond) Some of the low-
cost suppliers
male-female spacers, as shown in Figure 7. of it occurring, although the default 5 µs is fast
don’t always have
enough. It can still take up to 10 ms for that event the best-quality
A B C D A B C
to percolate up through the system so that Python switches; we got
knows about it; however, pigpio buffers these some poor ones.
Contact bounce
06 While in theory the signals from the rotary
events, so that although they might not arrive in
real time, they do eventually arrive. Therefore, we
In particular, if you
make a click and
get no response,
encoder should look like the waveforms drawn so do not miss any counts.
this is because
far, in practice it is not always the case. Consider
Detent position the detent has
the oscilloscope waveform shown in Figure 8. Here not returned the
we see the falling edge of both signals is clean, as contacts to the
Class driver
is the rising edge of the bottom trace. The rising
edge of the top trace, however, shows considerable
08 We have written a class driver that will
correct place. A
slight sideways
motion will often
contact bounce, with many false edges before the cause call back functions to be triggered from both
free the contacts,
switch settles down. Fortunately, there is a simple the edges of the rotary signals, as well as the push
and the click will
way to get round this, because in the normal course switch. The push switch is optional, and we do not then be registered.
of operations you will always get signals first from have to specify anything for this if we don’t want
one line and then the other. If you get two or more them: simply miss out the pin assignments and
edges from the same line consecutively, then callback functions when initialising an instance
simply ignore those edges. of the class. The code for the class driver is shown
in ky040.py (download it with the other code files
Figure 5 from magpi.cc/pibakery) and should be in the
same directory as the script that’s calling it.
Raspberry Pi
DOWNLOAD
THE FULL CODE:
magpi.cc/pibakery
GPIO 22 (15)
GPIO 27 (13)
Figure 6
GPIO 17 (11)
Box
GND (9)
GPIO 4 (7)
KY-040 CLK
SCL (5)
DT
SW
+ SDA (3)
GND
3V3 (1)
Figure 6 Wiring
the KY-040 board
to Raspberry Pi’s
GPIO connector
Figure 7 Figure 8
www.UniPiCase.com
Track weather
& pollution
WITH RASPBERRY PI
Air quality, humidity, and UV monitoring, as well as daily
weather forecasting, all make for rewarding – and potentially
creative – Raspberry Pi projects. Rosie Hattersley finds out more
O
pen data is a marvel. It allows us to learn source, before ramping up the number of sensors
and share so much about the world around and reading your Raspberry Pi logs. In the case of
us. If you’re a weather obsessive or take a air quality and pollution, tracking such changes has
healthy interest in the state of the environment, never seemed so relevant.
being able to monitor changes – or simply predict Making use of weather-related findings can also
what weird weather to expect next – is a great way take you in different directions, from graphs, logs
to use your Raspberry Pi and coding skills. Over and user-generated maps to real-time tracking
the next few pages we’ll look at options if you’re ideas with trigger warnings. As well as presenting
keen to learn how to set up your own weather project ideas you can emulate, we look at some of
station. Essentially, start small and focus on one the most interesting Raspberry Pi-enabled weather
environmental aspect, using an existing data tracking ideas to have caught our eye.
WIND VANES
Wind vanes show the direction the wind is
coming from, not where it’s going. A wind vane
works because wind exerts force on its vertical
blade, which rotates to find the position of
least wind resistance; this position is aligned
with the direction of the oncoming wind
ANEMOMETER
A typical anemometer has three
arms with scoops on the end that
catch the wind, causing it to spin
MICROPHONE
Noise pollution is an aspect many
folks overlook, although it’s a
popular subject in city areas. This
is monitored with a microphone
BME280
The Enviro board from Pimoroni features several
sensors for weather and pollution: a BME280 for
measuring temperature, pressure, humidity; LTR-559
light and proximity sensor; and a MEMs microphone.
The Enviro + Air Quality version also includes a
MICS6814 analogue gas sensor and a connector for
an add-on particulate matter sensor RAIN BUCKET
This rain gauge is basically a self-emptying
tipping bucket. Rain is collected and
channelled into the bucket
Sense HAT
rainbow predictor
There’s something really special about
seeing a rainbow. The Sense HAT’s LED
matrix helps improve your odds of seeing
one by alerting you when conditions are right.
That’s when there’s at least 80% humidity and
the temperature is about 20°C. The instructions at
magpi.cc/rainbows explain how to use a Trinket
emulator to make your own virtual rainbow by
assigning values to colours. Then you can use a
Raspberry Pi Sense HAT (magpi.cc/sense-hat) to
build the project for real.
You need to look up and select colour values
using the RGB chart at magpi.cc/trinketcolours.
When the Trinket’s colours begin to make a
rainbow, the weather conditions are also aligning
to make a rainbow sighting more likely. A great
way to add a reward for writing code.
magpi.cc/rainbows
Build your own weather station
The Raspberry Pi Foundation’s Weather Station project is a
classic, and pre-assembled kits were sent out to schools around
the UK.
To make one at home, you’ll need a Raspberry Pi with wireless LAN,
plus some or all of these to create a sophisticated weather station:
a BME280 combined pressure/humidity/temperature sensor, an
anemometer, wind vane and rain gauge, a digital thermal probe, a
breadboard, and some jumper wires.
You can pick and choose which types of weather and environmental
Plot temperature elements as colour values on a Sense
changes you wish to track, and it is best to start with one or two sensors HAT’s LED matrix. When it displays a rainbow, a real one
and move on up. may well appear in the sky
If you prefer to log weather details based on your own Available in two versions, the Enviro board is aimed
at citizen scientists keen to monitor the world around
observations, the Weather Logger project (magpi.cc/weatherlog)
them. Temperature, pressure, noise, and light levels
can help. It makes use of information gleaned from your Sense
are all logged, while the ‘+ Air Quality’ model also
HAT, and you plot the graph based on what its sensors report. First, you tracks how clean the air is and encourages you to log
need to set the Sense HAT (or the online Trinket emulator) to check the polluting particulates in your neighbourhood.
temperature every five seconds. Once a set number of readings has been magpi.cc/enviroplus
gathered, you use the Pygal Python module to create a graph showing its
findings. Since you can set the parameters and specify temperatures, this
project also works as a simulator for different weather conditions.
magpi.cc/weatherlog
Nemo-Pi
It’s not just above ground that
environmental sensors come in useful:
coral reefs are being decimated by
rising temperatures and human activity
including damage from anchors. The Save Nemo
Foundation in Thailand and Indonesia uses a
Raspberry Pi-powered underground weather
station, Nemo-Pi, to monitor temperature, pH,
oxygen, and nitrogen levels. The solar-powered
monitors attached to buoys report back to a
central monitoring station. When the seas offer
poor visibility, dive ships know it’s not worth
visiting, while pollution incidents can quickly be
flagged and responded to, helping to preserve the
coral reefs.
magpi.cc/nemopi
MET OFFICE
Schools and clubs can give the Met Office a run for its
money using its meteorological data to create your
own weather station. Rainfall, wind, and temperature
can all be tracked using the easy-to-follow
instructions on its site. No Raspberry Pi or coding is
needed for these quick-to-set-up projects.
magpi.cc/metoffice
Build an air-
quality monitor
with Enviro
Monitor the environment by setting up an Enviro + Air Quality board,
mounting it outdoors, and accessing the logged data on the web
D
ue to growing concerns about poor air
quality and its effects on our health,
Phil King many people are keen to monitor their
MAKER
Warning!
The optional particulate matter sensor Linked to an ADC, the MiCS6814 Outside mounting
tests the air continually to detect analogue gas sensor detects
microscopic particles such as pollen, three gas groups: oxidising, When placing your air-
quality monitor outdoors,
mould spores, and various pollutants reducing, and NH3 (ammonia) take care if using a
ladder. Also, make sure
you have the property
owner’s permission.
magpi.cc/ladders
If it’s not a fresh install, do a sudo apt update to serial console, and enables the mini UART interface
make sure it’s up to date. that Raspberry Pi uses to talk to the PMS5003
Connect your Raspberry Pi to your wireless particulate sensor.
You’ll Need
network, as usual, and enable SSH in the Interfaces To check that everything is working correctly,
tab of the Raspberry Configuration tool, so you can run the all-in-one example: > Raspberry Pi Zero
access it remotely later. WH (or W with GPIO
cd examples pins soldered)
magpi.cc/pizerow
E nviroPlusWeb logs data python all-in-one.py
> Enviro + Air Quality
from the Enviro board’s Tap your finger on the board’s light sensor to magpi.cc/enviroplus
cycle through data from different sensors being > PMS5003 particulate
sensors and generates a displayed on its LCD. When you’re happy it’s all matter sensor
working, press CTRL+C to stop the program. magpi.cc/pmsensor
Flask web server > Metal stand-offs
(optional)
Install Enviro library
04 Install EnviroPlusWeb
> Long USB-A to
To use the Enviro board, you’ll need to
install its Python library. Open a Terminal window
05 You can now install the EnviroPlusWeb
micro-USB cable
(2m to 5m)
and enter the following commands: software, which logs data from the Enviro board’s magpi.cc/
microusb5m
sensors and generates a Flask web server so you
git clone https://github.com/pimoroni/ can view a dashboard remotely. From a Terminal > 2 × Square 112.5°
enviroplus-python window, enter: downpipe bends
magpi.cc/pipebend
cd enviroplus-python
sudo ./install.sh cd > 2 × Command Strips
sudo pip install smbus2 git clone https://github.com/nophead/ (medium)
magpi.cc/cstrips
EnviroPlusWeb.git
Once that’s all done, enter sudo reboot to restart > Duct tape
your Raspberry Pi to apply the changes. The install To test it out, change to its directory and run the > Cable ties (long)
script enables I2C, SPI, and serial, disables the app.py program:
Figure 2
Figure 2 Carefully
position your
Raspberry Pi Zero and
Enviro at an angle so
Photos courtesy of Pimoroni
Top Tip
Wireless signal
At the bottom, enter a new line: Attach another Command Strip to the bottom
With the windows
of your Raspberry Pi Zero, then peel the backing shut, we found
@reboot sudo python3 /home/pi/EnviroPlusWeb/ from the other side. Now you need to stick your that the strength
app.py & Raspberry Pi Zero at the bottom of the pipe, below of our air-quality
the PM sensor, at an angle (Figure 2) so that you monitor’s wireless
Press CTRL+X and then Y to save. Now, when you can attach the power cable with enough clearance connection to
our router (on the
reboot Raspberry Pi, it should run automatically to attach the female end of the other pipe bend.
opposite side of
– check that it works and you can access the Try fitting the two pipe bends together so the house) was
web dashboard. that the female end slides all the way in, but a little weak and
Note: When the program is run automatically, don’t force them if they won’t go. Now boot unreliable, with
the resulting data folder (containing JSON files up Raspberry Pi again to check that the script is around 30/70 link
of the logged data) is located in the /home/pi running and everything is working. If so, stick quality – you can
test this by SSHing
directory rather than the EnviroPlusWeb one. Chris some duct tape over the join between the two pipe
in and entering
says that a day’s worth of data is about 62kB, so bends to stop water getting in.
the iwconfig
about 22MB per year, so after about 136 years it will command. Placing
fill the microSD card! a plug-in wireless
booster (a TP‑LINK
Mount the enclosure outdoors RE200) in our
10 The final step is to put your air-quality conservatory
solved this.
Build the enclosure
09 Now all the software is set up and tested,
monitor outside. We used long cable ties (you
can link two together for extra length if needed)
it’s time to build the outdoor enclosure. First, shut to secure our enclosure to the underside of some
down your Raspberry Pi and unplug it from the conservatory guttering, but you may want to attach
power supply. yours to a drainpipe. Either way, cross the cable
Stick a Command Strip to the bottom of the PM ties diagonally to keep it firmly in place.
sensor, then peel off the backing on the other We ran our long USB power cable through a small
side. Take the smaller, male end of one of your window to reach our indoor power socket, but if
downpipe bends and stick the PM sensor inside you have a weatherproof outdoor socket, that’s
the top of it (Figure 1). even better.
RASPBERRY PI
Retro Gaming with Raspberry Pi shows you
how to set up a Raspberry Pi to play classic games.
Build your own portable console, full-size arcade
cabinet, and pinball machine with our step-by-step
guides. And learn how to program your own games,
using Python and Pygame Zero.
Adafruit 1.3″
Color TFT Bonnet
Adafruit magpi.cc/adafruit13tft £17 / $18
SPECS
DISPLAY:
IPS TFT, A compact TFT display with two buttons and a joystick.
240×240
colour pixels, Perfect for gaming? Not so fast! By Lucy Hattersley
controlled
over SPI
A
t first glance, the Adafruit 1.3″ Color TFT “I wouldn’t use it for gaming, as it’s very small and
CONTROLS:
5-way joystick Bonnet for Raspberry Pi reminded us of a not that comfortable.”
and two classic tiny games console. A tiny 33 mm
push‑buttons (1.3-inch) 240×240 display is framed by a five-way What’s it for?
joystick on the left and two buttons on the right. So, if a device so reminiscent of a classic console
CONNECTION:
Qwiic/STEMMA The display is an IPS TFT type controlled over SPI. isn’t for gaming, what is it for? The Bonnet
QT connector Our immediate thought went to the old Game shares a heritage with Adafruit’s Mini PiTFT
for I2C sensors Boy Micro, and we considered putting it inside an (magpi.cc/minipitft13). That device features the
old Nintendo game controller case and turning it same square 33 mm display, but has just the two
CHIP:
ST7789 chipset into an ultra-micro games console. buttons. This Adafruit 1.3″ Color TFT Bonnet comes
This, it turns out, is a bad idea. As Limor Fried with the five-way joystick to enable more complex
DIMENSIONS says in the launch video (magpi.cc/bonnetvideo): interface interactions (the fifth direction is a push
& WEIGHT: inwards, incidentally).
65.5 × 30.6 ×
15.2 mm (2.6 ×
1.2 × 0.6″);
13.0 g (0.5 oz) o, if a device so
S
reminiscent of a classic
console isn’t for gaming,
what is it for?
Like the Mini PiTFT, the Adafruit 1.3″ Color
TFT Bonnet also features a Qwiic/STEMMA QT
connector for I2C sensors. And this is where
things become clearer. You can plug and
play Adafruit’s range of STEMMA QT devices
(magpi.cc/adafruitstemma), which includes all
manner of sensors: magnetometers, temperature,
The tiny 33 mm display running in pressure, proximity, and so on.
kernel mode and displaying a console.
It is in this area where the Adafruit 1.3″ Color TFT
You can read the text if you squint
Bonnet comes alive. What we have here isn’t the
7
ready to give up our dream of a teeny console, we interact with your range of I2C sensors.
attempted to install PICO-8 in this mode and while The screen is sharp, and lovely to look at, but
/10
it did run, the experience was (as Limor claimed) it’s so small that it strikes us as a bit fiddly for
too small. anything complicated.
Maker pHAT
Cytron magpi.cc/makerphat £8 / $10
SPECS
ON-BOARD
COMPONENTS: A board to help beginners get started
Active buzzer,
3 × push-buttons, with physical computing. By Phil King
8 × blue LEDs
W
BREAKOUT: hen trying to learn how to use and
Fully labelled 24-
pin header, plus
program electronics with Raspberry
stacking header Pi, learners – whether in a classroom
setting or at home – face some typical problems.
REMOTE First, you need access to a keyboard and monitor.
CONNECTION: Second, there’s the sometimes tricky business
USB to serial
module of attempting to create electronic circuits from
separate components without getting it wrong
and the possibility of ‘magic smoke’. Then, if your
The board is the perfect size for mounting on a Raspberry Pi
project doesn’t work, it’s hard to tell whether Zero, although stand-offs aren’t included
it’s because your wiring or code isn’t right, or
maybe both. This isn’t helped by the difficulty of certain GPIO pins. Along with three small push-
identifying the correct GPIO pins on Raspberry Pi, buttons, there’s an active buzzer and eight tiny
as they’re unlabelled. LEDs – we were slightly disappointed that they’re
Cytron’s Maker pHAT attempts to solve these all blue and not a range of colours. A nice touch is
issues and make it a lot simpler to get started with the inclusion of a fully labelled, 24-pin breakout
physical computing on Raspberry Pi. header for connecting external components when
you’re done playing with the on-board ones.
Purple PCB While you can simply mount the board on your
The cool-looking purple PCB has some common Raspberry Pi’s GPIO header – with or without
components already on board and connected to the supplied 40-pin stacking header – and start
coding, the pièce de résistance is the inclusion of a
USB to serial module. This enables you to connect
the board to a laptop and control (and power) it and
9
manual includes a Python demo program, which
makes use of GPIO Zero, to get you started – it
/10
even enables you to safely shut down Raspberry Pi
The supplied stacking header provides full GPIO breakout and can
be used to elevate the board on a full-size Raspberry Pi by pressing two of the buttons together.
PC HARDWARE
ENTHUSIASTS
SaniaBOX
Saniabox saniabox.com £144 / $169
SPECS
KIT CONTENTS:
Raspberry Pi 4, A starter kit for teaching coding
preloaded
16GB microSD and electronics. Rob Zwetsloot
card, PSU and
HDMI cables, checks out 13-year-old Sania’s
keyboard,
mouse, Kickstarter success story
SaniaBOX
add-on board,
D
breadboard, espite how easy it is to put together a very
LEDs, diodes
specific physical computing teaching kit
SENSORS: with a Raspberry Pi, there are actually
Thermal sensor, not that many full kits that do so that include a
touch sensor, mouse, keyboard, and Raspberry Pi.
light sensor,
SaniaBOX is slightly different, though. Akin to
optional gas
sensor a mix of the official Desktop Kit and specialised
beginner’s kits, the package comes with the
RELEASE requisite Raspberry Pi, keyboard, mouse, and
DATE: microSD card along with the special SaniaBOX
Sometime
around or after
add‑on board and a series of components.
April 2020 This Kickstarter project brought to life was the
idea of a Sania Jain, a 13-year-old who wanted to
introduce coding to younger kids where possible.
To that end, the all-important add-on board part
of the kit includes a series of sensors, LEDs, as well
as that big three-digit, seven-segment display.
Quick build
Unlike a pi-top or a Piper, you’re not building a
laptop or laptop-esque system – instead you’re
setting up a Raspberry Pi as normal and popping
the HAT-like SaniaBOX add-on on top. Faster than
even loading up your favourite streaming service (we’ll catch up with you later, Picard) and it does
allow you get stuck in straight away with some
coding lessons.
On the microSD card are a series of coding
challenges, and you can find tutorials on the
SaniaBOX website if you want to check out how the
whole system works before diving in. The code for
controlling the add-on bard can be simple (like
with the LEDs) or a little more complicated (as with
a 120-line script for working the seven-segment
displays). The kit comes with some other LEDs,
some diodes, and a breadboard so that you can do
proper circuit prototyping once you graduate from
Sania is the girl
behind the SaniaBOX some of the SaniaBOX add-on’s functions.
76 magpi.cc SaniaBOX
REVIEW
8
$20 knocked off. Considering that the Raspberry
Pi Desktop kit with a very similar selection of
/10
components will set you back £100 / $120, we think
SaniaBOX comes in a great-looking box with all the components
you need to start using and learning with Raspberry Pi it’s a pretty good deal.
SaniaBOX magpi.cc 77
REVIEW
10 Best:
Pi Zero Talking Radio
Audio
have an old-fashioned news bulletin
voice, but it’s the spirit that counts.
magpi.cc/talkingradio
R
aspberry Pi is not-so-secretly a multimedia
magpi.cc/pssp
powerhouse. With software like Kodi for TV
streaming, RetroPie for a bit of gaming, and
even jukebox software for your parties, it can handle
just about anything. Here are some of our favourite
ways that its audio skills have been put to use.
Google Pi Intercom
magpi.cc/intercom
Wavepad
magpi.cc/wavepad
magpi.cc/themetune
Ultrasonic theremin
magpi.cc/theremin
Audio Radar
Flirt Pi
Accessible sodar
Retro internet radio
Using sound to detect distance is pretty standard tech, but it
This is a 1970 Flirt radio that upcycling maestro Martin Mander has turned always helps to make it easier. This sodar project helps you
into a Raspberry Pi-powered internet radio, without sacrificing much of its do that.
wonderful aesthetics.
magpi.cc/audioradar
magpi.cc/flirtpi
Piano Stairs
magpi.cc/pianostairs
Retro Gaming
with Raspberry Pi
Play the
game
If you want to just
play games, take a
look at these sites
Raspberry Pi While Code The Classics tells the consoles – and how to build RETROPIE
CREATOR
Press story of retro games, and how a portable games machine, RetroPie is the easiest way to
to create your own versions, arcade cabinet, and even a turn a Raspberry Pi into a classic
Price: Retro Gaming with Raspberry pinball machine. You’ll also games console. Once you set
£10 / $13 Pi is all about building discover how to upgrade classic this up, you’ll be able to play all
magpi.cc/retrogaming retro games consoles and computers, like a ZX Spectrum, those classic games.
arcade machines. with Raspberry Pi to bring the retropie.org.uk
In it you’ll discover how to best of the new to the best of
emulate classic computers and the old. PICO-8
PICO-8 turns Raspberry Pi into
a fantasy console that’s like an
8-bit gaming machine. You can
Ronelus
[email protected]
for ‘Socratic Discussion
and other dialogues’
> Day job STEM Education Research Scientist > Community role Educator
> Website magpi.cc/alchemistclub
H
earing how some people Wednaud told us. “When the What is Alchemist Club Studios?
refer to Raspberry Pi Raspberry Pi came out in 2012, I The Alchemist Club School &
can be very humbling. knew that education would never Studios is an educational
However, when a STEM education be the same again. I was totally platform that is designed to
researcher for New York City of blown away by this small credit- immerse learners in developing
over 20 years like Dr Wednaud card-size computer.” deep understanding of STEM
Ronelus tells you that the release Shortly after it came out, he concepts, ideas, and fundamental
of Raspberry Pi meant nothing got his own Raspberry Pi and principles by using a ‘physical
would be the same again, it’s started meeting with New York approach’ to computing in
quite high praise. City’s top technologists to learn education. One of the main goals
“I have been testing cutting- more about it. He also attended of the Alchemist Club School &
edge ideas of how to bring a early Raspberry Jams and Studios is addressing the crisis of
paradigm shift in STEM teaching events. One of the things to minorities under-represented
Students have access
and learning using the latest come out of this was Alchemist in STEM.
to some of the rare
Google AIY kits emerging technologies,” Club Studios. We have developed an
innovative learning platform to
help students develop a working
understanding of bleeding-edge
learning technologies… our first
initiative focuses on using the
Google Artificial Intelligence
Yourself (AIY) Project Kits
(Voice and Vision) to help
learners develop a working
understanding of machine
learning, artificial intelligence,
deep learning, and the Internet
of Things by constructing
learning artefacts that are used
to assess STEM content mastery,
critical thinking skills, and
academic self-efficacy.
One of the main goals of the
Alchemist Club School & Studios
Switch
of career
Students get to learn about a lot of AI and other
computing subjects at Alchemist Club Studios “My educational
background is in the
is to take advantage of the Google learning environments since the minorities under- physical sciences. You
might find this hard
Classroom educational learning 2013. I have collected tons of represented crisis in STEM.
to believe: I left an
platform to develop a data and learning artefacts
MD/PhD program in
professional development portal throughout the learning process. What kind of students do Molecular Genetics-
for educators to learn how to Along the way, I have you get? Gene Therapy to
construct the Google AIY projects introduced many future electrical Well, that’s a very difficult go into education
and take it back to their engineers, coders, and computer question; if you are talking because I understood
classroom learning environment scientists to the magic of science the gravity of the
about socioeconomic level, we
minorities under-
and enact the curriculum. We also via the Raspberry Pi. are at the bottom of the ladder
represented in STEM
focus on educational outreach in the South Bronx, NYC. When crisis. This reality hit
using a global perspective. Since What kind of teaching it comes to health-related me like a brick when
every educator has access to programs do you run? crises, the Bronx is the worst of I was taking some
Google Classroom, we have I am running a cutting-edge the five boroughs in New York advanced courses in
opened the learning portal to STEM program in the Alchemist City. Let’s not talk about Physical Chemistry,
Thermodynamics,
educators all over the planet. Club Studios to prepare the next poverty, housing, education,
Quantum Mechanics,
murder, suicide. You name it! Quantum Computing,
However, these social
e’ve since trained over 1000
W dilemmas have nothing to do
and other emerging
topics in the physical
This Month in
Raspberry Pi
#MonthOfMaking
You’ve been making and sharing – here’s some of our faves!
A
t the time of writing, #MonthOfMaking 01
is far from over. Many of you have been
having a lot of fun creating and sharing
already, though, so here’s just a small selection of
what we’ve seen so far!
84 magpi.cc #MonthOfMaking
THIS MONTH IN RASPBERRY PI
02
04
03
06
05
08
07
09
10
#MonthOfMaking magpi.cc 85
THIS MONTH IN RASPBERRY PI
Coolest Projects
USA 2020
Coolest Projects is back in LA to show off more amazing projects from younger makers!
A
few weeks ago, Coolest Projects USA
returned to the Discovery Cube to once
again showcase incredible young makers.
We weren’t there this year, but it sounded as
great as ever, and there are loads of amazing pics
to prove it.
01
02
04
03
01. The venue is huge
and bustles with
maker activity!
02. There were many
teams making many
kinds of projects
03.
Showing off sewing
skills driven
by making
04. Accessibility projects,
like this ‘memory 05
assistant’, were
also featured
05. Presenting your
project is a big part of
Coolest Projects
06. Winners are treated
to a rain of ticker tape
06
CROWD
A PROFJUNDING
If you
ECT?
’ve launc
Raspb hed a
erry P
projec i-relate
CloverPi
t, let u d
magp s know
i@ras !
pberry
pi.org
kck.st/2VwQn0d
magpi.cc/punywatch
BATMAN 66 PINBALL
Vector Space in Central Virginia is hosting the nation's
most immersive and exciting maker camps this summer.
Our overnight camps feature a RaspberryPi alarm clock
in week one, with an in-depth
examination of materials, the use
of exciting new technologies, and
some of human kind's oldest
fabrication techniques. Each camp
is taught by leading maker
Hooking a pinball machine up to the internet is cool, but hooking educators recruited from around
a pinball machine up to the internet based on the 1966 Batman TV the country. Rising college freshmen
show is cooler. can enroll online today.
magpi.cc/batman66 Three Sessions: July 12 - August 1
Enroll at vector-space.org/makerversity
EVENTS
POSSIBLE EVENT
CANCELLATIONS
Please follow local public health
advice and take decisions on
whether to cancel clubs or 07
06
events in consultation with the
venues that host them.
03
Raspberry Jam
Event Calendar
Find out what community-organised Raspberry
Pi-themed events are happening near you…
08
FIND OUT
ABOUT JAMS
Want a Raspberry Jam
in your area? Want to
start one?
[email protected]
Risk assessment
“R
isk assessment is about achieving a
balance between a reasonable level
of risk, and being able to get on with
organising your activities. Remember, no
activity is completely free from risk, and
doing a risk assessment is not about making
01 your activities risk-free.”
05 Resource Centre
IN THE PROCESS,
YOU’LL DISCOVER HOW TO:
Set up and use the free Create and texture 3D Make enemies that follow
software you’ll need character models and attack the player
Your
Letters
Reading at home
I’m looking for more stuff to read
while at home and was wondering
if there was a way to read all of
The MagPi at all? Do you have like
a big bundle magazine offer I can
get from you at all?
Hi The MagPi,
My Daughter Zivah was born on Tuesday! Daddy's first present to
her? A Raspberry Pi of course! (Although, I think it'll be a few years
until it comes in use, so I might have to use it for now.)
Could I get this little photo attached and a small passage in The
MagPi letters section, just as something so I can show her when
she’s older? #codersofthefuture!
Your wish is our command. We hope she gets to enjoy her Raspberry Pi
Remember, our PDFs are free from our website if you
need another way to stock your library! in the future in whatever way she desires!
Contact us!
> Twitter @TheMagPi
> Facebook magpi.cc/facebook
> Email [email protected]
he use of white USB cables with
T
the official case makes this very
> Online raspberrypi.org/forums
aesthetically pleasing
Competition magpi.cc 95
SUBSCRIBE AND
SAVEUP
TO
35%
on the cover price
ISSUE #29
OUT NOW
hsmag.cc
NEXT MONTH
EDITORIAL
Editor
Lucy Hattersley
[email protected]
Features Editor
Rob Zwetsloot
[email protected]
Sub Editors
Phil King and Nicola King
ADVERTISING
Charlotte Milligan
[email protected]
+44 (0)7725 368887
HOME
DESIGN
criticalmedia.co.uk
Head of Design
Lee Allen
Designers
Sam Ribbits, Harriet Knight
Illustrator
Sam Alder
CONTRIBUTORS
Mike Cook, David Crookes,
PJ Evans, Rosemary Hattersley,
Nicola King, Simon Monk
AUTOMATION
PUBLISHING
Publishing Director
Russell Barnes
[email protected]
Director of Communications
CEO
DISTRIBUTION
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.
Learn Java and magpi.cc/subscribe Building, St. John’s Innovation Park, Cowley
Road, Cambridge, CB4 0DS. The publisher,
editor, and contributors accept no
electronics responsibility in respect of any omissions
or errors relating to goods, products, or
Create your own magic TWITTER @TheMagPi services referred to or advertised in the
magazine. Except where otherwise noted,
mirror modules content in this magazine is licensed under
FACEBOOK fb.com/MagPiMagazine a Creative Commons Attribution-
ZX Spectrum Next NonCommercial-ShareAlike
3.0 Unported
Accelerated reviewed EMAIL [email protected] (CC BY-NC-SA 3.0).
ISSN: 2051-9982.
THE FINAL WORD
I
’ll let you in on a secret: The MagPi Jams, last year’s Scratch Conference, our website (magpi.cc). Feel free to
magazine team has always been and the birthday parties. add comments below each story. Write
mobile. We work in various towns Community and sharing are more to us at [email protected]; we
and cities, mostly in the UK. difficult right now, and I have little to will respond.
There are Raspberry Pi Towers in add on that subject. In the words of And please take out a subscription
Cambridge, and we return to the the great Rod Stewart: “I don’t want to to a magazine. I don’t mind which one
mothership from time to time, but talk about it.” you subscribe to (obviously, there are
we’re happily floating around our Talking about it is a job for one or two I recommend).
parts of the world. somebody more eloquent. Raspberry Print publications are wonderful,
It’s been a long time since I was a Pi Foundation’s Chief Executive Philip physical, tactile things. They are made
9-to-5er chained to an office desk. Colligan has written a wonderful blog with love by people who care; curated
When I first broke free from the office post about the organisation’s response by experts and written by heartfelt
routine, I used the time and learned to (magpi.cc/eventresponse) enthusiasts. They pop through the
door once a month like a surprise
rint publications are wonderful, physical,
P present, and they always cheer me up.
Magazines – even if they think
tactile things they’re about caravans, or fishing,
or knitting – are always about
program with MITx’s Computational From the many wise words in community. The word comes from
Thinking using Python XSeries Philip’s post, this caught my eye: the French ‘magasin’ meaning,
(magpi.cc/mitpython). “[Raspberry Pi] has always been an ‘storehouse’; it’s about collecting
Coding is important, but I don’t organisation and a community where things together: in this case, people.
think it matters what you learn: paint people genuinely care about and There’s a nerd joke: ‘Now is the time
a picture, learn cheese-making, or support each other. Let’s all double for us to come together; separately;
artificial intelligence computing down on that now.” in our own homes.’ Drum rolls;
paradigms, or how to play the flute; or The MagPi magazine is our refuge. everybody laughs.
make some incredible gadget with a Here is where we all come to learn There are lots of ways we can come
Raspberry Pi and wires. about the amazing projects being built together. Let’s use them.
Learning from and teaching others by the community; it’s a platform for
is the ‘root and heart and soul and you to share your creations.
Lucy Hattersley
AUTHOR
centre’ of Raspberry Pi. It’s not just We are a sociable bunch. You’ll find
what we do: it’s what we are. us on Facebook (magpi.cc/facebook)
Lucy is editor of The MagPi magazine.
and Twitter (magpi.cc/twitter).
Social-distancing amateur-professional.
Sharing for the soul Be especially sure to join in on our May be distracted by Animal Crossing. Bit
The other thing I love about Raspberry #MyLatestBuild and #MagPiMonday nerdy but really likes to hug, which is awks
Pi is the community. I adore going to Twitter chats. If you don’t care for at the best of times.
events like Pi Wars, and the Raspberry social media, we post stories daily on magpi.cc