Professional Documents
Culture Documents
The MagPi 2023-07
The MagPi 2023-07
CC/STORE
CHAT TO AN
MAKE AN AI-POWERED
ELECTRONIC FORTUNE TELLER
BOP-A-MOLE
DISCOVER GAME
DEVELOPMENT TOOLS
magpi.cc/store
WELCOME
to The MagPi 131
W
e love animals and robots here at The MagPi. There’s
lots of similarity: both need training, feeding, and
nudging with frustration and love.
Lately, we’ve tested some incredible bots with arms, legs,
and limbs. All are controlled by Raspberry Pi and powered by
servo motors. So, we thought it time to limber up and herd
them together into a giant Python Robots feature (page 28).
Lucy
EDITOR
If real-life animals are more your thing, check out Rob’s Hattersley
feature on capturing wildlife with Raspberry Pi (page 66). Lucy is editor of
Setting up camera traps to snap wildlife is a great hobby that The MagPi and was
snapped at quite a
lets you take only photos without scaring critters. few times by dogs
as a pestering child.
This month’s magazine ticks a lot of boxes for me. But magpi.cc
there’s much more to it than animals and robotics. Flick over
the page and take a look at the contents.
magpi.cc 03
Full-Code
now with a
Tel: +47 990 80 900 • info@cdptech.com
CDP Technologies AS // Hundsværgata 8, 6008 Ålesund, Norway
CONTENTS
Contents
> Issue 131 > July 2023
Cover Feature
28 Python Robots 28
Regulars
24 Case Study: Sisyphus
90 Your Letters
97 Next Month
98 The Final Word
Project Showcases
08 Trainbot
12 Ohsillyscope
14 Olga The Fortune Teller
18 Chonky Pocket
20 GPS Pothole Tracker 14
18
The MagPi is published monthly by Raspberry Pi Ltd, Maurice Wilkes Building, St. John’s Innovation Park, Cowley Road,
Cambridge, CB4 0DS, United Kingdom. Publishers Service Associates, 2406 Reach Road, Williamsport, PA, 17701, is the mailing
agent for copies distributed in the US and Canada. Application to mail at Periodicals prices is pending at Williamsport, PA.
POSTMASTER: Send address changes to The MagPi, c/o Publishers Service Associates, 2406 Reach Road, Williamsport, PA, 17701.
magpi.cc 05
CONTENTS
Tutorials
40 Game engines for Raspberry Pi 52 62
48 Build a Mole Bop game
52 Taking video on Camera Module
58 Rad your Ride
62 Create interactive stream lights
Taking video on Create interactive
The Big Feature Camera Module stream lights
66
79
Community
84 Alistair MacDonald interview
86 This Month in Raspberry Pi Alistair MacDonald interview
06 magpi.cc
PROJECT SHOWCASE
Trainbot/OnlyTrains
A grandstand view led a Swiss hobbyist to record passing trains using
Raspberry Pi’s camera, learns Rosie Hattersley
L
iving in sight of a railway has proved 8ZOPW ,=L^[MP]]d;T_ZRZZO`^PNZY_]ZWWTYR
inspirational for many: Suggs from Madness; the door to a co-working space at the ETH
Rod Stewart, your writer’s Dad! It was also the Entrepreneur Club where he was a member, using
catalyst for Trainbot, an automated photography Slack (magpi.cc/dooropener). There isn’t much
project triggered by the engines and carriages call for the computer vision skills that were part
running past the window of maker Jonathan Müller of his degree course, but Jonathan enjoys creating
in Zurich, which stitches shots together to appear projects that exploit his technical knowledge.
as complete trains. Acknowledging the geeky but When Jonathan moved into his apartment two
Jonathan
MAKER
passionate hobby of trainspotting, he created a years ago, he quickly realised that the unique
Müller website on which to view the resulting photos and view it gave him of the trains going by would
named it OnlyTrains. make for an ideal project subject. “Inspired by the
Software engineer
Jonathan enjoys ^WT_^NLYʭYT^SP][SZ_ZR]L[S^Q]ZXMTVP]LNP^4
challenging code Room with a view then came up with the idea of creating pictures
projects and 5ZYL_SLYʭ]^_NLXPLN]Z^^=L^[MP]]d;T with similar aesthetics – but of trains instead of
has been using
Raspberry Pi for
when he was still an electrical engineering bikes, and a cheap camera instead of specialist
nearly a decade. ^_`OPY_MLNVTY3P[]ZX[_Wd[`_ST^ʭ]^_ hardware,” he explains. Slit-scan photography
trains.jo-m.ch
08 magpi.cc Trainbot/OnlyTrains
PROJECT SHOWCASE
The machine-learning
algorithm is largely successful
at distinguishing white-painted
carriages from snow, most
weather conditions, and neatly
stitches the resulting photos
Quick FACTS
> Jonathan’s day
job involves work
with drones
He was keen to use the Go support.” It is also powerful enough to handle the
graphical computations required, while being less
used a webcam
housed in a kids’ toy
see how well it worked object tracking.” > OnlyTrains fans can
now save special
Trainbot/OnlyTrains magpi.cc 09
PROJECT SHOWCASE
There was also a lot of “testing and tuning” notes that this led to missed frames, or wrongly
involved in ensuring the computer vision setup estimated ones, which led to chopped-up images.
bL^LMWP_Z]PNZRYT^PXZ^__]LTY^ɭ4^ZZYʭR`]PO To address this, he added a step after the initial
out that patch-matching alone is not robust image gathering which applied an estimation and
enough to estimate train velocity.” Jonathan ^XZZ_STYR[]ZNP^^`^TYR=,9>,.LYOɭL^TX[WP
s = v0 + a*t model” to estimate start velocity and
LNNPWP]L_TZY=,9>,.T^LNWL^^TNLWNZX[`_P]aT^TZY
approach used to estimate a model when there
are lots of outliers. He wrote much of the code
himself, including instructions for patch-matching
and the low-level computer vision, to keep things
The mock-up model
was housed in a toy
as light as possible.
casing and had a With half of the coding and cross-compilation
webcam for a camera
done in Go, Jonathan tried out Trainbot on his
Another of Jonathan’s =L^[MP]]d;T,_ʭ]^__SP[]ZUPN_`^POLbPMNLX
Raspberry Pi projects
provides timetable M`_L^^ZZYL^5ZYL_SLY]PLWT^PO=L^[MP]]d;T
information –
also makes camera modules, he switched over to
something he’s keen to
integrate into Trainbot HQ Camera Module 3, resulting in “much higher
10 magpi.cc Trainbot/OnlyTrains
PROJECT SHOWCASE
Set up a slit-scan
Ÿå±ƋųĜŞŅÚØŅųŅƋĘåųĀƻĜĹčĵåÏʱĹĜŸĵØ
01 ƋŅƋų±ĜĹƼŅƚųϱĵåų±ŅűŸĜĹčĬåŸŞŅƋţ¥Ņƚ
ƵĜĬĬĹååÚŞĬåĹƋƼŅüüŅŅƋ±č埱ĵŞĬåŸŅüƵʱƋåƴåų
ƼŅƚűųåŞĘŅƋŅčų±ŞĘĜĹčƋŅƋų±ĜĹƋĘåŸŅüƋƵ±ųåƋŅ±ƚƋŅě
ųåÏŅčĹĜŸåƋĘåĜųŞųåŸåĹÏåţ
ŸåIŅűƋʱĹűŸ:ŅÏŅÚåƋŅƋų±ĜĹƋĘåŸƼŸƋåĵ
02 ±ĹÚŸƋĜƋÏĘƋŅčåƋĘåųƋĘåĜĵ±čåŸĜƋųåÏŅčĹĜŸåŸ
±ŸÆåĬŅĹčĜĹčƋŅƋĘ埱ĵåƴåĘĜÏĬåŅųŅÆģåÏƋ×
magpi.cc/trainbotţ
Raspberry Pi is protected
inside a waterproof case
åƋƚŞƋĘåϱĵåų±Ø±ŸŞÆåųųƼ{ĜĉرĹÚ
03 ÏŅĹĹåÏƋŅųŸĜűŸƋƚųÚƼƵå±ƋĘåųŞųŅŅüϱŸå
ƵĘåųåŞĘŅƋŅŸÏ±ĹÆåƋ±ĩåĹƵĜƋĘŅƚƋƋĘåĬåĹŸčåƋƋĜĹč
ƵåƋţŸå8{±ĹÚ}XĜƋåƋŅ±ƚƋŅĵ±ƋĜϱĬĬƼƚŞĬŅ±Ú
ŞĘŅƋŅŸƋŅ±ƵåÆŸåųƴåųüŅųåƴåųƼŅĹåƋŅƴĜåƵţ
Trainbot/OnlyTrains magpi.cc 11
PROJECT SHOWCASE
Ohsillyscope
With Thomas McDonald’s ingenious riff on the oscilloscope,
live music performances don’t just sound great, they look
good too, as David Crookes discovers
W
L_NS_SPZʯNTLWaTOPZQZ]_SP,]N_TN ?SP]P^`W_T^L[]ZUPN__SL_NLYMP_LVPYZY_SP
8ZYVPd^ɪ2]LXXdYZXTYL_PO^TYRWP ]ZLOL^LaT^`LWLNNZX[LYTXPY__ZX`^TNLW
Do I Wanna Know?Q]ZXLYOdZ`ɪWW [P]QZ]XLYNP^ɭ,_ʭ]^_4bL^_STYVTYR_SL_4NZ`WO
^PP^Z`YObLaP^aTM]L_TYRTY^dYNS]ZYT^L_TZY SLaPT_bZ]V_S]Z`RS84/4FL[]Z_ZNZWbSTNSWP_^
bT_S_SP[P]N`^^TZYWPLOR`T_L]LYO^TYRP],WPc X`^TNLWTY^_]`XPY_^NZX[`_P]^LYOZ_SP]
?`]YP]MPQZ]P_`]YTYRTY_ZLYLYTXL_TZY SL]ObL]PNZXX`YTNL_PbT_SPLNSZ_SP]HM`__SP
4_ɪ^L^TX[WPdP_NZX[PWWTYRPʬPN_LYOT_NP]_LTYWd TOPLZQYPPOTYR_ZMPSZZVPO`[_Z_SP^ZQ_bL]P
^_]`NVLNSZ]ObT_SX`^TNQLY^^`][L^^TYRXZ]P ,MWP_ZY7TaPVTWWPO_SPXZ_TaL_TZY_Zb]T_PLYPY_T]P
Thomas
MAKER
_SLYLMTWWTZYaTPb^ZYDZ`?`MPTYɭ8d WTM]L]d_ZOZ^Z4bLY_PO^ZXP_STYR_SL_OTOYɪ_
McDonald QLaZ`]T_P[L]_ZQRZTYR_ZNZYNP]_^T^LWbLd^RZTYR ]P\`T]PMPTYRMdLNZX[`_P]_Z]P[]P^PY_X`^TNɮ
_ZMP_SPaT^`LW^LYO_SPX`^TNaTOPZOPʭYT_PWd
Thomas graduated
from UCCS with a TY^[T]POXPɮ^Ld^?SZXL^8N/ZYLWO4_ɪ^WPO_Z Looking good
major in Computer _SPN]PL_TZYZQLYZ[PY^Z`]NPaP]^TZYZQLY ?SZXL^WZaP^`^TYRST^N]PL_TZYɭ4_ɪ^^XLWWLYO
Science and a Z^NTWWZ^NZ[PbSTNSOT^[WLd^WTaPL`OTZL^L [Z]_LMWPɧ^ZXP_STYRdZ`U`^_[W`RTYVYZbTYR_SL_
minor in Statistics.
He’s an outdoors
bLaPQZ]X?SZXL^NLWW^T__SPɭ:S^TWWd^NZ[Pɮ
enthusiast, dog dad, ?SP[]ZUPN_LWWZb^?SZXL^_Z[WLdX`^TNLW
and music junkie. TY^_]`XPY_^LYO^PP_SP_`YP^aT^`LWT^POL^bLaP^
magpi.cc/ ZYL!!70/XL_]TcOT^[WLdɭ,Q_P]RP__TYR_SP
ohsillyscope 70/XL_]TcLYO[WLdTYRL]Z`YObT_ST_4ʭR`]PO
_SP]PbZ`WOSLaP_ZMPLbLd_SL_4NZ`WO`^PT_
bT_SXdR`T_L]LYOZ_SP]X`^TNLWTY^_]`XPY_^ɮ
SPPc[WLTY^ɭ4_ɪ^LWbLd^]PLWWdQ`YbL_NSTYR
_SPWTaP^TRYLWQ]ZX^dY_SP^T^P]^ZQ_bL]PM`_4
TXLRTYPO4NZ`WOXLVP^ZXP_STYRXZ]P[Sd^TNLW
bT_S _SPXL_]Tcɮ
Live jives
?SPTOPLSPPc[WLTY^MZTWPOOZbY_Z]PRT^_P]TYRL
WTaPL`OTZ^TRYLWbT_SL=L^[MP]]d;TNZX[`_P]
ɭ/ZbY_SPWTYP4bLY__ZXLVP^ZXPXZ]P
NZX[WTNL_POaT^`LW^_SL_L]P]PLN_TaP_Z_SPL`OTZ
^TRYLWNZXTYRTYɮSP^Ld^
4_SL^TYaZWaPONZYYPN_TYR_SPXL_]Tc[LYPW_ZLY
,OLQ]`T_=2-8L_]Tc3,?LOOZYɭ4SLaP
=L^[MP]]d;T]PNZRYT^P_SPL`OTZTY_P]QLNPT_ɪ^
SZZVPO`[_ZLYO4ɪaP`^PO7TY`cɪ^,OaLYNPO7TY`c
>Z`YO,]NST_PN_`]P,7>,WTM]L]d_Z]PLO_SP^TRYLW
Q]ZX_SPTY_P]QLNPLYO[WLNPT_TY_Z_SP.NZOP
]`YYTYR_SP70/XL_]Tcɪ^WTM]L]dɮ?SZXL^^Ld^
Thomas wanted a
way to play his guitar ɭ4_ɪ^^LX[WTYRL__SP]PQ]P^S]L_PZQ_SP^N]PPY
and see a visual
bSTNSXLVP^L]PLWWdNZZWaT^`LWɮ7PL]YXZ]P
representation of the Once the music starts, the project – which can use
tunes on screen at LW^L[]ZUPN_Z]R a Raspberry Pi Zero computer – will burst into life
12 magpi.cc Ohsillyscope
PROJECT SHOWCASE
The Ohsillyscope
reads live audio
The 64×64 LED matrix from ALSA sources
displays a waveform image
in real-time and it can do
so in various colours
Quick FACTS
> The device visually
represents music
> It displays it on an
LED matrix
^SZbQZ]LYdZYPbL_NSTYRɮSP^Ld^ɭ?SP[PZ[WP
bPɪaP^SZbY_SP:S^TWWd^NZ[P_Z^ZQL]^PPX_ZWZaP
You can create
T_LYOZYNPbP^_L]_RTRRTYRXZ]PT_ɪ^^`]P_ZRP_ your own version
of the Ohsillyscope
_SPMLYOXZ]PL__PY_TZYɮBPɪ]POPʭYT_PWd^`]P
since the code is
_SL_T_ɪ^RZTYR_ZWZZVRZZOZY_SPOLYNPʮZZ] open-source
Ohsillyscope magpi.cc 13
PROJECT SHOWCASE
Olga The
Fortune Teller
Admiring glances across an office led to a creative
partnership involving several Raspberry Pi models
and some charming AI, learns Rosie Hattersley
L
ast issue, we brought you details of the Love
Machine ChatGPT project which dished out
compliments and sometimes sweets based
on cutesy WhatsApp exchanges. Raspberry Pi
^_LʬP]^LYOThe MagPiXLRLeTYP]PLOP]^bP]PYɪ_
_SPZYWdZYP^_ZQLWWQZ]T_^,4NSL]X^,NZX[LYd
_SL_^SL]P^ZʯNP^[LNPbT_S7ZaP8LNSTYPXLVP]^
6LVL[Z7LM^bP]PP\`LWWdPY_]LYNPOLYO^ZZY
XLOPLXZaP[]Z[Z^TYRLNZ`[WTYR`[LYOL
RWZb`[ ?SP]P^`W_%:WRL?SP1Z]_`YP?PWWP]L
^STYdYPb.SL_2;?XZOPWOP^TRYPO_ZL[[PLW_Z
_SP4Y^_L^LaadTYʮ`PYNP]VPPY_ZNSPNVZ`_MZ_S
_SPWL_P^_^VTYNL]PZ[_TZY^LYO]PNPTaP]PL^^`]TYR
XP^^LRP^LMZ`__SPT]Q`_`]PQLXPLYO
QZWWZbP]NZ`Y_
Altered images
:WRL?SP1Z]_`YP?PWWP]bL^OP^TRYPOTY
[L]_YP]^ST[bT_S,W_P]/LNZX[LYd_SL_OP^TRY^
OT^[WLd^QZ]]P_LTWP]^-Z_SNZX[LYTP^L]PML^POL_
3ZYPhone.londonLN]PL_TaP^[LNPTY0L^_
7ZYOZY?SP_PLXQ]ZX,W_P]/bL^ZY_SPWZZVZ`_
ɭQZ]^ZXP_STYRaT^`LWWdL__PY_TZYR]LMMTYRɮ^Lb
Kakapo Labs:
MAKER
6LVL[Zɪ^7ZaP8LNSTYPRZ__LWVTYR_ZT_^XLVP]^
India, Will LYO_STYR^bPY_Q]ZX_SP]P
Lahr; AlterD:
BT_SL]P_LTWOT^[WLd_]LOP^SZbNZXTYR`[
Will Lucking,
Claire Richards TXXTYPY_Wd,W_P]/NSZ^PLNL]OMZL]OML^PO
OP^TRY_Z^SZbZʬ_SPXL_P]TLWɪ^[Z^^TMTWT_TP^ɭ4_
AlterD creates bL^TX[Z]_LY__SL_T_OTOYɪ_WZZV_ZZ^[PNTʭNLWWd
retail displays for
WTVPLYd[L]_TN`WL]M]LYO^Z_SPdbPY_QZ]LQ`Y
clients and shares
SǽGIWTEGI[MXL \`T]VdO]PLXWTVPWZZV?SPdbLY_PO_ZLOOLY
interactive design TY_P]LN_TaPPWPXPY__ZPYNZ`]LRP[PZ[WP_ZTY_P]LN_
agency Kakapo
bT_S_SP^_LYOLYO^_L]_NZYaP]^L_TZY^ɮ6LVL[Z
1EFW[LMGLVSYXMRIP]
YWIW7EWTFIVV]5MMR 7LM^QZ`YOP]BTWW7LS]Pc[WLTY^
its creations. ,^bT_S7ZaP8LNSTYPXZMTWPNZYYPN_TaT_dbL^
magpi.cc/ aT_LW^Z_SPdNSZ^PL;TNZB%ɭ^TX[WPWZbNZ^_
kakapolabs LYO^XLWWM`_L__SP^LXP_TXPFT_HNLY]`YLQ`WW
Quick FACTS
Olga gets ChatGPT to
foretell your fortune, > 4PKEGSWXEVSYRH
sending it to a cloud fXSFYMPH
server for Pico W to
download and deliver > .X[EWSVMKMREPP]
as printed ticket KSMRKXSFIEZMWYEP
KYIWWMRKKEQI
> LIJIEXYVIW
(LEX,58ƶWRI[GLEX
(SQTPIXMSRQSHIP
.SL_2;?QZ]LMWLNVLYObST_PNL]_ZZYTXLRPZQL
QZ]_`YP_PWWP]1Z]_`YP_Pc_LYOR]L[STNL]P
TX[Z]_POLYOPYNZOPOL^LYTXLRP_SL_NLYMP
]PNZRYT^POMdE;7_SPWLYR`LRP`^POMd_SP
[]TY_P]7LRRd[P]QZ]XLYNP[]ZNP^^TYRLYO
Z`_[`__TYR_SPTXLRP^WPO_SP6LVL[ZLYO,W_P]/
_PLX_Z^bT_NSQ]ZX_SP`Y]PWTLMWPPcT^_TYR
BPM>ZNVP_OPWTaP]d^P_`[?SPɭX`NSMP__P]ɮ
^d^_PX_SPdTX[WPXPY_PO^LaP^_SP_TNVP_TXLRP
ZYWTYPLYOU`^_`^P^BPM>ZNVP__Z^PYO;TNZB_SP
@=7TYZ]OP]_ZOZbYWZLOLYO[]TY_T_
Fortune favours
:WRLSP]^PWQT^ZQNZ`]^PLWL]RP[L]_ZQ_SP
L[[PLW>SPSL^LQLNPN`_Q]ZXL^SPP_ZQ[P]^[Pc
4PKEƶWKSVKISYW bT]PWP^^^_LNVbSTNST^PL^d_Z`^PɮBT_S LYO^ZXPPc_]PXPWdPc[]P^^TaPPdPM]Zb^_SLYV^_Z
face and expressive
I]IFVS[W 8TN]Z;d_SZYZY_SP;TNZB_STYR^bZ]V[LTYWP^^Wd L;TNZBXTN]Z^P]aZ^LYO^ZXPMWLNV_S]PLO_SL_
[IVIPEWIVGYX LYO_SPOPaPWZ[XPY__TXPT^^SZ]_4_ɪ^`^POSP]P SPW[_SPXbTRRWP>SPLW^ZTX[L]_^SP]bT^OZXaTL
_ZNZXX`YTNL_PbT_SLEPM]L_SP]XLW[]TY_P]aTL LQLYNdYPbXPLY^ZQNZXX`YTNL_TYRO`P_Z
LY=>NZYYPN_TZYLYO[]ZX[_T__Z[]TY_Z`_L NSLYRP^_Z.SL_2;?_SL_:[PY,4]PNPY_Wd
^_LYOaT^T_Z]ɪ^QZ]_`YP_TNVP_.SL_2;?T^ TX[WPXPY_POM`_T_ɪ^^_TWWML^POZYBSL_^,[[
TY^_]`N_PO_Z%ɩ;]P_PYOdZ`L]PLQZ]_`YP_PWWP]LYO LYO?bTWTZWTVP:WRLɪ^^TMWTYR_SP7ZaP8LNSTYP
_PWW_SP[P]^ZYdZ`L]P_LWVTYR_ZɧbSZT^NLWWPO ^PPThe MagPi magpi.cc/130
9,80ɧ_SPT]QZ]_`YPTYL[ZPXZQ_S]PPZ]QZ`] ?SPM]TPQQ]ZX,W_P]/bL^QZ]L[WLdQ`W
^SZ]_WTYP^8LVP^`]P_SPT]QZ]_`YPT^aLR`PM`_ TY_P]LN_TaPOT^[WLd^SZbTYRZʬ_SP[Z^^TMTWT_TP^QZ]
[Z^T_TaP 4YNW`OPLW`NVdT_PX]P_LTW]PWL_POɪ ]P_LTW^P__TYR^3ZbPaP]BTWW[ZTY_^Z`__SL_
,NZYN`]]PY_]P\`P^_T^XLOP_Z/,770LY N]PL_TYR^ZXP_STYRaP]d\`TNVWdLYOPʯNTPY_Wd
TXLRPRPYP]L_Z]XLOPMd_SP^LXP[PZ[WPL^ `^TYR^PaP]LW;TNZB^bSTNSMPTYRNZYYPN_PO
(SPSYVGLERKMRK
1*)WQEOIXLI
booth design
QSVII]IGEXGLMRK
and hide Olga’s
GEVHFSEVHSYXPMRI
Characterful interaction
QZ]TY_P]LN_TZY_S]Z`RSL^SZ[bTYOZbɧ`^TYRL
[SZYPL^LOPaTNP_ZWP_^ZXPZYPZ`_^TOP_SP
bTYOZb[WLdbT_S^ZXP_STYRTY^TOP_SPbTYOZbɮ
SP^Ld^LYOT^`[QZ]NZWWLMZ]L_TYRbT_SZ_SP]
[L]_YP]^QZ]XZ]PQ`Y[WLdQ`W[]ZUPN_^
ɭ:WRLXLdYZ_MPLMWP_Z[]POTN__SPWZ__P]dZ]
Pico W controls the LED lights around Olga’s
_PWW`^bSPY_SPNZ^_ZQWTaTYRN]T^T^bTWWPYOM`_ 02 make-up mirror, as well as the servo motors
bSL_^SPNLYOZT^ZʬP]LRWTX[^PTY_Z_SPQ`_`]P creating her facial expressions, while another
ZQTY_P]LN_TaP]P_LTWPc[P]TPYNP^ɮ connects to the Zebra printer to produce the all-
important fortune readings.
Chonky Pocket
Dan Norris’s project looks like a video game handheld console, but it’s a
computer that can be operated with one hand. David Crookes takes a look
O
n-screen keyboards work well, but a to incorporate a keyboard, scroll wheel, and
physical set of keys remains preferable, touchscreen, and include a laptop-style battery
certainly if you’re going to be entering a that would report its state of charge to the OS.
lot of text. With this in mind, Dan Norris began to
work on his Chonky Pocket computer. He believed Key points
that, in order to create a device comfortable to At the Chonky Pocket’s heart is a Raspberry
use, jamming in a full-size Qwerty keyboard Pi 4 computer. “I usually use Ubuntu and it’s
wasn’t going to work. R]PL__SL_=L^[MP]]d;TT^ZʯNTLWWd^`[[Z]_POɮ
Dan
MAKER
Instead, he has limited his pocket-sized Dan says. It’s hooked up to a 5-inch HDMI
Norris computer to just ten keys and, as well as being touchscreen with a speaker and, of course, a
Dan is a DevOps able to type straightforward documents with handful of keys. They’re ‘chorded’ which means:
and infrastructure T_T_ɪ^RPL]PO`[^[PNTʭNLWWd_ZLWWZb`^P]^_Z several keys need to be pressed together to enter
engineer in code in Python. What’s more, it’s wrapped in characters, words, phrases, or commands.
Northern California
a beautiful enclosure that makes the Chonky “The keyboard layout is mostly just the eight-
who enjoys hiking
ERHFYMPHMRKWXYǺ resemble a Nintendo Game Boy handheld. It really key ARTSEYIO (artsey.io) chording layout with
is an object to desire. two extra keys mapped to ‘)’ and ‘(‘ and chorded
magpi.cc/
chonkypocket “I wanted a pocket-sized Linux computer ‘:’ – keys that normally require a layer shift
with a physical keyboard and I sort of hacked with the ARTSEYIO layout.” This enables Python
something together last year that wasn’t very coding. “It was a bonus that the extra keys made
nice,” Dan explains. “I decided to have another the keyboard physically symmetrical, so I could
go at it this spring when I got a pre-release change the layout for either hand,” Dan adds.
Amp Ripper 4000 PSU to try out.” His goal was Of course, it’s going to take some getting
used to. “I can type about 20 words per minute
(wpm) with it when I practise a bit, but there
are folks on the ARTSEYIO Discord who can do
more than 40 wpm,” Dan continues. “If I wanted
to type faster with one hand, I’d be inclined
to use half of a Corne split keyboard (CRKBD)
which has more thumb buttons for layer shifting
and more direct access to symbols, numbers,
and CTRL/SHIFT/ALT.”
Powering on
The build posed some challenges. “Modifying the
battery kernel module for this was interesting,”
Dan says. “I haven’t touched any C code since
college and the window manager would crash
when I loaded the module in Raspberry Pi OS.
I’m just lucky that it worked in Ubuntu without
having to do much troubleshooting.”
Power was hard to get right too. “Even using
the wrong connector between a battery and the
This is an early draft build of the project
with a vertical screen and a GPIO keyboard boost/charge board can cause voltage warnings
Quick FACTS
> This is Dan’s
tenth cyberdeck-
VIPEXIHcTVSNIGX
P
otholes are becoming an increasing problem For portable power, the GPS Pothole Tracker uses
the world over – on regular trips, you get L@>-[ZbP]MLYV:`_TY_SPʭPWObSPY_SP`^P]T^
to know the spots on the road to avoid near a pothole, they press the button. If the GPS is
LYObSPYdZ`ʭYOLYPbSLeL]OZ`^SZWPZY locked, the tracker records the button press in the
your highway, you and your suspension certainly FRAM. “The Pico W takes in the input from the
QPPW_SP^ZXP_TXP^OLXLRTYRPʬPN_^So, what GPS, gaming button, and then stores the GPS
if you had a way of recording the exact positions locations, and gives output to the user in the form
ScienceDude1990 ZQ_SP^P_]Z`MWP^ZXPʭ^^`]P^LYOQ]LN_`]P^^Z of the light of the button, and the buzzer,” explains
MAKER
that you could then alert the relevant authorities ScienceDude1990. When the user gets home, they
ScienceDude1990 is _Z ʭc_SPX* NLY_SPYZ[PYL_Pc_ʭWPLYO^PYOLYd[P]_TYPY_
a maker in Canada, pothole information onto whoever needs to have it.
and an electrical
engineer by
Finger on the button ScienceDude1990 says that Raspberry Pi Pico W
training. He enjoys Well, it’s a nuisance that ScienceDude1990 decided was easy to use with MicroPython and Thonny
QEOMRKSǺFIEX to tackle, following one particularly hard and when coding for this device. “The development
projects, and writing pothole-inducing winter in his native Canada. He environment is very lean, fast to learn, and perfect
[IPPGSQQIRXIH
was determined to try and deal with the headache for these kinds of projects.” The most challenging
and clear code.
of his local potholes for the greater good: “I think it
magpi.cc/
potholetracker is my civic duty to help out. Potholes can be
annoying for cars, and very dangerous for cyclists.” Potholes can be annoying
After gathering a few components, a little
breadboarding, coding, and soldering ensued, and for cars, and very
the result of his endeavours is the GPS Pothole
Tracker, the key elements of which are a Raspberry
dangerous for cyclists
To make the project
parts stable but Pi Pico W, an Adafruit LED arcade button, a buzzer,
reusable, he soldered
a u-blox antenna module (for GPS), and a FRAM aspect was learning how to use the ‘os’ commands
rows of headers to
plug the boards into (ferroelectric RAM) breakout for data storage. in MicroPython to work with the FRAM board.
He describes using the FRAM as a “side quest”,
as he was keen to see how he could work with the
FRAM chip and the Pico W, and says he was
“pleasantly surprised” at how easy it was to format,
mount, and use.
Mission accomplished
The good news is that ScienceDude1990 has actually
used his device on his local roads, alerted his
obliging local authorities to the presence of pesky
potholes, and got the job done! “I used it to log the
potholes in the spring, and then submitted them to
my city’s service request system. The potholes were
ʭcPOTYL_TXPWdXLYYP]5Zd ɮ
All that’s needed now is a case of some kind to
protect the various components and make it a little
more aesthetically pleasing, as currently the device
T^aP]dX`NSTYT_^]LbQZ]Xɭ/PʭYT_PWdRZTYR_Z
Quick FACTS
> The total cost of
the make was just
under Can$95
SUBSCRIBE TODAY
FOR JUST £10
Get 3 issues + FREE Pico W
Subscriber Benefits
FREE Delivery
Get it fast and for FREE
Exclusive Offers
Great gifts, offers, and discounts
Great Savings
Save up to 23% compared to stores
+
Subscribe for 6 Months
Free Pico W
6 issues of The MagPi
Free delivery to your door
£30 (UK) $43 (USA)
€43 (EU) £45 (Rest of World)
22 magpi.cc
SUBSCRIPTION
A brand new
RP2040-based
$6
Raspberry Pi Pico W
development board
SUBSCRIBE
on app stores
magpi.cc 23
SUCCESS STORY
Sisyphus
Powered by Raspberry Pi, this mesmerising artwork
is an international hit. By Rosie Hattersley
24 magpi.cc Sisyphus
SUCCESS STORY
THE CHALLENGE
There was plenty of interest in the design from the
art world and science museums, so Bruce founded
Sisyphus Industries and set about designing a
sand table with dual function as furniture and a
playable piece of art. Crowdfunding seemed an
obvious route. The choice of operating software
and hardware to drive it was less so – until Bruce
spoke to those he knew and trusted. “It was clear
that smaller, less expensive control hardware
would be needed.”
THE SOLUTION
Hardware costs, reliability, and community
support for the technology driving the kinetic table
led Bruce to consult his software engineer son,
the embedded software engineer he was working
with, and the younger members of the nearby
makerspace in Minneapolis. The vote for Raspberry
Pi was unanimous.
4_[]ZaPO_ZMPLRZZOʭ_?SP^LYO[WZ__P]
Sisyphus magpi.cc 25
SUCCESS STORY
THE RESULTS
“As a musical instrument plays songs, Sisyphus
plays paths,” the 2016 Kickstarter pitch explained.
The aim: to “get Sisyphus into peoples’ homes
for them to enjoy as both furniture and art, but
also, to inspire a community of composers to write
‘music’ for it.” The Sisyphus Sand Table became
– and remains – the most funded art project in
Kickstarter’s history, Bruce tells us, proudly.
Five years after launching Sisyphus Industries,
the company now has 15 full-time employees at its
Minnesota headquarters, and recently shipped its
ten-thousandth Sisyphus Table, with customers
across the globe and recent installations in Dubai
and Oslo.
mechanism, the Sisbot, needed to connect “Looking back over this time, our experience
to a custom two-motor driver board via USB using thousands of Raspberry Pis, including
serial port. Other output includes control of an 3B, 3B+, 3A+, and now 4, has been relatively
addressable RGBW LED strip. Inputs include seamless,” says Bruce. “Our software developers
_bZ3LWWPʬPN_SZXP^PY^Z]^LYOLYLYLWZR`P SLaPMPPYLMWP_Z]L[TOWdOP[WZdZ`]ʭ]XbL]P
signal from a phototransistor used to detect LN]Z^^OTʬP]PY_;TaP]^TZY^?SPSL]ObL]PSL^
ambient light levels (for auto-dimming the LEDs). proved highly reliable, both in the production
Raspberry Pi could do all of this. Both commercial QLNTWT_dLYOTY_SPʭPWO,YO_SPZ]TRTYLW]PL^ZY
we chose the
Raspberry Pi – its
Our experience using thousands of Raspberry vast community
– has proven to
Pis has been relatively seamless be invaluable in
recent experiments
and large-scale installation versions of Sisyphus using kinetic art within STEM education.
are controlled by Wi-Fi–connected Raspberry Pi
computers running JavaScript on Node.js.
26 magpi.cc Sisyphus
Meet the
WIZnet Pico family
Experience the Power of Connectivity with WIZnet
W61
00-E
VB-P
ICO
WIZn
COM et Et
ING S hern
WIZn OON et HA
et Pi T
co P
oE
● IEEE802.3af compliant
● Mode A(Endspan),
Mode B(Midspan)
● Circuit Protection (OV,OC)
R TYPES OF SERVO
ZMZ_^MPNZXPTYʭYT_PWdNZZWP]bSPY
L]X^LYOWPR^[ZbP]_SPX This feature
has them all, including walking dogs,
humanoid replicants, and grasping robot arms.
These robots all share one thing in common:
servo motors, also known as ‘servos’. This
type of motor rotates back and forth, unlike Servo motors are a type of motor that rotates
the DC motors of wheeled robots that spin back and forth with precision. They are used
endlessly around. in robots that require precise control, such as
robot arms and limbed dogs and walking bots.
This feature will equip The more expensive options include a sensor
of some kind to measure position. Here are
you with a real-world, some types of servo to look out for…
hands-on understanding of
articulatedrobotics SG (Servo Gear)
Dive into an enriching journey of Python Servo gear units like the SG90 and newer SG92 (£4/$4) are
programming and robotics with this feature. We inexpensive and light with precise movement control. The
will explain how servo motors work, how you can SG92R can rotate approximately 180 degrees (90 in each
control them in Raspberry Pi and look at some of HMVIGXMSR=SYƶPPǻRHXLIQMRIRXV]PIZIP
the fantastic robotic kits on the market. robotics projects where cost and
Whether you’re a hobbyist or an aspiring weight is a concern.
robotics expert, this guide will equip you with
a real-world, hands-on understanding of
articulated robotics. So it’s time to gear up, magpi.cc/sg92
assemble your tools, and embark on a thrilling
robotics adventure!
magpi.cc/brushlessservo
ROBOT KITS
MeArm Maker Kit
This is the kit that we are using to explain servo control for the main part of
XLMWJIEXYVI2I&VQ2EOIV fMWEZIV]PS[GSWXVSFSXEVQXLEXGERFI
assembled with just a hex key “and a dash of enthusiasm”. The kit includes
PEWIVGYXEGV]PMGTEVXWERHJSYVWIVZSQSXSVW.XƶWFEWMGFYXXLEXWMQTPMGMX]QEOIW
this a great place to start before moving on to more complex walking robots.
magpi.cc/mearmmaker
Marty v2
2EVX]XLI7SFSX: fMWEGLEVQMRKX[SPIKKIHVSFSXXLEXFVMRKW
GSHMRKXSPMJI)IZIPSTIHF]7SFSXMGEPMXJIEXYVIWPSXWSJEGGSQTER]MRK
educational projects and this friendly robot is controlled using Scratch
or Python. Robotical claims that it is suitable for children aged seven
ERHYTXSYRMZIVWMX]PIZIP2EVX]MWGSRXVSPPIHYWMRKGSPSYVIHGEVHW
ER&RHVSMHSVM5LSRIETTSV7EWTFIVV]5M)IWTMXIMXWGYXII\XIVMSV
2EVX]MWTEGOIH[MXLTSXIRXMEPQEOMRKMXEKVIEXXSSPJSVPIEVRMRKERHJYR
magpi.cc/marty
Petoi Bittle X
;IXIWXIH5IXSM'MXXPI fERHJSYRHMXXSFIEGYXI
TEPQWM^IHVSFSXHSKXLEXMWEKVIEXXSSPJSVTVSQSXMRK8*2
PIEVRMRK&RI['MXXPI<QSHIPMWMRJSVXIWXMRKERHRS[SǺIVW
voice interaction. It is a quad robot with four controllable
PIKWERHMXWTVMGIMWEQSVIEǺSVHEFPIEPXIVREXMZIXSLMKLIRH
robot pets. It comes with the NyBoard 1 controller board and
ten servo motors. It’s a delightful way to own a robot dog and
there are a lot of coding projects to be found here.
magpi.cc/petoibittle
Tony Pi
-M[SRHIVLEWMQTVIWWIHYW[MXLMXW[MHIVERKISJLMKLUYEPMX]
articulated robots. TonyPi (£453/$570) is a humanoid kit powered by
7EWTFIVV]5M','.XƶWRSXGLIETFYXXLIGSRWXVYGXMSRMWWYTIVF
ERHMXJIEXYVIWLMKLZSPXEKIFYWWIVZSW8LMWEHZERGIHVSFSXMW
HIWMKRIHXSTVSZMHIELERHWSRI\TIVMIRGIMR&.ERHVSFSXMGW
8SR]5MƶWGETEFMPMXMIWMRGPYHIMQEKIVIGSKRMXMSRERHXVEGOMRKQEOMRK
it a versatile tool for learning and exploration. Hiwonder provides an app
MRXIVJEGIERH]SYGERHMZIMRXSXLIOMXZME-ERHGSHIMXHMVIGXP]WSMXƶW
good for beginners and experts alike.
magpi.cc/tonypi
SpiderPi
8LI-M[SRHIVTMHIV5M fMWEWYFWXERXMEPVSFSXWXERHMRKRIEVP]GQSǺXLI
ground and spanning nearly 60cm when its legs are fully extended. Constructed with 18
WIVZSWWMQMPEVXSMXW-M[SRHIVWMFPMRKXLI8SR]5MXLITMHIV5MMWGSRXVSPPIHF]E,'7EWTFIVV]
5M8LMWLI\ETSHVSFSXJIEXYVIWER-)GEQIVEXLEXGERVSXEXIXLVSYKLHIKVIIWIREFPMRK
it to detect faces and signal recognition by waving a leg.
SpiderPi performs various movements including scuttling
JSV[EVHFEGOERHWMHI[E]WEW[IPPEWX[MWXMRKERHVEMWMRK
its front legs. Its camera and movement speed can be
adjusted via a sliding bar in the app. The robot can also
JSPPS[ERYRHYPEXMRKPMRISRXLIǼSSVHMWXMRKYMWL
FIX[IIRHMǺIVIRXGSPSYVIHSFNIGXWERHJSPPS[
commands issued via a Python script tied to a QR
code. It scared the bejesus out of our cat.
SUPER
SIMPLE
magpi.cc/spiderpi
ROBOTICS
We’ve got a guide
for newcomers to
robotics in issue
magpi.cc/minipupper
magpi.cc/120
orionrobots.co.uk
YOU’LL
NEED
> MeArm Maker
magpi.cc/
mearmmaker
> Breadboard
A gripper uses a
magpi.cc/
fourth servo motor
breadboardhalf
> Jumper wires
magpi.cc/
jumperwires
> Laptop, tablet,
or smartphone
[MXLc;M+M
> &WQEPPGVSWWLIEH
screwdriver
> Thonny
S
ervo motors allow your Raspberry Pi Pico
to control articulated robots, moving their Degrees of freedom
UZTY_^_Z^[PNTʭN[WLNP^
In this tutorial, you will learn where servo motors When talking about segmented robots,
can be used and how to connect a servo-driven like this arm, we use the term ‘degrees of
robot arm to a Raspberry Pi Pico W. freedom’, or DOF, to count the number of
You will learn how to use the asyncio library places or axes segments can move.
(XLR[TNNL^dYNTZ) to control servo motors
together, making articulated robotics possible.
You will then control this robot arm from a web
page or smartphone.
to do multiple tasks at the same time. network address of your Pico W to the console.
The move_together method in Arm sets up a
The techniques in
this article can be
used to control the
ten servo motors
on the Petoi Bittle X
robot dog
Recording steps
16 At the bottom of the page, there are buttons
to add movement steps. In the HTML, they have
onclick handlers to call into bPMJL]X[d.
When the ‘add step’ button is clicked,
bPMJL]X[d collects the current position of each
servo motor, and stores this set of positions in
the variable step_list. Then, when ‘run steps’ is
clicked, an async task calls move_together with
each set of positions, playing the whole list back.
There are also save/load buttons. These will joints to 0 and press ‘add step’. Setting out markers
for the arm to pick up
^_Z]P_SP^_P[^TYL5>:9ʭWPZY;TNZB^ZdZ`NLY 4QdZ`[`__SPZMUPN_MLNVZY_SPʭ]^_XL]VP] and move objects to
load steps back later. and press the ‘run steps’ button, the robot will
now automatically pick up the object and move
it to the other marker. You can use the ‘save
steps’ and ‘load steps’ buttons to save this
Fun with recorded steps
17 Put the robot on the long side of a sheet
for demonstrations!
DOWNLOAD
mearm.py THE FULL CODE:
> Language: MicroPython magpi.cc/mearmpy
web_arm.py
> Language: MicroPython
State of Play:
Game Engines
for Raspberry Pi
Develop anything from text adventures to 3D
worlds with four sophisticated game engines
Y
ou don’t need a fancy integrated aarch64 hardware like Raspberry Pi 4’s, game
development environment (IDE) or engine support for the platform has expanded
graphical engine to create fantastic ^TRYTʭNLY_Wd^TYNPbPWL^_Pc[WZ]POZ`]Z[_TZY^
K.G.
MAKER
Orphanides computer games, but they really can help. With for game development. We’re going to highlight
mature choices of 64-bit operating system for four of the most exciting game engines you
K.G. is a software Raspberry Pi and enthusiasm among developers can use to make your own games on Raspberry
preservationist and for releasing software to support Linux on Pi today.
developer who’s
written middling
Godot 3.5
text adventures
for fun and done magpi.cc/godot35
despicable things
to 3D engines
JSVTVSǻX 64-bit? Yes has comprehensive documentation with some fantastic
32-bit? Yes tutorials to get you started – just make sure you’re
magpi.cc/owlbear
following the docs (magpi.cc/godotdocsšüŅųƴåųŸĜŅĹƐţĂţ
Godot is a free, open-source game engine for 2D and 3D
games. In fact, it’s one of your few fully functional choices Install it:
for 3D games development on Raspberry Pi, and includes Download the latest release for your Raspberry Pi from
a full IDE in the vein of Unity and Unreal Engine. That said, magpi.cc/godotrpi.
the editor does chug a bit with a reasonably busy 3D ĹDŽĜŞĜƋ±ĹÚųƚĹƋĘåųåĬåƴ±ĹƋƴåųŸĜŅĹţ
scene loaded in, so you might want to stick to 2D, or only
the simplest 3D scenes, if Raspberry Pi is your primary Notable works:
development system. ųŅƋ±ƋŅرŸŸåƋƋå屟ƋŸØųƚåĬƋƼŧƚ±ÚØ{:ĜűŅƻţ
åųåÏŅĵĵåĹÚƋĘåĹŅþÏĜ±Ĭ:ŅÚŅƋüŅų±ŸŞÆåųųƼ{Ĝ
port. On the downside, this means you’re limited to
:ŅÚŅƋƤƐØų±ƋĘåųƋʱĹƋĘåŸĬĜčĘƋĬƼŸĹ±DŽDŽĜåų:ŅÚŅƋĉţĘå
latter can also be built for Raspberry Pi, but there isn’t
currently a consistent deployment path for this, so it’s
ÆåŸƋƋŅŸƋĜÏĩƵĜƋĘƋĘåĹŅþÏĜ±Ĭ:ŅÚŅƋŞŅųƋŅüƐţĂüŅų
ŸƋ±ÆĜĬĜƋƼţŅƋĘ:ŅÚŅƋĉ±ĹÚƋĘ屟ŞÆåųųƼ{ĜŞŅųƋŅü:ŅÚŅƋ
ƐţñĬĬŅƵƼŅƚƋŅƋ±ųčåƋƼŅƚųč±ĵåÆƚĜĬÚŸ±Ƌ±ŸŞÆåųųƼ{Ĝţ
Twine twinery.org
Inform 7 is a mainstay
Inform 7
of the creative
MRXIVEGXMZIǻGXMSR
community and
magpi.cc/inform
has also been used
for commercial
titles such as 64-bit? Yes interpreter. To get started playing Glulx games, open a
Andrew Plotkin’s
Hadean Lands
32-bit? No terminal and type sudo apt install gargoyle-free.
Ren’py renpy.org
64-bit? Yes (run 32-bit version) Raspberry Pi 3 can run most Ren’Py games, allowing
32-bit? Yes you to develop for the platform, but may struggle with
Ren’py’s graphical launcher, depending on your OpenGL
If you’ve played a modern indie visual novel (VN), it was settings. This isn’t required to develop your games,
probably made using Ren’py, a specialist game engine however, as you’ll be spending most of your time using
built on top of Python, with a range of almost-natural- ƼŅƚųŞųåüåųųåÚåÚĜƋŅųţåƚŸåŅÚåƵĜƋĘƋĘååĹű{Ƽ
language functions designed to do the kind of things Language extension installed. You can use Ren’Py to
you’d expect in a visual novel: load a background scene, develop kinetic visual novels – those that involve no
show a character, place some building, and display interaction from the reader beyond moving to the next
narrative text or dialogue. It’s elegant, and the core page – as well as VNs with choice-based gameplay and
functions have been kept simple, aided by a superb branching dialogues, and even those that incorporate
quickstart guide. This makes it a particularly good elements of other genres, such as RPG-style combat or
choice for artists who wish to start developing their the minigames we mentioned above.
own games.
One last thing to bear in mind when looking for Ren’py
But you can extend its normal capabilities and features games and sample code is that it’s hugely popular
with your own Python scripts, invoked directly from for creating adults-only erotic visual novels, and even
within Ren’py. For example, if you want to add health works that don’t feature any sexual content often
and combat mechanics to your VN, you’ll want to turn ƋŅƚÏĘŅĹĵ±ƋƚųåƋĘåĵåŸţeƚƋĘŅųŸ±ųåčåĹåų±ĬĬƼčųå±Ƌ
ƋŅ{ƼƋĘŅĹţFĹü±ÏƋØ{ƼƋĘŅĹĵ±ĩåŸåĹűŞƼŸŅāåƻĜÆĬåƋʱƋ about providing appropriate warnings about sexual and
developers are sharing code for minigames ranging mature content, but it’s worth bearing in mind if you’re
üųŅĵčŅ±ĹÚŸŅĬĜƋ±ĜųåƋŅĀŸĘĜĹč±ĹÚĬŅÏĩŞĜÏĩĜĹčţ looking for examples to share with younger developers.
Build a classic
text adventure
in Inform
Get started in interactive fiction development
I
nform can be used to create very traditional OTʬP]PY_NZY_PY_TYNW`OTYRPc_PY^TZY^^P__TYR^
Top Tip quest-based text adventures, sprawling and
TY_]TNL_PbZ]V^ZQRPY]PʭN_TZYTY_P]LN_TaP
and a map of your previous play-throughs. A play
button just above the right-hand pane allows
theatre, and experimental art games. You can you to play your game. Note the circle arrow
Sentence
add graphics and sound, and a range of extensions next to it: this will replay every command you
structure
(XLR[TNNTY_ʭN) have been released by the typed in your previous play-through, allowing
eĬƋĘŅƚčĘƵåűƴå community to add features and functionality. you to immediately see the impact of changes to
organised As an introduction to Inform 7’s language and your code.
our code in capabilities, we’re going to create a simple escape
successive
room puzzle, with a couple of locations and a
lines for ease
handful of objects. In The Shed of Mystery, the
of reading,
Create a room
Inform will
cheerfully accept
player’s going to have to work out how to escape a
garden shed. You will need a 64-bit installation of
02 We’ll start by creating and describing a
paragraphs. =L^[MP]]d;T:>_Z]`Y_SP4YQZ]X"ʮL_[LV room. Type the following:
The Shed is a room. ‘A cluttered wooden
shed, lined with shelves and smelling faintly
of creosote.’
Your new adventure
01 Open Inform 7 and click ‘Start a new
?SPʭ]^_]ZZX_SL_L[[PL]^TYdZ`][]ZUPN_T^
where your player will start the game by default,
project’. Click Next to create a new story. Select but you can always override this with a line
or create a directory for your project to live in. reading ‘The player is in [the room you wish them
Inform’s ‘skein’ Enter your game’s name and your own, then click to start it]’ at the beginning.
records every Next. Check your project settings, and click Apply. To help with larger games, you can also group
sequence of actions
you’ve played Inform’s main interface opens with an editor Rooms into Regions, and create Scenes, which
through, illustrating
on the left and a documentation pane on the NLYTYNW`OP^N]T[_POLN_TZY^Z]^[PNTʭNTYRLXP
paths through
your game right. Tabs on both let you switch between time periods.
TRUSTED ENVIRONMENT
&<6(&LVDQ(XURSHDQGDWDVHFXULW\FRPSDQ\IRFXVHGRQGDWDSURWHFWLRQLQK\EULGDQGGLVWULEXWHGDUFKLWHFWXUHV
TUTORIAL
U
nderstand a way to expand your electronic uses one port for each row and column and scan
circuits using I2C. Learn about how to across them. An example matrix keypad is shown
Stewart interface with a port expander and see how in Figure 3. A switch matrix can have a problem
MAKER
Watkiss this can be used for a large number of switches with ghosting when multiple buttons are pressed.
`^TYRL^bT_NSL]]Ld?SPʭ]^_NT]N`T_T^ML^PO Sometimes it’s easier to use a port expander which
Also known as around an integrated circuit that you can build on increases the number of GPIO ports.
Penguin Tutor. a breadboard. Then, see how a similar technique
Maker and YouTuber
that loves all things is used for a 16-button, light-up keypad. Use the
Raspberry Pi and keypad to create a fun game of Mole Bop.
Pico. Author of Using I2C
Learn Electronics 02 I2C is an abbreviation for Inter-Integrated
with Raspberry Pi.
Circuit, which is a protocol for communicating
penguintutor.com
Using a port expanders
@stewartwatkiss 01 Raspberry Pi Pico has 26 general-purpose
between microcontrollers and integrated circuits.
It is a bus technology which allows multiple
input/output pins. For many projects that is more devices to be connected using only two wires;
than enough, but sometimes we need more. For a one for the data and the other for a clock to
16-way keypad using a port for each switch and synchronise the devices. Each device has an
one for each LED, we would need 32 ports. address which is used to determine which device to
?SP]PL]POTʬP]PY_bLd^_Z]PO`NP_SPY`XMP] talk to. An example is shown in Figure 2.
of ports needed. To reduce the number of pins for When using I2C, there needs to be pull-up
a keypad, you could use a switch matrix which resistors on the data and clock wires. These can
use the internal pull-up resistors available within
your Pico; if using devices over a greater distance,
external pull-up resistors may be required.
Communicating with
04 the port expander
You can use MicroPython to access all the extra
ports, almost as easily as if they are local pins.
To communicate between a Pico and the port
Pc[LYOP]dZ`ʭ]^_YPPO_ZOZbYWZLO_SPWTM]L]d
from magpi.cc/crankshawnzmp.
After uploading the library to your Pico, you
need to create an instance of I2C and use that that it is used as an input (0 would be used Figure 2 I2C is a bus
protocol allowing
to create an instance of the MCP23008 library. for output). multiple devices to
?SPQZWWZbTYR`^P^[TY^LYO ZYdZ`];TNZLYO be connected using
two GPIO ports on
address 0x20 on the port expander: mcp.setPinDir(0,1) Raspberry Pi Pico
from machine import Pin, I2C You can also enable pull-ups for the buttons
import mcp23008 using setPullupOn.
i2c = I2C(0, scl=Pin(5), sda=Pin(4))
mcp = mcp23008.MCP23008(i2c, 0x20) mcp.setPullupOn(0)
:YNPT_T^NZYʭR`]POdZ`NLY\`P]d_SP^_L_`^
using readPin.
Reading the inputs
05 ?SP[TY^NLYMPNZYʭR`]POL^TY[`_^ mcp.readPin(0)
using the setPinDir command. This takes
_SP [Z]_ Y`XMP]L^_SPʭ]^_L]R`XPY_LYO This gives a 1 when the button is pressed,
the value 1 for the second argument to indicate otherwise a 0.
Creating a game
10 To turn this into a game, a random button
is chosen which is then lit up. The player must try
and press that button before the timer runs out. If
the player presses the button before lit_duration
is passed, then they score a point. If they don’t,
then the button turns red and the player loses
mole-bop.py DOWNLOAD
THE FULL CODE:
> Language: MicroPython magpi.cc/molebop
TCA9555 port
expander
001. import time
002. import random
003. import picokeypad
004.
005. keypad = picokeypad.PicoKeypad()
006. keypad.set_brightness(0.5)
007. NUM_KEYS = keypad.get_num_pads()
008.
009. lit_button = random.randint(0, NUM_KEYS - 1)
010. lit_time = time.ticks_ms()
011. lit_duration = 1000
012.
013. score = 0
014. lives = 3
Figure 4 The TCA9555 port expander is the small square
integrated circuit mounted on the rear of the keypad PCB
015.
016. def all_off():
017. for i in range (0, NUM_KEYS):
a life. After all lives are lost, the grid lights up 018. keypad.illuminate(i, 0,0,0)
R]PPY_Z^SZb_SPʭYLW^NZ]PbT_SPLNSM`__ZY 019.
representing four points. 020. while True:
021. # Check to see if the time has expired
022. now_time = time.ticks_ms()
023. if (time.ticks_diff (now_time, lit_time) > lit_duration):
024. # light it red for missed
Adding a challenge
11 To make the game more challenging,
025.
026.
keypad.illuminate(lit_button, 255, 0, 0)
keypad.update()
each time a point is scored, the time for the next 027. time.sleep (1)
button is reduced by 30 milliseconds. Whenever 028. lives -= 1
a life is lost, it is increased by 500 ms to give a 029. if (lives <=0):
030. break
reasonable chance to score more points. This
031. # make the next one a little easier by adding 400ms
makes it possible to get a reasonable score, with
032. lit_duration += 500
_SPOTʯN`W_dTYN]PL^TYRO`]TYR_SPRLXP 033. # choose new button
Raspberry Pi Pico does not have a real-time 034. lit_button = random.randint(0, NUM_KEYS - 1)
clock, so to work out the time that has elapsed, 035. lit_time = time.ticks_ms()
time.ticks_ms is used. This measures time in 036.
milliseconds. The method ticks_diff is used to test 037. # Turn LEDs off and the lit one on
038. all_off()
whether the lit_duration time has been exceeded.
039. keypad.illuminate(lit_button, 255, 255, 255)
040. keypad.update()
041.
042. # scan keys to see if the lit_button key is pressed
Further development
12
043. button_states = keypad.get_button_states()
The game has some areas for improvement. 044. for i in range (0, NUM_KEYS):
045. if i == lit_button and button_states & 0x01 > 0:
Firstly, it will only run once and then you need
046. score += 1
to restart it from Thonny. Another while loop can 047. lit_duration -= 30
be added to keep the game running, along with 048. lit_button = random.randint(0, NUM_KEYS - 1)
resetting the score and other variables. 049. lit_time = time.ticks_ms()
Whilst it is possible to get a range of scores, 050. button_states = button_states >> 1
many players will score around the same amount. 051.
052. print ("Score {}".format(score))
This is due to the way that the complexity
053. all_off()
increases linearly. An alternative is to increase the
054. if (score > 64):
OTʯN`W_d`^TYRWPaPW^TY^_PLO 055. score = 64
Another improvement would be to have multiple 056. for i in range (0, score / 4):
buttons light at the same time. See version two in 057. keypad.illuminate(i, 0, 255, 0)
the GitHub repository for an improved version of 058. keypad.update()
the game.
Camera Module:
Part 03
/QTGQPXKFGQ
ECRVWTG
Discover in-depth settings for capturing video
with Raspberry Pi Camera Module
David
MAKER
Plowman
W
e met libcamera-vid at the end of the --framerate parameter:
David is an engineer last month’s Camera Module tutorial
at Raspberry Pi with (magpi.cc/130), and found out how libcamera-vid --width 1280 --height 720
a special interest
to record a short video clip. Like libcamera- --framerate 50 -o 50fps.h264
in camera software
and algorithms, and still, libcamera-vid has many more options for
image processing controlling the resolution, frame rate, and other This will record a 720p video at 50 fps, so long as
hardware. aspects of the video that we capture, and we’ll the camera can deliver the frames that quickly
raspberrypi.com discover some of those in this tutorial. (otherwise you will get the maximum frame rate
that the camera can supply).
%JCPIKPIVJGXKFGQ
TGUQNWVKQPCPFHTCOGTCVG Video encoders
By default, libcamera-vid will capture videos CPFƓNGHQTOCVU
at a resolution of 640×480 pixels. But it’s easy Videos, just like still images, are normally
to change this with the --width and --height compressed before saving them to disk. In fact,
parameters (just like libcamera-still). For example, it’s even more important to compress video
if you want to capture a video that is 1920×1080 frames because, with hundreds or thousands of
[TcPW^VYZbYL^ɩQ`WW3/ɪTY^_PLO[WPL^P`^P% Q]LXP^_SPZ`_[`_ʭWPbTWWPc[WZOPTY^TeP
After compression, the video frames are written
libcamera-vid --width 1920 --height 1080 -o _ZLʭWPbT_SL^[PNTʭNɩNZY_LTYP]QZ]XL_ɪ
full_hd.h264 There’s a choice as to how to organise video
Q]LXP^TYLʭWPYZ_WPL^_MPNL`^P_SP]PNLYMP
You’ll Need This particular resolution of 1920×1080 pixels Z_SP]OL_Lɧ^`NSL^L`OTZɧTY_SPʭWP_ZZLYO
should be regarded as the largest resolution that _SPNZY_LTYP]QZ]XL_OPʭYP^PcLN_WdSZb[WLdMLNV
> Raspberry Pi can be captured in video, unless noted otherwise software can access and decode the information.
> Camera Module in the text below.
magpi.cc/ Because we’re talking about videos now, we H.264 Files
cameramodule NLYLW^ZL^VQZ]OTʬP]PY_Q]LXP]L_P^-dOPQL`W_ The default encoder used by libcamera-vid
> Raspberry Pi OS libcamera-vid will deliver 30 frames per second is the H.264 video encoder. There is special
Q[^BPNLYL^VQZ]LOTʬP]PY_Q]LXP]L_P`^TYR hardware to support this so it combines both
7EWTFIVV]5M4RS[WYTTSVXW
PMFGEQIVE[LMGLGETXYVIWZMHISYWMRK
XLI-ZMHISIRGSHIVF]HIJEYPX
:MHISǻPIWEVIGETXYVIH
EXEVIWSPYXMSRSJ
¡TM\IPW
good performance and good compression. Once libcamera-vid -b 9000000 --width 1920
compressed, the frames are written back to back --height 1080 -o good.h264
OT]PN_Wd_ZLʭWPbSTNSbPYZ]XLWWdOP^N]TMPL^
LYɩ3!ɪʭWPLYOMdNZYaPY_TZYZQ_PYOPYZ_PT_ The 1,000,000 bits per second (1 megabit per
bT_S_SPʭWPPc_PY^TZYɩS!ɪ ^PNZYOZ]8M^aTOPZɩMLOS!ɪZ[_TZY
4_ɪ^bZ]_SYZ_TYR_SL__SP^P3!ʭWP^L]PaP]d shows far more objectionable compression
simple; they’re not really true container formats. L]_PQLN_^_SLY_SP$8M^ɩRZZOɪaTOPZ
That is, you couldn’t mix audio data in with the
video, and the video frames do not even have
timing information associated with them. Support
QZ][WLdTYRMLNV^`NSʭWP^NLYMPWTXT_POLYO
There’s nothing to stop you from
even where it is supported, the software will have compressing one still image after
to guess a framerate for the video.
Popular media player software VLC used to another (very quickly)
^`[[Z]__SP3!ʭWPQZ]XL_M`_XZ]P]PNPY_Wd
no longer plays them correctly. For this reason,
we recommend other programs, such as FFplay. MJPEG files
We’ve already seen how to record a video with We’ve previously encountered the JPEG image
LOTʬP]PY_]P^ZW`_TZY&LYZ_SP]`^PQ`WZ[_TZYT^ encoder for compressing still images. There’s
the bitrate parameter (--bitrate or just -b). This nothing to stop you from compressing one still
NZY_]ZW^_SP^TePZQ_SPaTOPZʭWPN]PL_POLYO image after another (very quickly) and saving
therefore the amount of compression and the _SPXMLNV_ZMLNV_ZN]PL_PLaTOPZʭWP?SL_ɪ^
perceived quality. Compare the following: PcLN_WdbSL_LY85;02ʭWPT^
There are some drawbacks, however. The
libcamera-vid -b 1000000 --width 1920 85;02ʭWPQZ]XL_R]Pb`[Z]RLYTNLWWdLYO^Z
--height 1080 -o bad.h264 lacks some clear decisions on exactly how to
format the JPEGs within them. Often they work
…versus: well, but support can be a bit patchy.
Top Tip
• --split Every time a recording is resumed, the
]PNZ]OTYR^_L]_^b]T_TYRLYPbZ`_[`_ʭWP
1VJGTTGEQTFKPIQRVKQPU
libcamera-vid has many other parameters
Save space • --inline Tells libcamera-vid to insert certain LYObPɪWWWZZVaP]dM]TPʮd_S]Z`RSLQPbZQ
extra header information at the start of every them here.
After recording ʭWP_SL_T_b]T_P^DZ`^SZ`WOYZ]XLWWdTYNW`OP
ĀĹĜŸĘåŸØƋĘå this when using the --split option. Circular buffer output
ÏŅĵŞų域åÚĀĬåĜŸ
One useful feature is the ability to keep writing
Ÿ±ƴåÚƋŅÚĜŸĩţŸå
• -o or --output?SPYLXPZQ_SPZ`_[`_ʭWPZ] _SP]PNZ]OPOaTOPZ^_]PLX_ZLM`ʬP]TY=L^[MP]]d
ƋĘåĜųÏƚĬ±ųƚýåų
ŅŞƋĜŅĹƋŅŸ±ƴå± ʭWP^BSPYbPɪ]P`^TYR_SP--split option, we’ll ;Tɪ^XPXZ]d?ST^T^LWTXT_PO^TePLYObSPYT_
ŸŞåÏĜĀÏĹƚĵÆåų ZQ_PYbLY_PLNSZ`_[`_ʭWP_ZSLaPLOTʬP]PY_ ʭWW^`[_SPPL]WTP^_OL_LTY_SPM`ʬP]T^PaTN_PO_Z
ŅüŸåÏŅĹÚŸ YLXP^ZbPNLY`^P_SP^LXPɩNZ`Y_P]^dY_Lcɪ make space for the new frames. When libcamera-
üųŅĵƋĘååĹÚŅü that we saw with libcamera-still’s timelapse aTOPcT_^_ST^NT]N`WL]XPXZ]dM`ʬP]T^ʮ`^SPO
ƋĘåϱŞƋƚųåţ
option. For example, -o test_%03d.h264 to the disk. This enables you to leave the camera
bTWW b]T_P_SPZ`_[`_ʭWP^test_000.h264, ]`YYTYRTYOPʭYT_PWdM`__Z^LaPZYWd_SPWL^_
test_001.h264, test_002.h264 and so on. several seconds of data when some event occurs
that causes the program to be stopped.
Let’s try an example: Let’s see an example:
from the start of the video are stored in text form 4_ɪ^LW^Z[Z^^TMWP_Z_`]YZʬL`_ZQZN`^LYO^P_ When using
Camera Module 3,
in units of milliseconds. For example: the focus position of the lens manually. To do autofocus is enabled
automatically in
this, use the --lens-position parameter, and continuous mode
libcamera-vid --save-pts timestamps.txt -o [L^^ T_LaLW`PXPL^`]POTYɩOTZ[_]P^ɪXPLYTYR
circular.h264 the reciprocal of the focus distance. Thus, to
focus at a very close distance of about 0.1 m,
?SPʭWPtimestamps.txt will (for a 30 frames per pass in the value 10 (which is 1 / 0.1). To focus
second recording) start like this: L_ TYʭYT_d[L^^TYTYQZ]XLWWd_SPaLW`PZQ
TYʭYT_dDZ`NLY[L^^TYYZYTY_PRP]aLW`P^
# timecode format v2 too. For example:
0.000
33.332 libcamera-vid --lens-position 0.5 -o 2_
66.664 metres.h264
99.996
…will set the focus position to two metres and
…and so on. not move the lens again.
S
cooters are fun, and can be a good hums into life, and the wheels of the scooter begin
alternative to cars and bikes when to turn. When the user wants to stop, they release
considering the daily commute. the throttle and apply a brake or use their foot to
They can even be useful while at work slow down.
if your job involves moving between A manual scooter works in a similar way, but
campus buildings several times a day, with more leg action and less throttle – surely we
Dr Andrew Lewis or travelling back and forth in large warehouses or just need to add a motor, some batteries, and a
hangars. Electric scooters are even more fun, but speed controller, and that’s everything, right? Well,
Dr Andrew Lewis is a they are also expensive. In this project, you’ll see it isn’t quite that simple. Firstly, manual scooters
specialist fabricator
and maker, and is the
how to take an ordinary manual scooter and make it come with very primitive brakes (if they have brakes
owner of the Andrew electric without resorting to expensive hub motors or at all). The wheels on the scooter are typically
Lewis°>orkshop conversion kits. This is a two-part project. In the first not designed to be driven, and just have a simple
part, we'll take a look at the components we'll use bearing and possibly a fork with a suspension
and how we'll need to modify our scooter to make it spring. Making a manual scooter move under
all work. In the second part of the project, you’ll see motor power means making some very permanent
how to power your motor from custom batteries. changes to the chassis of the scooter, mounting
The anatomy and function of an electric scooter the motor near to the rear wheel, enlarging the
isn’t mysterious or difficult to understand. The user rear fork to accommodate better brakes and a drive
stands on a platform, activates a throttle, a motor sprocket on the rear wheel, and modifying the
”
is the same as a motor vehicle, and as such you would these risks could impact
be expected to license and maintain it in exactly not just you, but the
Once you have a solid the same way as a car or motorbike. Unfortunately, people around you.
scooters don’t have some of the important features
wheel, you can build your needed to pass an MOT (Ministry of Transport) test
(like headlights, indicators, registration plates, etc.)
rear fork to match
”
– and so they will not be legal to ride on the road,
its width and you can’t get insurance to drive them. However,
they are still technically classed as motor vehicles,
so you aren’t allowed to ride them on the pavement QUICK TIP
either. If you do ride on the pavement or on the road, Cycle chains can be
plenty of resin to fill the space between the two you could be fined several hundred pounds and risk joined with a split
sides will make sure that the bolts have plenty losing your driving licence. You can ride them on link, so you don’t
of solid wheel material to make contact with private land – such as corporate campuses – with the have to buy a chain
landowner's permission. At the time this article was exactly the right
when the forces from the motor and brakes are
written, the government is developing new standards size. Simply remove
transferred through them. and adjustments that will eventually make electronic excess links, join the
Once you have a solid wheel, you can build your scooters road-legal in the UK. How long that process chain with the split
rear fork to match its width. If you have access to a will take depends on how quickly the government link, then tension
welder, you can do this very quickly by cutting the decides to move. the chain by moving
original rear fork into pieces and re-welding it with the motor.
Left
Most scooters don’t
really bother with
an effective brake,
because they don’t
go very fast and you
can stop them with
your foot. If you’re on
a motorised scooter,
you’ll need a more
powerful rear brake
to arrest your more
considerable forward
momentum. A disc
brake from a bicycle
will do the job. Just
remember that the
brake will only stop
the scooter, not you
Right
Using a motor with a
sprocket and chain is
much cheaper than
using a hub motor and
allows you to increase
the torque from the
motor mechanically
MOTOR CONTROLLER
”
Most BTS7960 motor controllers are H-bridge
controllers that have a similar pinout. The boards have
two power inputs, one of which (often labelled as pins You will probably find that
B+ and B-) supplies power for the motor. Next to this
you won’t want to run your
input are the connections (M+ and M-) that directly
motor at 100% speed under
”
attach to the motor.
This tutorial is from The other power input is used to supply the logic side
HackSpace magazine. of the board, and is labelled as Vcc and GND. This logic any circumstances
Each issue includes a level power input runs at 3.3 V or 5 V and is isolated from
huge variety of maker the motor power connection for safety. With a Raspberry
projects inside and Pi Pico, you should be powering this with 3.3 V. The a larger gap. If you don’t have a welder, you can
outside of the sphere remaining connections on the board are used to control achieve similar results using threaded bar and
of Raspberry Pi, and the speed and direction of the motor, and optionally locking nuts with a spacer between each side
also has amazing monitor the current used by the motor. We won’t be
tutorials. Find out of the fork.
using the current-sensing features, so the pins labelled
more at hsmag.cc. For something like a light scooter, a 20 amp,
R_IS and L_IS can be ignored. The L_EN and R_EN pins
enable the motor to turn clockwise or anticlockwise 24 volt motor in combination with the gear reduction
when they are high, or disable the motor when low. from the sprocket drive should have plenty of power
Obviously, only one of these should be enabled at a time. to move an adult at terrifying speeds. By controlling
The LPWM and RPWM pins accept a PWM signal from the power to the motor using PWM signals from
QUICK TIP the Pico, or a solid logic high to power the motor at 100% a Raspberry Pi Pico, you can provide very smooth
power. Since a scooter generally doesn’t need a reverse
In MicroPython, the speed control without losing as much torque as
gear, you only need to connect either the left or right
Pi Pico PWM output you would if you simply reduced the overall supply
enable and PWM pins to the Pico, depending on which
ranges between 0 voltage. You will probably find that you won’t
way around your motor is connected. Assuming that
and 65025, so setting
you have a right-hand motor setup, you would make the want to run your motor at 100% speed under any
a PWM pin with
motor move by setting the R_EN pin HIGH and providing circumstances, and will throttle the maximum
pwm.duty_u16(32512)
a PWM signal to RPWM. PWM value to something less than bowel-voidingly
would give you about
50% power. high speeds.
ANALOGUE IN
Setting the motor speed is only half of the process;
you also need to get a value from the user by reading
a throttle control. It’s tempting to think about creating
a simple throttle control using a potentiometer, but that
would be a bad idea. If you’ve ever used an old radio,
you’ll know that the potentiometer used in the volume
control gets worn out, and the volume of the radio
will suddenly change or crackle at full volume for a
fraction of a second. This is annoying in a radio, but if it
happens on a motor controller and the motor suddenly
speeds up to 100% without warning, the result could
be catastrophic. To avoid this problem, most electronic
throttle controls use a Hall probe and a magnet to
ensure smooth speed changes. The Hall probe and
magnet aren’t in physical contact and there are no
tracks to get worn, dirty, or broken. The probe normally
has two power pins and a signal pin, which outputs an
Above
analogue value to reflect the strength of the magnetic You will need to mount your motor so that the motor’s sprocket matches up with the sprocket
field it detects. As the magnet moves closer, the field on the wheel. The easiest way to do this is to Ä_ a mount for the motor on the rear of the fork
with slotted holes, and use the adjustment that the slots provide to position the motor correctly.
gets stronger. Checking the position of the throttle You can also use this technique to tension the chain between the motor and the wheel
controller is as simple as connecting up and polling the
analogue pin of a microcontroller, just as you would
with a potentiometer.
Left
You can see here
how much wider the
wheel becomes once
you allow for the
sprocket and brake
disc. Widening that
rear fork might seem
a bit daunting, but
it’s actually pretty
easy to do. Getting
rid of the in-built
suspension makes
things much easier
if you’re struggling,
and it won’t actually
make that much
difference to the feel
of the scooter
Above
To control a large motor, you will need to use a
powerful motor controller like the BTS7960, which
is often found on motor control modules that can
handle around 43 amps, when appropriately cooled
Interactive
stream lights
Have your viewers change your lighting during streams with this
Raspberry Pi Pico-powered setup for major streaming services
Rob Zwetsloot
I
nteractive lights are hardly a new thing for as well as providing a ground for the circuit. Data
MAKER
streamers. If you have certain smart lights, is sent via a single pin which tells each LED how
Rob knows a you can connect them to Lumia Stream to act.
hedgehog that (lumiastream.com) and go from there. Of course, For larger lengths of NeoPixels, a 220 Ohm
streams model
kit building, that’s not as fun as making it yourself, and with a resistor between the 5 V pin and the NeoPixel
which needs Raspberry Pi Pico W and some NeoPixels, you can strip is best practice to stop any of the LEDs
decent lighting get one set up pretty quickly. from overheating.
for viewers to see
We’ve borrowed some code and ideas from Make sure your Pico is in range of a micro USB
what Gundams are
being made. Sean O’Steen’s excellent Raspberry Pi Pico Beret cable plugged into a PC so you can program it too.
(magpi.cc/picoberet) which has a web server and
magpi.cc
LYTXL_TZYNZY_]ZWWP]]`YYTYRZYOTʬP]PY_NZ]P^
on Pico. Now, let there be light.
Getting the code
03 We’ve uploaded the code for this to
Z`]2T_3`MLYOdZ`NLYʭYOT_L_%magpi.cc/
Ready your LEDs
01 For this use case, we just need to
streamlights. It comes in two parts – stream_
lights.py and secrets.py. You’ll need to modify
illuminate the area of a cutting mat – a relatively MZ_SQZ]dZ`]^[PNTʭN^P_`[&secrets.py just need
very small area compared to a room. As well as to have your wireless network info added, while
SPW[TYRbT_SaTOPZ\`LWT_d_SPMPYPʭ_ZQ_SP^P stream_lights.py code will need to be updated
lights is that it will also help the streamer see with your number of LEDs on line 15, NUM_LEDs.
what they’re doing. You don’t want to blind
yourselves with the LEDs!
We have a small strip of eight NeoPixels that
You’ll Need Code explained
bPɪaPN`_ZʬL]PPWbSTNSbTWW[]ZaTOP[WPY_dZQ
light to the desk when positioned in the correct
04 The reason a Pico W is needed for this
> Raspberry Pi
Pico W spot (see Step 7). project is that we’re making use of its web server
magpi.cc/picow capabilities. The idea is that once booted, Pico W
will run the code and set up the web server that
> NeoPixel LEDs
magpi.cc/ can be accessed via your local network. Sending
Wire it up
neopixels
> Stream bot, such as
02 Refer to Figure 1’s Fritzing diagram on how
web requests in the form of URLs is captured by
_SP^P]aP]LYObSPYL^[PNTʭN]P\`P^_T^[]ZNP^^PO
Mix It Up to wire up the NeoPixel strip to Raspberry Pi Pico T_bTWWLN_TaL_PLOTʬP]PY_WTRS_^P\`PYNP
mixitupapp.com W. It’s fairly simply though – Pico can provide Both parts of this code run on their own threads
power straight to the NeoPixel using the 5 V pin, so they’re able to work independently of each
Attach NeoPixels to
wherever makes sense
for your streaming set up
other – RP2040 has two cores making this much to Pico as well. Restart Pico and it will give you
easier to do. the IP address in Thonny you’ll need to send
The light sequences are done in a traditional web requests.
NeoPixel manner of setting the LEDs with simple
RGB values.
Test it out
06 Testing at every step is very important. So,
Set up Pico
05 Get Thonny on your PC, or boot up your
before we go any further, turn your Pico on and
wait for the lights to turn on. Once that’s done,
nearest Raspberry Pi. Hold down the BOOTSEL open a browser on your computer on the same
button, and connect Pico to your computer via local network, and enter the IP address from the
[]PaTZ`^^_P[LWZYRbT_S_SP@=7QZ]L^[PNTʭN
Action groups
09 Creating a command on Mix It Up can be
done directly on the trigger (such as a new Twitch
subscriber) or you can create a universal command
_ZMPNLWWPOQZ]LYd_]TRRP]0T_SP]bLd_SPʮZb
of the command is the same, and it’s quite simple
here.
Go to the menu in the top-left and select
Action Groups. Click ‘New Action Group’ to open
the command editor. From the Action list on
the bottom of the window, select Web Request
and press the add button. Enter the URL for the
^[PNTʭNWTRS_LYTXL_TZYdZ`bLY__Z`^PPR
$!#[`][WPLYO_SPYNWTNV^LaP1]ZX
here you can test the command using the play
button when Pico is running. We suggest toggling
Figure 1: Pin 40 (top- recommend getting some frosted acrylic to cover the Unlock Command option as well, which will
right) is the 5 v pin,
while every square the LEDs so that the light on the desk area isn’t allow other commands to run if an issue occurs
pin on Pico is ground too sharp. with this one.
Make sure a power supply can reach your Pico
as well.
Twitch redeems
11 4QdZ`ɪ]PL?bT_NSLʯWTL_PZ][L]_YP]
your viewers can collect channel points simply by
watching your streams. These points can then be
spent on redeems and are popularly used to play
a sound or get the streamer to drink some water
DOWNLOAD
THE FULL CODE:
magpi.cc/streamlights
Remember to use
Happy streaming the IP address of your
or stretch. Mix It Up is able to read the list of
redeems and use them as triggers.
12 Make sure to thoroughly test the actions
Pico W for the
web requests
Go to the Twitch Dashboard, Viewer Rewards, before hitting live, and make sure to let your
and then Rewards and create a custom reward. chat know about the new functionality of your
Give it a name, a channel point cost, and ^_]PLX BSP_SP]T_ɪ^^SZbTYRZʬL2`YOLXZ]
consider giving it a cool-down so it can’t be used your wonderful visage, you may need to tweak
continuously too. Once it’s set up go to Twitch the code to get everything looking just right.
Channel Points in Mix It Up, Add Command to =2-NZOP^QZ]OTʬP]PY_NZWZ`]^NLYMP\`TNVWd
Existing Reward, and add the action group, like in Google’d and Pico’s code can be updated on the Create a Custom Reward on
step 10. ʮd_ZZ2731 your Twitch Dashboard
R
aspberry Pi Camera Modules are
wonderful things, and we’ve used
them for countless projects in the
pages of The MagPi over the years. You’re
coding them directly, so they’re incredibly
customisable, even being able to talk to the
web or the multitude of sensors available for
Raspberry Pi.
With all this power and a little bit of
bPL_SP][]ZZʭYRT_ɪ^TYN]POTMWdPL^d_Z`^PL
=L^[MP]]d;T_Z_LVPLWZZVZ`_^TOPLYOʭYO
out about the natural world around you. Here
are some projects to get you started…
Urchin’s Ga
llery The finest ph
otos of the fi
nest wildlife
taken by the
finest microc
omputer
R
ob unabashedly loves hedgehogs
thanks to a blue one with attitude,
and as it’s his feature, he’s decided
to have a page dedicated to these ancient, Photo by
spiky, and cute garden dwellers. The Jolly Geographer
and Wildlife Trust BCN
Photo by
Keith Freeman
(@BiscuitKeith)
Photo trap
projects
Build your o
wn, cheap n
ature camer
By Rob Zwet a
sloot
a p
e r r y P i C a m er a T r
a sp b
Sim p le R implecamtrap
magpi. cc/s
H
oused in a Tupperware box as
bPL_SP][]ZZʭYR_ST^[]ZUPN_XLVP^
use of an infrared camera with IR
LEDs to light up the night. Not only that, but
it teaches you how to set up MotionEyeOS to
sense movement and take photos and/or video
in the process – something you’ll be able to
N`^_ZXT^P_ZdZ`]ZbY^[PNTʭNL_TZY^TQdZ`
plan to tweak the build.
7TVP8d9L_`]PbL_NST_XLVP^`^PZQLY
LT]_TRS_QZZONZY_LTYP]LW_SZ`RSbPɪ]PYZ_
^Z^`]PLMZ`_SZbbPL_SP][]ZZQ_SPNLXP]L
Hot glue is
T^TY_SL_NZYʭR`]L_TZY4QdZ`SLaPLY4= actually an
NLXP]LM`_YZ_ZYPbT_S4=70/^dZ`NLY OK insulator
against the
LN_`LWWdRP_4=70/^L^TYOTaTO`LWNZX[ZYPY_^ weather
Q]ZXXZ^_ZYWTYPPWPN_]ZYTN^^_Z]P^ .XƶW HMǽGYPX XS
see because of
XLI GEQSYǼEKI
BIRDBOX
A project from the Raspberry Pi Foundation
(magpi.cc/birdbox), this camera trap
ƚŸåŸŸŅĵåÏŅĹÏåŞƋŸƼŅƚϱĹĀĹÚĜĹƋĘå
other projects here, but this one involves
constructing a birdbox too – a classic
beginner’s woodworking project.
Be careful to make sure any project like
this will not disturb the birds if they nest in
the box, though.
My Na t
u
mynatur r ewa tch
I
t seems the popular way to make your
own wildlife camera is to house your ewatch.n
et
electronics in a watertight piece of
Tupperware and, apparently, use a large
plastic soda bottle as a sort of weather
shield for the lens of your camera. At least,
this is how the My Naturewatch team like to
build their cameras.
You can browse
?SPXLTY[L]_ZQ_SP[]ZNP^^T^M`TWOTYR the camera
with a phone or
the enclosure, as My Naturewatch has a
other device
[]PM`TW_>/NL]OTXLRP_SL_dZ`NLYWZLO
The solution is
ZY_Z=L^[MP]]d;TbSTNSbTWWLW^ZWP_dZ` very DIY, but
connect a phone, or other Wi-Fi enabled it works!
ic PiCa m
F
ancy taking photos under the water?
An ta r ct /130 ?SP,Y_L]N_TN;T.LX[]ZUPN_ bP
c
magpi.c QPL_`]POTYT^^`Pmagpi.cc/130)
was created by a school student and
XLVP^`^PZQLaP]d^TX[WP[W`XMTYR^PLW
_TRS_PYPOMdLY`__ZN]PL_PLbL_P][]ZZQ
enclosure. With a clear acrylic plate on one
The hardware end, the camera can point outward and
is attached to
a wooden sled _LVPQZZ_LRP>ZQ_bL]PbT^PT_ɪ^LWT__WP
that slips into the
PVC piping
XZ]PN]`OPTYT_^Z]TRTYLWNZYʭR`]L_TZY
M`_Md`^TYR^ZXPZQ_SP_PNSYT\`P^TY8d
It was used in 9L_`]PbL_NS_SP>TX[WP.LXP]L?]L[^SZ`WO
Antarctic waters
to study ice algae allow you to make something a bit more
`^PQ`WQZ]YL_`]P[SZ_ZR]L[Sd
Alert!
Power Tools
Be mindful of problems
caused by power tools.
Full kit
Be careful of vibration,
noise hazards and wear
protective clothing and
goggles.
magpi.cc/powertools
Cut to the
chase
with Natu
rebytes
T
he Wildlife Cam from Naturebytes
is a Raspberry Pi A+-based device
that comes with a fantastic case
that holds Raspberry Pi, a Raspberry Pi
Camera Module, an IR lens to optimise
motion detection, and even an IP55
weatherproof rating. This means it can
[]Z_PN_LRLTY^_\`LY_T_TP^ZQO`^__SL_bZ`WO
LʬPN_Z[P]L_TZY^LYOLW^ZQ]ZXLbL_P]UP_
LW_SZ`RSSZ[PQ`WWddZ`bZ`WOYɪ_MP[ZTY_TYR
your pressure washer at it anyway.
DZ`bTWWYPPO_ZL^^PXMWPT_dZ`]^PWQ
3ZbPaP]T_U`^_]P\`T]P^^N]PbO]TaP]^LYO
the instructions are very comprehensive
bT_S[WPY_dZQ[SZ_Z^ɧLYO_SP]PL]P^ZXP
aTOPZR`TOP^_ZZ4YLOOT_TZYdZ`NLY^bT_NS
Z`_=L^[MP]]d;T,QZ]LEP]ZZ]8ZOPW-
QZ]XQLN_Z]L^bPWWL^Z_SP]VTYO^ZQNLXP]L
XZO`WP^TQdZ`]PLWWdbLY__Z`[R]LOP_SP
\`LWT_dZQ_SP[SZ_Z^
DZ`NLYLW^ZU`^_RP__SPNL^PZYT_^ZbY
QZ]SLWQ_SP[]TNPTQdZ`bLY__ZN`^_ZXT^PT_
Q`]_SP]?SPVT_SL^MPPYL]Z`YOQZ]XLYd
dPL]^YZbLYOT^L^_L[WP=L^[MP]]d;TVT_
The hardware is attached to a wooden
sled that slips into the PVC piping
u td oo r
Other o
photog ra ph y
u see from yo ur garden?
W hat else can yo
J ULY IN
NATURE
U
^TYR^TX[WPbPL_SP][]ZZʭYR^`NS
as a plant pot and a dome, this
In the UK, July is the
simple build can help you track
ĀųŸƋüƚĬĬĵŅĹƋĘŅü
meteors in the sky using motion-sensing summer, so you’ll
code. 4_`^P^L#OPR]PPʭ^SPdPWPY^_Z see more creatures
NL[_`]PXZ]PZQ_SP^VdLYO_SP]P^`W_TYR and critters about.
[SZ_Z^SLaPTYNW`OPOXP_PZ]^ʮL^STYR Star trails are a
This includes bats,
across the sky and time-lapse star trails. great style of the common lizard,
astrophotography osprey chicks, stoats,
to try out
and many kinds of
ÆƚƋƋåųāƼţĘåÏĩŅƚƋ
discoverwildlife.com
for more info on the
Pla n t g rowth kind of things you
tim
magpi.cc/plantt el ap se can encounter in your
imelapse garden – and beyond!
- during the year.
(VIHMX &RH] 2SVǺI[
N
ot only does this project your water
plants when they’re needed, it
also keeps a time-lapse recording
of their growth. ?ST^^[PNTʭNaP]^TZYT^
The build does
used in a greenhouse but, with some expert require a car
XZOTʭNL_TZY^LYObPL_SP][]ZZʭYRT_NZ`WO battery, though
MP`^POTYLRL]OPYZ]PaPYQZ]TYOZZ][WLY_^
4_ɪ^LN_`LWWd\`T_PL^TX[WP^P_`[M`__SP
_TXPWL[^PMT_T^Pc_]LQ`Y
PuppyPi
HiWonder hiwonder.com £445 / $559
T
here’s no denying that PuppyPi is an eye- operating system), a motor control board, and
SPECS catching robot. Inside its black aluminium 7.4 V 2200 mAh LiPo battery. It’s a lot smaller
alloy frame this quadruped features eight than SpiderPi; it’s cuter too, even with the black
DIMENSIONS: high-quality HPS-0618SG coreless servo motors metal styling and single-eye camera. Inside the
226 × 149 ×
190 mm (length with metal joints, and a six-axis IMU sensor chip box are some coloured balls, tags, and an 8.4 V
× width × height), MPU6050 for robot posture detection. charger. We also got the PS2-style controller for
720 g, aluminium PuppyPi (magpi.cc/puppypi) is assembled by testing, and an Advanced kit comes with extra
alloy body HiWonder, who created the larger SpiderPi robot sensors and attachments. A pro model comes
COMPONENTS: (magpi.cc/119) and TonyPi (magpi.cc/111), all with Lidar.
Raspberry Pi strong contenders in the robotics space. Our test model worked fresh out of the box.
4 4GB, eight At the front of PuppyPi sits a 480 p camera and Power it up using the switch on the side, and
HPS-0618SG inside is a Raspberry Pi 4 running ROS (robot it instantly stands up and transmits a Wi-Fi
coreless servos,
Raspberry Pi
expansion board,
480P/8DOF
camera
CONTROL
METHODS:
iOS/Android
apps, PC
application,
Python API,
PuppyPi V1
software,
Lab tool, PS2
controller
72 magpi.cc PuppyPi
REVIEW
9
_bZ[]ZR]LXXLMWPM`__ZY^0c_PY^TZY^ZʬP]PO Raspberry Pi robotics, but Boston Dynamic’s
by HiWonder include a Lidar module, ultrasonic Spot robot comes in at roughly £200,000, so
/10
sensor, MP3 module, display, and touch sensor. it’s relative. We think this would be an excellent
The software running on PuppyPi is Raspberry addition to any robotics course or classroom.
Pi OS with custom
applications and ROS
(robot operating system)
support. Connecting to
Raspberry Pi via VNC
reveals a PuppyPi desktop
application that is used
to visually program
and chain together
commands. You can dig
deeper with a Python API,
and it supports Gazebo
simulation (gazebosim.
org), enabling you to
simulate movement
in advance.
Deep training
Once you’ve connected
PuppyPi to your network, The Raspberry Pi OS PuppyPi V1.0 app used to chain together commands
it’s possible to move
PuppyPi magpi.cc 73
REVIEW
u-maker Box
Weidmüller magpi.cc/umaker £21 / $27
SPECS
DIMENSIONS: Not sure what kind of case to get? Try out the case
120.4 mm ×
120.4 mm ×
35.5 mm
that can be just about anything. By Rob Zwetsloot
WEIGHT:
C
93.2 g hoosing a case for your Raspberry Pi can
be a little tricky when there are many
FASTENERS: competing products on the market. You
Magnetic
can always make one with LEGO, 3D-printed parts,
cardboard, etc. if you have the means, making the
choice even more complex.
The u-maker Box may not solve that issue, but
it is at the very least quite unique in its approach
to Raspberry Pi case design. You can plonk a
Raspberry Pi 4 inside it and be done if you want,
and with magnets fastening the whole thing and
plenty of space inside it, it’s not the worst case
you could use.
The standard box is very unassuming but
What’s cool, though, is that you can really makes for a good basic enclosure
modify and personalise the case to what you need
it to do thanks to a smart construction system and
freely available templates to play around with for
3D printing.
Snap build
Verdict The standard box comes with some mounts that
allow you to attach it to a wall or VESA mount, and
A unique and even a special one for boom arms. As well as the
very cool way extra bits in the Extension Kit that help connect
to customise or extra boards, brackets, or even a case fan, there’s a
prototype a case
_ZYZQ?STYRTaP]^PʭWP^QZ]aL]TZ`^VTYO^ZQ^_LYO^
for your Raspberry
Pi projects. Pc_PYOP]^LYOPaPYLYLW_P]YL_PWTO_SL_NLYʭ_L
10 10
square HyperPixel.
The number of options are truly astounding and
/
none of it looks or feels hacky. It’s just a very nice
The ridges on the corners are used smartly
to hold the case on various accessories implementation of the design idea.
DISPLAY:
7.3-inch e-ink, Ideal for showing artwork and data, this is The 800×480
widescreen display
800×480 pixels,
seven colours a super-size e-ink display. By Phil King can render dithered
colour images with a
fair amount of detail
FEATURES:
T
4 × user SP4YVd4X[]P^^TZY"ťT^LYPb^`[P]
buttons, ^TePaP]^TZYZQ;TXZ]ZYTɪ^Q`WWNZWZ`]
I2C and SPI PTYVP[L[P]3,?QZ]=L^[MP]]d;T. We
breakout pins,
booster header,
reviewed the original 5.7-inch model in issue 102
stand-offs (XLR[TNN); there’s also a 4-inch version.
DIMENSIONS:
170.2 × 111.2 mm The big draw here
is the size of the
screen, measuring 7.3
inches diagonally
The rear of the Inky Impression board also
features a set of breakout pins for power, ground,
The 7.3-inch display is considerably larger than I2C, and SPI to connect extra components such as
a full-size Raspberry Pi board, so is supplied with sensors – perhaps for a weather display.
an extra female header to boost its height, along
bT_S^ZXPXP_LW^_LYOZʬ^LYO^N]Pb^_Z^PN`]P Widescreen wonder
it. You need to take a little care when mounting it, Naturally, the big draw here is the size of
holding it by the sides rather than pushing down the screen, measuring 7.3 inches diagonally.
on the glass screen. A resolution of 800×480 equates to a pixel
density of 127.8 ppi – just marginally lower
_SLYZY_SP "ťXZOPW4Y[]LN_TNPTXLRP^WZZV
detailed and smooth enough from a 30 cm-plus
Verdict
viewing distance.
To display a custom image (JPG, PNG, etc.),
you can use Pimoroni’s handy dithering code to
A whopper of an process it for the seven-colour e-paper. A one-line
e-ink screen with
installer is used to download the Python library,
full colour and
plenty of room to fonts, and examples from the GitHub repo
display images (XLR[TNNTYVdRT_). Note that you need I2C
and/or data. enabled to detect the board.
8
The main downside, as with all colour e-ink
displays, is a slow refresh rate: around 40 seconds,
/10
depending on the complexity of the image
4RXLIVIEV]SYƶPPǻRHEFVIEOSYXLIEHIV
ERHWSQIGSSPWMPOWGVIIREVX[SVO being drawn.
76 magpiGG .RO].QTVIWWMSR
REVIEW
WuKong 2040
Elecfreaks magpi.cc/wukong2040 £8 / $10
O
The board is packed with features that
ne of the more popular type of make great use of Pico’s own functionality
SPECS Raspberry Pi Pico add-ons that
we hadn’t quite foreseen was the
SIZE: educational breakout board. Pop your
55.8 × 87.8 ×
Pico onto a board and start coding it to
36.3 mm, 50 g
(without Pico NZY_]ZWOTʬP]PY_NZX[ZYPY_^LYO]PLO
or battery) various sensors – it’s a great educational
tool for people of all ages, and usually
POWER: dirt-cheap too.
18650 lithium
battery At under £10, the WuKong 2040
certainly keeps prices low while still
60-minute
packing a huge array of features on a
battery life
small board. Buzzers, buttons, LEDs,
2.8 V ~ 4.2 V motor controllers, a traditional GPIO
INTERFACES: breakout to hook up more, and the ability
2 × buttons,
2 × LEDs, 1 × to power it all with a
buzzer, motor
interface, GPIO At under £10, the WuKong 2040 certainly rechargeable battery so you
can take it anywhere.
interface, I2C
interface keeps prices low while still packing a huge
Code by numbers
array of features on a small board Programming a Pico
attached to the board is
quite simple, making use
of standard MicroPython, CircuitPython, and C
libraries to work, and each pin and component
labelled with the corresponding GPIO to which it’s
Verdict connected. Examples are given in CircuitPython on
the website, which can be fairly easy to translate
Small, reasonably to MicroPython if needed, and give you a nice little
priced, and overview of what you can do with the board.
packed with
For those wanting a more practical application
functionality, this
board is a fun way of the board, it also comes with a little add-on
to learn and grow that makes the base compatible with many kind
with Pico. of brick building systems like LEGO – a good way
9
to create a fun robot
Some great examples completely powered
of how you can use the
/10
by custom code you
included base adapter for
brick-building systems made yourself.
Badger 2040 W
(Pico W Aboard)
Pimoroni magpi.cc/badger2040w £27 / $28
SPECS
4RXLIVIEV]SYƶPPǻRH
DISPLAY: Pico W, a reset button,
2.9-inch e-ink, Much more than a badge, this versatile mini e-ink FEXXIV]GSRRIGXSVERH
Qwiic/STEMMA QT
296×128,
monochrome display has wireless connectivity. By Phil King port – to which you
GSYPHGSRRIGXEWIRWSV
T
FEATURES: he Badger 2040 W is a mini monochrome
Pico W, 5 × user
buttons, reset e-ink display with wireless connectivity.
button, LEDs, Unlike the original Badger 2040 (reviewed in
Qwiic/STEMMA issue 116, magpi.cc/116), this new model is based
QT port around a Pico W pre-soldered to the rear.
DIMENSIONS: Another improvement is the inclusion of a real-
85.6 × 48.7 × time clock (RTC), enabling it to keep time even
10 mm when in ‘super deep sleep’ mode, with Pico W
powered down – in which it draws a minuscule
Ũ, ZQ N`]]PY_
Talking of power, you will want a portable way
of supplying it. To this end, there’s a JST battery
connector on the rear. If you buy the accessory kit
version, you get – along with a lanyard – a 2×AA A real-time clock enables it
battery pack with a Velcro patch to stick it to the
rear of the board.
to keep time even when in
Alternatively, you could use a standard USB
power bank connected to Pico W. Both solutions
‘super deep sleep’ mode
are a little chunky, though, so you might prefer a
slimline LiPo battery pack. Easy to program
BSPY ʭ]^_ [ZbP]PO `[ _SP -LORP] B
Verdict launches into ‘Badger OS’ with a scrollable menu
of icons to choose demo programs and tools.
An interactive These include a badge, digital clock, e-book
badge that reader, interactive checklist, news headlines, and
doubles as a
weather dashboard.
versatile mini
Naturally, you can connect Pico W to a computer
e-ink display with
a reasonably quick via USB to customise the examples or create new
refresh rate and programs – in MicroPython or C/C++. Pimoroni’s
Wi-Fi connectivity. standard PicoGraphics library makes it easy to add
8
bitmap images, and several fonts are supported.
You’ll need to add your Wi-Fi credentials to try
/10
out examples such as news and weather, as well as
8LI'EHKIV;ƶWQMRMQSRSGLVSQIIMRO
HMWTPE]MWWYVVSYRHIHF]XEGXMPIFYXXSRW setting the correct time via NTP.
10 Amazing:
Cases
FLIRC case
Media shelf ready
Designed for use by your TV, this range of cases doesn’t look out
Protect your Raspberry Pi with of place next to Blu-ray players or satellite boxes.
R
aspberry Pi is hardly fragile, but it really is
recommended to get some kind of case for your
microcomputer (or microcontroller), even if
you’re just cutting some holes in the cardboard box it
comes with. Here are ten great cases that are a little more Argon EON NAS
sturdy though.
File server
The price may be eye-watering, but
this enclosure allows you to add four
hard drives, includes an RTC, cooling
fan, programmable OLED display,
and room for your Raspberry Pi.
magpi.cc/argoneon | £144
Pibow
Layers of case
{ĜĵŅųŅĹĜűŸŅųĜčĜűĬā±čŸĘĜŞŞųŅÚƚÏƋĜŸƋĘĜŸŸƋƚųÚƼϱŸåĵ±ÚåƚŞ
of laser-cut acrylic layers. There are many styles and colours to
get as well.
magpi.cc/pibow | £6
magpi.cc/smartipipro | £30
80 magpi.cc Cases
RESOURCES
4ǽGMEPGEWI
Simple and clean
ĘåŅþÏĜ±ĬϱŸåŸĹƚčĬƼĀƋŸ±±ŸŞÆåųųƼ{ĜĜĹŸĜÚåţĘåųåűŸ±
version of all types of Raspberry Pi, and even a case fan if you’re
using your Raspberry Pi at full power regularly.
magpi.cc/case | £6
SecurePi Case
Locked down
This case allows you to cover up IO ports on Raspberry Pi,
including the SD card slot, for increased security.
magpi.cc/securepi | £10
NESPi 4 case
Classic console body
Lots of people like to use a Raspberry Pi for retro gaming, so
what better way to display it than with it inside a retro console
case with a fake cartridge?
magpi.cc/nespi4 | £29
Cases magpi.cc 81
RESOURCES
Learn Assembly
with Raspberry Pi
Get to grips with the obtuse technology
that underpins all modern computers
Programming
from the ground up
Robert G. Plantz Assembly language is the low- that all computers run. It can be
AUTHOR
Smith name in the world of ARM for practical, hands-on Understanding ARM
Assembly language, so much so learning experiences. by following these
Price: that we asked him to write us a Readers are guided through
£35/$35 YouTube courses
series of Assembly tutorials in the fundamentals of Assembly
magpi.cc/rpiassembly
The MagPi^_L]_TYRbT_ST^^`P language, and then onto more
116, magpi.cc/116). complex programming
His book, Raspberry Pi concepts. The
Assembly Language Programming, journey
is the one to get for anyone culminates
interested in delving into the in the
depths of Assembly language development
using Raspberry Pi. of a fully ASSEMBLY LANGUAGE
This book takes a focused functional TUTORIAL
approach to teaching Assembly bare metal Derek Banas is known for
language in an accessible operating his clear and thorough style,
and engaging way, utilizing system. making complex topics
accessible to beginners.
This video serves as a great
introduction to Assembly with
Raspberry Pi Assembly
Raspberry Pi.
magpi.cc/assemblytutYT
operating system originally the Raspberry Pi. This extensive video tutorial
Price: designed by Acorn computers The book starts with an from freeCodeCamp covers
£16/$16 and kept alive by volunteers. introduction to Raspberry Pi ARM Assembly language with
magpi.cc/ Bruce Smith uses RISC OS to and RISC OS, setting the stage ARMv7 from the basics to more
riscosassembly
provide a unique and insightful for a comprehensive exploration complex concepts.
guide to the fundamentals of Assembly language magpi.cc/freeCCARM
of Assembly language programming. Each chapter
building upon the last, covering
topics from basic concepts INTRODUCTION
to more advanced aspects of TO ASSEMBLY
Assembly language. PROGRAMMING WITH
The book’s focus on RISC OS ARM
[]ZaTOP^LOTʬP]PY_[P]^[PN_TaP This series of 16 tutorials by
on Raspberry Pi programming, OliveStem demonstrates ARM
which makes a lot more sense memory layout, arithmetic, and
when you are so deep in the logical operations.
world of ARM Assembly. While magpi.cc/OliveStemARM
RISC OS and ARM Assembly are
both niche subjects, they tag
team well together.
Alistair
MacDonald
Maker and Maker Space founder, Alistair likes to
bring the joy of his hobby to the community
A
popular plot device for reputation and most of my work “Today I run FabLab
stories is simply ‘I’m came through word of mouth. Sunderland where we support
bored of my job and In the end, I specialised in both students and businesses
I am going to do something prototyping products, creating alike in creating almost
else’. It’s popular because it’s interactive displays, and anything,” Alistair says. “We
relatable, even if not everyone supporting artists in creating ZʬP]/[]TY_TYRWL^P]N`__TYR
is able to manage it. Alistair artworks on the side. It was electronics fabrication, CNC
MacDonald did though after random, and at times just crazy, routing, vinyl cutting, and
spending years developing “big and I liked that.” many, many other things.”
boring software.” He began to teach others his
“I needed a change, so I set skills at a local university, and What is your history
up on my own with the aim of this has expanded even further with making?
Trundlebot is an
educational MicroPython doing more fun and interesting to becoming a founding member I don’t have a memory of when
robot created by Alistair,
projects,” Alistair tells us. “This of the Newcastle hackspace I started making things. It’s
and it won Electromaker’s
PCB project design contest worked out, and I gained a called Maker Space. just what I have always done.
When I was young, my favourite
books were all making books.
That, and books on how things
worked. The earliest project I can
remember is Roby, a cardboard
robot with lights on the front.
?SP^PbP]P^bT_NSPOZYLYOZʬ
by moving paper clips that were
drawing-pinned to a piece of
wood. I must have been around
seven years old at the time. My
skills have moved on since then
but, if I am honest, my childlike
joy of such things has not.
As I got older, I would study
electronics catalogues and
datasheets and would want to
try everything. I would ask my
father to buy components and
make things like disco light
controllers, audio mixers, and
model railway control systems.
Some things worked, some community in Newcastle upon about what we were up to. FabLab Sunderland is a
great place to learn how to
things did not, but I learnt from Tyne, and a few big companies We talked at local tech user make, and also just make
all of them. wanted to check if their software groups and events at our local WXYǺ]SYVWIPJ
After I graduated [university], I would run in the [Raspberry] Pi. science centre. We rebranded
started doing a few small projects from Hackspace Newcastle to
again, but it was not until the How did Maker Space start? Maker Space (a unique and more
birth of the Arduino that I really A long, long time ago I wanted descriptive name back then).
got back into electronics. It was to create a space where we could We set up an online discussion
not until much later, when we make things. Or, to be more group about making to try to
created Maker Space, that I had ^[PNTʭN4bLY_PO_SP^[LNP bring people with that making
DNA in them together. In the
end we got more people involved
My good friend Brian and I decided to and, when you have more people
sharing the load, things become
form a hackspace easier. We owe a lot to those
bSZ[`__SPPʬZ]_TY_ZOLd
access to the facilities to do more and the only way it was going
physical builds again. to exist [was] if I created it.
Back then, I envisaged a kind
When did you learn about of workshop, an art studio, and
Raspberry Pi? community centre all wrapped
Very early on. I cannot into one. In the end, my good
remember exactly when I heard friend Brian and I decided
about it, but it was long before to form a hackspace, and we
they were publicly available. I managed to rent a small space at
_]TPO_ZRP_ZYPZQ_SPʭ]^_ML_NS the back of a community cinema
and managed to place an order, in the city.
but something went wrong with The problem was that, back
the order and the order was then, no one else was looking for
cancelled… I did still manage to something like this, or if they
get one early on though. I joke bP]P_SPY_SPdbP]PYZ_ʭYOTYR
that I gained a lot of friends us. In the end, we realised that
because of this, but a lot of we needed to change how we
people did borrow it. We have were reaching out to people.
They also get into the spirit of the
an active software development We did things like blogging maker season at FabLab Sunderland
MagPi
01
Monday
Amazing projects direct from our Twitter!
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 have 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!
86 magpi.cc #MagPiMonday
THIS MONTH IN RASPBERRY PI
04
05
06
07
08
09
#MagPiMonday magpi.cc 87
THIS MONTH IN RASPBERRY PI
Events in pictures:
Raspberry Jam WV
Community and official events in the wild
W
ay back in issue 79 of The MagPi, 01
we spoke to Brett White about EX T
OU T N D
how he has been trying to get UT AB N
FIND O ’S EVEN TS A
H
more computer science education into his MON T P O N
home state of West Virginia in the US. Since
POP-U
then, he’s been putting on Raspberry Jams PAGE 92
and is now a professor at the University of
Charleston’s Computer Science department. In
8L]NS_ST^dPL]_SPʭQ_S=L^[MP]]d5LXBA
went ahead – here are some photos. 02
03 05
04
Crowdfund this!
Raspberry Pi projects you can
crowdfund this month
PiBeam
Make-It-Move HAT
“Step into the future with us and witness the birth of a device that
seamlessly merges the unrivalled computing power of Raspberry “Make-It-Move HAT is the most user-friendly plug-n-play custom
Pi’s RP2040 microcontroller with the wireless capabilities of hardware, that eases the development of motor driven Robotics
an IR transceiver. PiBeam is not just an ordinary gadget; it’s Applications. It provides an easy plug-n-play support to control up
a technological marvel, enabling you to explore the endless to 23 motors for any robotics Application, with easy to understand
possibilities of Python-based hardware learning.” ŸĜĵŞĬĜĀåÚÏŅÚå±ĹÚXĜÆų±ųĜåŸĜĹĵƚĬƋĜŞĬåX±Ĺčƚ±čåŸţŰ
kck.st/43klhJi kck.st/43DPAKB
Together we can
make a difference
Give young people the opportunity
to learn about technology
Your
Letters
Learn all about the construction
Centre of media SJE7EWTFIVV]5MMR/IǺƶWZMHIS
APL is a very
interesting style of
code and it’s good
to know it’s still FREE
around and being
used! We may have RASPBERRY PI
to do a tutorial with
it in the future. PICO W
Contact us!
>
>
Twitter
Facebook
@TheMagPi
magpi.cc/facebook
Subscribe online:
>
>
Email
Online
magpi@raspberrypi.com
forums.raspberrypi.com
magpi.cc/subscribe
Subscription is for the next six issues by continous credit card and renews automatically. This is a
limited offer. Offer subject to change or withdrawal at any time.
EVENTS
Community
Events Calendar
Find out what community-organised Raspberry
Pi-themed events are happening near you…
RASPBERRY PI 02
STORE POP-UP
9JGTGECP[QWƓPF
Raspberry Pi next?
> Next location Raspberry Pi Store pop-up, Gateshead
> Where Metrocentre, Gateshead, UK
> When Friday 28 July and Saturday 29 July
A
t this Raspberry Pi Store pop-up
in Gateshead, you can experience
and buy Raspberry Pi products.
Explore some of the things you can do with
03 a Raspberry Pi, discover our accessories
and books, and get your hands on limited
edition exclusives.
01
magpi.cc/popup2023gateshead
BUILD A RASPBERRY PI
MEDIA PLAYER
Power up your TV and music system
magpi.cc/mediaplayer
COMPETITION
Competition magpi.cc 95
SAVE
35%
ISSUE #68
OUT NOW
hsmag.cc
NEXT MONTH
EDITORIAL
Editor
Lucy Hattersley
RETRO
lucy@raspberrypi.com
Features Editor
Rob Zwetsloot
rob@raspberrypi.com
Sub Editor
Nicola King
ADVERTISING
GAMING
Charlotte Milligan
charlotte.milligan@raspberrypi.com
+44 (0)7725 368887
DESIGN
criticalmedia.co.uk
Head of Design
Lee Allen
+ OFFICE WORK
Designers
Olivia Mitchell, Sam Ribbits
Illustrator
WITH
Sam Alder
CONTRIBUTORS
RASPBERRY PI David Crookes, Rosemary
Hattersley, Nicola King, Phil
King, Dr. Andrew Lewis, KG
Orphanides, David Plowman,
Danny Staple, Stewart Watkiss
PUBLISHING
Publishing Director
Brian Jepson
brian.jepson@raspberrypi.com
Director of Communications
Liz Upton
CEO
Eben Upton
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
T
he future is amongst us. At least feels like the tech industry is getting if it’s a serious project or a piece of
according to Apple, purveyor of ready to limber back up. whimsy. What matters most is that
shiny slabs, which recently =L^[MP]]d;TT_^PWQT^^SLVTYRZʬ_SP it’s real.
announced a new glass headset to PʬPN_^ZQ_SP^`[[WdNSLTY[]ZMWPX^ The future appears one day and
slap in front of your face. You can dial that have plagued everybody for the then suddenly it’s the present. It feels
back reality using a rotating tool on last couple of years. There is no like ChatGPT and the AI generative
the side, and tap apps and icons in steady supply of Raspberry Pi Zero, genie are out of the bottle and will be
mid-air. Sounds fun. Raspberry Pi 3A+, and an increasing staying with us, for now. I suspect
I’m not convinced by VR or AR. supply of Raspberry Pi 4 models. we’ll also see a lot more generated AI
Does the future of technology really art and 3D visuals. Personally, I hope
belong to this kind of detachment Back in the room that it’ll be the mundane but useful
from reality? Who knows! Maybe I’ll This comes as a big relief to us. We’re technology, the sort that pings me for
have egg on my face and a Vision Pro keenly aware that people love this calendar events and lets me know
headset in three years. I’ll be writing magazine because they love Raspberry when my partner is calling, but then
this with giant hovering buttons in Pi. And it’s easier to love something fades into the background when I’m
front of my face while you read it, in that you can reliably buy. looking at more interesting things.
Maybe VR and AR are the future,
but I need to assemble it with my own
Maybe, when I’m hooking up dual tiny two hands for it to feel real. There
have been some attempts at VR with
screens inside a 3D-printed headset, it’ll Raspberry Pi, and with its dual HDMI
through to shiny new Apple toys, it earthquake detector. It doesn’t matter magpi.cc/lucyhattersley
"DPTUFŗFDUJWFTPMVUJPOGPSEBUBDFOUFST
*5EFQBSUNFOUTPSSFNPUFNBDIJOFT
1J,7.)"5
GPS%*:BOEDVTUPNQSPKFDUT 1SF"TTFNCMFEWFSTJPO
$YDLODEOHDWWKHPDLQ5DVSEHUU\3LUHVHOOHUV
3FTFMMFSTVHHFTUJPOTBOEJORVJSJFT
XIPMFTBMF!IJQJJP