Diy Home Automation: With Raspberry Pi
Diy Home Automation: With Raspberry Pi
CC/STORE
GET STARTED
WITH CAMERA
MODULE
CHATGPT:
BUILD A
CHATBOT!
magpi.cc/store
WELCOME
to The MagPi 129
C
omputers should be put to work, and we think Home
Automation is a fun way to get our little computers
to do some heavy lifting. Our resident home-hacker,
PJ Evans, has put together a great feature about getting Lucy
EDITOR
Hattersley
Raspberry Pi to open the curtains, manage the garage door,
and turn the lights on (page 34). Lucy is editor of
The MagPi and is
Meanwhile, Rob Zwetsloot has written an excellent article currently arguing
the merits of good
on Getting Fit with Raspberry Pi (page 66). It’s the perfect wine over beer
to a massively
way to combine Raspberry Pi’s mental stimulation alongside unreceptive bunch
of techies. She’s
looking out for your physical health. I’ll leave you to it. almost been run
out of the company.
Meanwhile, we’ve got some amazing projects this month. Anyway, beer
next month!
KG Orphanides is on-the-ball with a tutorial on how to set up
magpi.cc
ChatGPT API on Raspberry Pi (page 42), there’s also a LEGO
brick that plays DOOM (page 16), and a Clamshell BlackBerry
Cyberdeck (page 18).
This issue is as packed as ever, and it’s been an absolute
pleasure to make. I hope you enjoy it as much as we do.
GET A
RASPBERRY PI
PICO W
Lucy Hattersley Editor PAGE 28
magpi.cc 03
CONTENTS
Contents
> Issue 129 > May 2023
Cover Feature
34 DIY Home 34
Automation
Regulars
Project Showcases
08 Shiloh Studios
12 ClippyGPT 18
16 Doom on a LEGO brick
18 Clamshell BlackBerry cyberdeck
22 Greening the Spark
24 Bugg.xyz acoustic monitoring
16
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 50 54
42 Build your own GPT Chatbot
46 Introduction to inputs and outputs
50 Bluetooth music visualiser
54 Camera Module: Getting Started Create a Bluetooth Camera Module:
60 RFID spells fun music visualiser Getting Started
PicoBricks
)GVƓVYKVJ4CURDGTT[2K 84
Reviews
72 Compute Blade
74 PicoBricks
77 10 amazing browsers
81 Learn Sense HAT
Community
84 Brian Jepson interview
88 This Month in Raspberry Pi Brian Jepson interview
1 OF 5 CAMERA MODULES
DISCLAIMER: Some of the tools and techniques shown in The MagPi magazine are dangerous unless used with skill, experience, and appropriate personal protection equipment. While
we attempt to guide the reader, ultimately you are responsible for your own safety and understanding the limits of yourself and your equipment. Children should be supervised. Raspberry
Pi Ltd does not accept responsibility for any injuries, damage to equipment, or costs incurred from projects, tutorials or suggestions in The MagPi magazine. Laws and regulations covering
QER]SJXLIXSTMGWMR8LI2EK5MQEKE^MRIEVIHMǺIVIRXFIX[IIRGSYRXVMIWERHEVIEP[E]WWYFNIGXXSGLERKI=SYEVIVIWTSRWMFPIJSVYRHIVWXERHMRKXLIVIUYMVIQIRXWMR]SYVNYVMWHMGXMSR
and ensuring that you comply with them. Some manufacturers place limits on the use of their hardware which some projects or suggestions in The MagPi magazine may go beyond. It is
your responsibility to understand the manufacturer’s limits.
06 magpi.cc
PROJECT SHOWCASE
Shiloh
Lights can be controlled
from the touchscreen in
the control room and in
Studios
the individual rooms
Michael Peters
W
MAKER
Lehman ?SPOTʬP]PY_=L^[MP]]d;T^ZW`_TZY^bP]P[`WWPO
&YHMSVIGSVHMRK
ZʬMd/L]]PWW7PSXLYLW^ZZQ>STWZS>_`OTZ^bSZ Pi’s ecosystem when I need
has been making Raspberry Pi-based projects
IRKMRIIV&:1
W]WXIQWMRXIKVEXSV QZ]ZaP]ʭaPdPL]^LYOSL^MPPYbZ]VTYRbT_S to solve problems
ERHQYWMGMER-I electronics for over 25 years.
EPWSWIVZIWMRVSPIW
EWETLSXSKVETLIV
“I’ve completed a lot of prior projects on Musical fruit
ZMHISKVETLIV Raspberry Pi with touchscreens, [Power over There’s four main ways that Raspberry Pi is used
ERHRIX[SVO Ethernet], TouchOSC, and Node-RED, so at Shiloh Studios. First of all, as a lot of things
EHQMRMWXVEXSV Raspberry Pi was a familiar and easy choice,” are connected via Ethernet, a Raspberry Pi helps
shilohstudios.us Darrell explains. “I gravitate toward Raspberry monitor those connections.
Quick FACTS
> )ERXIRIX[SVOMRKMW
EWXYHMSWXERHEVH
> 1MKLXWMRXLIWXYHMS
YWI7,'1*)WWS
GERGLERKIGSPSYV
> 8LIVIQSXI
WGVIIRWEVI
MRHITIRHIRX
FYXXLIVIMWE
QEWXIVVIQSXI
8LIOI]FSEVH
GSRRIGXMSRQEOIW
YWISJFIXXIV*XLIVRIX
GSRRIGXMSRWSZIVE
PSRK9'GEFPI
remote looked and worked just like we’d expect control over 256 interfaces around the studio.
from tablets with apps, or touchscreen products Perhaps the next step will be an entire DAW
^[PNTʭNLWWdXLOPQZ]_SL_`^P made with Raspberry Pi.
ClippyGPT
Clippy is back! And this time we’re really glad to
see and hear from Microsoft’s iconic character,
as David Crookes explains
T
rying to think of something to write can be
hard (a fact that feels very much true right
YZbRTaPY_SL__ST^T^_SPʭQ_S^_LML_
penning an intro!). But imagine how much harder
writing would be if you had a peppy paper clip in
dZ`]PdPWTYPNST][TWdZʬP]TYRSTY_^LYO_T[^ɭ/Z
dZ`YPPOL^^T^_LYNPɮT_bZ`WO^LdL^^ZZYL^dZ`
^ZX`NSL^_L[[POL^TYRWPWP__P],YOTQdZ`OTOYɪ_
David
MAKER
YPPOSPW[]TRS_L__SL_XZXPY__SPYT_ɪOMP^`]P
Packman _ZL^VdZ`LRLTYWL_P]
David Packman is 1Z]`^P]^ZQ8TN]Z^ZQ_ɪ^:ʯNP$"_ST^MPNLXP
a former Microsoft L]PLWT_dNZ`]_P^dZQLYɩTY_PWWTRPY_ɪ`^P]TY_P]QLNP
program manager NLWWPO.WT[[dbSTNST_ɪ^QLT]_Z^Ld^[WT_Z[TYTZY
responsible for
-`_PaPY_SZ`RS?480XL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SHOWCASE
14 magpi.cc ClippyGPT
PROJECT SHOWCASE
ClippyGPT magpi.cc 15
PROJECT SHOWCASE
W
e’ve seen portable games projects rear panel has just enough room for a micro USB
before, but nothing quite this small! socket. The other three panels have castellated
Maker James Brown took on the huge edges to provide “the mechanical and electrical
challenge of embedding a playable game of the NZYYPN_TZYLYONLYMPOP^TRYPOL^L^TYRWPʮL_
NWL^^TNʭ]^_[P]^ZY^SZZ_P]/ZZXTYL702:M]TNV circuit which is later chopped up to make the
powered by Pico’s RP2040 chip and featuring a 3D frame.”
tiny OLED screen. Once James had assembled the circuit, he put it
James makes clear that it was an iterative in a silicone mould to be encapsulated with epoxy
James Brown
MAKER
As well as tilt
control, there are
two capacitive touch
buttons in the studs
Clamshell
BlackBerry
cyberdeck The HyperPixel screen is
powered via Raspberry Pi 4’s
GPIO pins – a critical factor
that helps keep everything
Keeping things as compact as possible drove extremely compact
A
^dZ`XTRS_TYQP]Q]ZXLbZ]O[]PʭcPO
with ‘cyber’, cyberdecks have their origins
TY_SPbZ]WOZQ$#^^NTPYNPʭN_TZY
This particular version, however, harks back to
the early 2000s when PDAs were a must-have
business accessory, but the iPhone (and as such,
smartphones) had yet to launch. Maker Michael
Klements chose a clamshell version of a BlackBerry
Michael
MAKER
Quick FACTS
> Michael previously
designed a
Lattepanda
clamshell
cyberdeck
since they worked with Raspberry Pi. The setup much larger than the components themselves.
[]ZaTOPOɭ_SP[P]QPN_ʭ_QZ]XdM`TWOL^_SP Designing the hinges also “took a bit of work”
keyboard footprint is smaller than the display’s, to get the extent to which they would open just
and still allows you to get full mouse and right. Michael wanted to limit the clamshell’s
keyboard functionality.” opening travel to have the display at about a
20-degree angle. “This makes it easier to use as
Laser-like focus a handheld device and lets it sit on a desk like
Michael designed and laser-cut parts, using a small laptop would.” The plywood parts were
Inkscape open-source software to create a case as glued together before the Raspberry Pi-based
small as possible, so the overall package wasn’t components, HyperPixel display, and repurposed
Having installed
Raspberry Pi OS,
it’s time to test
the cyberdeck’s
BlackBerry keyboard
Michael designed
the case in Inkspace
before laser-cutting
the parts
Cyberdeck style-up
W
hat do you want to do when you retire?
Some might want to relax, others might
like to travel. Carl Nicholson had a
OTʬP]PY_TOPL
“When I retired and moved back to the UK,
I wanted to do something that would raise
awareness of climate change and help people
understand the ideas behind green energy,” Carl
Carl Nicholson
MAKER
9WMRKXLIORSFWLIPTWQEMRXEMRXLIIRIVK]
grid depending on demand. Careful use
KVERXWEKSSHWGSVIFYX]SYRIIHXSQEOI
sure you’re delivering enough
Quick FACTS
> Carl has been
working on this for
over two years
Bugg.xyz
acoustic monitoring
Soundscapes can provide a valuable insight into the health of a habitat.
A Raspberry Pi can help conservationists listen in, explains Rosie Hattersley
T
he louder the dawn chorus and the =L^[MP]]d;TbZ`WObZ]VbT_ST_M`_XZ]PL]Z`YO
cacophony of wildlife, the better the locale _SPʭPWOWZRT^_TN^ZQXZ`Y_TYRZYPTYLQZ]P^__Z
and, by extension, life for the creatures withstand temperature swings, humidity swings,
_SL_ObPWW_SP]P?ST^T^L^TX[WTʭPO_LVPZY_SP and long duration deployment.”
importance of acoustic monitoring, as conducted Helpfully, Sarab’s PhD supervisor had set up
by Bugg.xyz using a Raspberry Pi-based system. SAFE (Stability of Altered Forest Ecosystems),
Bugg wildlife traps record the sounds of the
forest, and are AI-trained to listen to the quietest
Sarab
MAKER
Bugg’s injection-moulded
case provides robust
[IEXLIVTVSSǻRKERH
can be securely lashed
to a tree in even the most
I\TSWIHcIRZMVSRQIRX
> DC power
SPEVGLEVKMRKMWWYǽGMIRX
correction
to power Raspberry Pi, the
compensates for
microphone, and 3G/4G
erratic electricity
mobile module so sounds can
supplies
be sent and processed as soon
as they’re recorded
> Solar panels
power the devices
throughout all
seasons bar winter
Get bugging
Anyone home?
?SPZ[PY^Z`]NP-`RRVT_^L]PYZb`^POQZ]
X`W_T[WPXZYT_Z]TYR_L^V^BSTWPaPRP_L_TZY
^LX[WTYRTYaZWaP^_LVTYR^LX[WP^LYOXPL^`]TYR
_]PP^>L]LMɪ^-`RRXZYT_Z]_LVP^LXZ]PSZWT^_TN
approach, “using soundscapes as a whole to
infer habitat health.” Once the microphone in
one of the Bugg devices detects sounds, they are
_]LY^XT__POZaP]LXZMTWPYP_bZ]VQZ]XLNSTYP
FĹŸƋ±ĬĬƋĘåŸŅüƋƵ±ųåĜĵ±čåŞųŅƴĜÚåÚŅĹƋĘå
02
A rainforest degradation monitoring project :ĜƋBƚÆĬĜĹĩƋұĵĜÏųŅ%ϱųÚŅü±ƋĬ屟ƋƐƖ:
capacity. Connect the microphone, camera, audio
in Borneo formed the ideal proving ground card, and other components to Raspberry Pi.
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 35% compared to stores
+
Subscribe for 6 Months
Free Pico W
6 issues of The MagPi
Free delivery to your door
£30 (UK) £35 (USA)
£35 (EU) £45 (Rest of World)
28 magpi.cc
SUBSCRIPTION
A brand new
RP2040-based
$6
Raspberry Pi Pico W
development board
SUBSCRIBE
on app stores
magpi.cc 29
SUCCESS STORY
Freight Farms
Raspberry Pi 4-powered vertical hydroponic farms let customers
grow and monitor fresh produce anywhere. By Rosie Hattersley
THE SOLUTION
Freight Farms recently launched its Raspberry
;T[ZbP]PO2]PPYP]d>ʮLR^ST[XZOPW,^bPWW
as using the top-of-the-line Raspberry Pi, this
container farm features a bespoke camera unit.
;]TZ]_Z_ST^1]PTRS_1L]X^SLO`^POZʬ_SP^SPWQ
security cameras to monitor plants. “These were
WTXT_POTY_P]X^ZQ^P_`[LYONZYʭR`]LMTWT_dLYO
did not have enough resolution or FOV in a small
enough package to embed inside the walls of the
farm,” explains Jake Felser, CTO at Freight Farms.
now with a
Analyze
DIY HOME
AUTOMATION
WITH RASPBERRY PI
Revolutionise your abode with Raspberry Pi:
affordable, customisable automation for your house
and home! By PJ Evans
W
elcome to the marvellous world
of Raspberry Pi-powered home
automation, where your humble house
transforms into a technological utopia!
Get ready to shake hands with Home Assistant,
your faithful digital butler, and explore cool
automation ideas that’ll make the Jetsons
green with envy. Prepare to dive into the MQTT
]PLWXbSP]PPʯNTPYNd]PTRY^^`[]PXPLYO
communication is king. Finally, create your very
own smart garage door, an ingenious guardian
that’ll open and close at your beck and call.
So, strap in and let’s high-tech your home!
Getting Started
with Home
Assistant
Take control of your home, and your
You can access Home
privacy, with this amazing home Assistant in any web browser.
H
ome automation is not only useful but
can also be a great deal of fun, setting up
NZZWL`_ZXL_TZY^Z]NZYYPN_TYROTʬP]PY_
devices together in new ways. It also can help
Write the Home Assistant image
bT_SPYP]RdPʯNTPYNdLYO^PN`]T_d?SP]PL]PL
wealth of practical reasons to start experimenting
02 Luckily for us, you can write the latest
with this technology. Although there are stable Home Assistant image directly from the
OTʬP]PY_aPYOZ]^[PNTʭNL`_ZXL_TZY^d^_PX^ Raspberry Pi Imager (magpi.cc/imager). Using
out there, we prefer one that doesn’t ‘lock’ you a fast SD card 32GB or more in size, insert it
into one provider. One such platform is Home into your computer. In Imager, select Choose OS
Assistant (home-assistant.io), a free open- ):_SP]^[PNTʭN[`][Z^P:>)3ZXPL^^T^_LY_^
^Z`]NPZ[P]L_TYR^d^_PXOP^TRYPObT_SʮPcTMTWT_d and home automation> Home Assistant > Home
PJ Evans
MAKER
and independence in mind. Home Assistant is a Assistant OS 9.5 (RPI 4/400 or RPI 3, as needed).
huge topic, but here we’ll look at the basics of You’ll now get a ready-to-boot image. PJ is a writer,
setting up a server to get you started on your Insert the card into your Raspberry Pi, make software engineer,
and home
automation journey. sure you’ve got a wired network connection and
automation
power up. After a few minutes, try to connect to enthusiast. He has
http://homeassistant:8123 in your web browser. no idea why his
lights keep changing
colour at 3.15 pm
Prepare your Raspberry Pi
01 Although Home Assistant (HA) isn’t
every day, but it’s
probably his fault.
Initial setup
strictly an operating system in its own right,
it is available as a Raspberry Pi image that
03 Time to grab yourself a favourite beverage.
mrpjevans.com
You’ll Need
Home Assistant
knows your
local sunrise
Next steps
and sunset
times. A great 06 Congratulations, you now have a running
ĀųŸƋ±ƚƋŅĵ±ƋĜŅĹ Home Assistant server. The capabilities of this
project is
service can seem overwhelming at times but
switching a porch
ĬĜčĘƋŅűĹÚŅý±Ƌ
with a little reading on home-assistant.io and
the right times. some digging around the menus, you’ll soon
be taking control of your home. Once you’ve
LOOPO_SPLMTWT_d_Z^bT_NSOPaTNP^ZYLYOZʬ
or monitor things like printer ink levels, move
As your confidence on to Automations. These allow certain actions
and knowledge to happen based on events. For example, you
grow, you can create
more complex can have a motion sensor turn on certain
dashboards. You can
lights around the house. Check out Settings >
even incorporate
video feeds Automations and have a play.
Cool Home
Automation Ideas
Looking for inspiration for your home automation project?
Here are some incredible ideas!
H
ome automation has such a broad
scope that it is only limited by your
imagination. Most people start by
Home environment
controlling lights, but soon you can be monitoring :`]SZXP^L]PʭWWTYR`[bT_S^XL]_OPaTNP^BPNLYNZY_]ZW
LWWVTYO^ZQ_STYR^]P^[ZYOTYR_ZOTʬP]PY_TY[`_^ temperature, monitor for smoke, use motion-activated cameras and
creating scenes and more. So here are some of our more. Home Assistant adds value by allowing these devices to be
favourite types of smart devices and suggestions linked to others in a way that may not be supported out of the box.
on what you can do with them. Everything here Integrations are available for popular platforms Ring and Nest.
will work with Home Assistant.
Voice control
?SP]PL]PXLYdOTʬP]PY_aZTNPNZY_]ZW
platforms available. The most popular are
Amazon’s Alexa, Google Assistant, and
Apple’s Siri. Home Assistant has direct
support for Alexa and Google Assistant
via integrations so you can control your
devices or trigger automations by voice.
For Siri, you create a link to HomeKit and
create voice-activated short cuts. Smart lights
A starting point for most home automation
newbies. Home Assistant has support for
a wide range of lights, notably the Philips
Hue and IKEA Trådfri range. Once you have
a gateway hub in place, Home Assistant
will detect it automatically. You also get
ʭYPR]LTYPONZY_]ZWZQNZWZ`]^M]TRS_YP^^
and colour temperature.
Cool Home
Automation Ideas
»»»
Raspberry Pi Your phone
Connect sensors, switches, displays, 4Y^_LWWTYR_SPZʯNTLW3ZXP,^^T^_LY_
or simply LEDs, then use MQTT to app unlocks several cool features. If you
send and receive status messages. bT^ST_ɪ^L[]TaLNdʭ]^_XZOPWdZ`]
Home Assistant’s MQTT plug-in makes app can update your Home Assistant
adding Raspberry Pi quick and easy. The server with your location and also
`W_TXL_PʮPcTMWP^XL]_OPaTNP.SPNV (depending on the phone) other metrics
out the Remote GPIO integration for such as steps, messages received, and
codeless monitoring of inputs and output so on. Location can be used to trigger
(magpi.cc/homeassistantgpio). events, such as switching the lights on
when you’re near home.
Cars
Cars are getting cleverer too. Many newer
models feature mobile communication
allowing us to access information by app
and sometimes be able to start the car or
turn on air conditioning remotely. Many
manufacturers are supported by Home
Assistant, so you can see how your EV
charge is getting on direct from your
HA dashboard.
Introducing
MQTT
Using a message broker system
makes building your home
automation system easier and
more flexible. Here’s how it works
O
Testing the MQTT server
nce you’ve begun your home automation
journey, it’s only a matter of time before
02 Clients of an MQTT broker are either
you come across MQTT. 4_XLdL_ʭ]^_ publishers (sending data) or subscribers (receiving
^PPXLWT__WPNZYQ`^TYRLYOdZ`XLdʭYOdZ`]^PWQ data). The data streams are known as ‘topics’ and a
wondering why you need it. MQTT is a simple, broker can have any number. This way subscribers
lightweight messaging protocol whose purpose can pick just the information they are interested in.
T^_ZM]PLV_SPOT]PN_WTYV^MP_bPPYOPaTNP^BP To try it out, make sure you have the mosquitto-
NLWW_ST^ɩWZZ^PNZ`[WTYRɪBSdT^_ST^LRZZO clients package installed on your local machine and
idea? Let’s say you have a temperature sensor. By open two terminal windows. In one, run:
sending its data to the MQTT server instead of,
say, a display, this means we can have any number mosquitto_sub -h <IP address of MQTT broker>
of devices ‘listening’ to the sensor and taking -t "test"
action. The sensor’s code doesn’t need to change
if new requirements come along. Devices that send In the second, run:
information are ‘publishers’ and those listening
are ‘subscribers’. Publishers don’t care where the mosquitto_pub -h <IP address of MQTT broker>
information is going and subscribers don’t care -t "test" -m "Hello subscribers"
where it is coming from.
3LaPLWZZVL__SPʭ]^_bTYOZbdZ`^SZ`WO^PP
that the subscriber has received the message.
Make a
smart garage door
Is your garage door not pulling its weight? Add some smarts
with this home automation tutorial and take control
You’ll Need
DOWNLOAD
THE FULL CODE:
magpi.cc/garagedoorbotgit
GPT Chatbot
Use Python and OpenAI’s API to talk to a GPT-3.5
powered chatbot on your Raspberry Pi
I
K.G. n this tutorial, we’ll be creating a simple whether you access them via the web or the API.
MAKER
Orphanides chatbot interface in Python using OpenAI’s API calls are very cheap, but free credits expire
GPT-3.5 Large Language Model (LLM) to after three months.
KG is a writer, create a local interface and instructions (a
developer ‘prompt’) for a chatbot that behaves similarly to
and software
preservationist. OpenAI’s famous ChatGPT.
Keepers of the key
They’d like to see
fewer chatbot
You’ll need an OpenAI account to use the
gpt-3.5-turbo model required by this tutorial.
02 Next, we’ll generate an API key so you can
prompts about the
You’ll also need to keep Raspberry Pi connected call OpenAI’s LLM models in your own code. Go
meaning of like,
and more about to the internet as the models we’ll be using have to platform.openai.com/account/api-keys, then
adventure on the to be accessed via an API that communicates click the ‘Create new secret key’ button. After a
high seas.
with OpenAI’s servers, both because of their couple of seconds, a pop-up will appear with the
magpi.cc/owlbear proprietary nature and to give Raspberry Pi the _T_WP,;4VPdRPYP]L_PO?ST^T^dZ`]ʭ]^_LYOWL^_
extra processing power necessary to run a viable opportunity to copy the key that’s shown in the
GPT-3 chatbot. pop-up’s selectable text box. Copy it, and save it
You’ll Need
somewhere safe. We’ll be using this later. If you
> An OpenAI account do lose your key, there’s no way of recovering it,
openai.com but you can always generate a new one.
Create an OpenAI account
> Thonny 01 Go to platform.openai.com/signup and
> An internet follow the instructions to create an account.
connection
First steps
Users must be over 18. You don’t need to enter an
organisation name, but if you do, your account
03 Open a terminal and type:
Remember to note will be named after it. New users currently get
down the API keys $5 in free credits. If you use the same number pip install openai
you generate. The
encrypted notes to verify more than one account, subsequent git clone https://codeberg.org/
ǻIPHSJETEWW[SVH
manager is a
LNNZ`Y_^LQ_P]_SPʭ]^_bZYɪ_]PNPTaPQ]PPN]POT_^ MightyOwlbear/simple-chatbot-gpt-3.5-turbo
good place You’ll need credits to use any of OpenAI’s models,
This will clone our sample code and install
OpenAI’s Python library and our sample scripts. If
you’ve previously installed the openai package, put
--upgrade at the end of the pip install command
to update it.
The Thonny Python IDE comes pre-installed in
Raspberry Pi OS. If it launches in Simple mode,
click the link at the top right of the toolbar that
reads ‘Switch to regular mode’ and restart the
program. Your interactions with the chatbot will
take place in Thonny’s Shell, which is a major
convenience when tweaking your scripts. You can The messages parameter for
run them from the terminal, if you prefer. ChatCompletions in OpenAI’s gpt-3.5-
turbo API (magpi.cc/opeaichat) allows
you to send prompts – questions or
instructions – to the remote AI model
Top Tip
responses will be. Finally, we print the output
of ‘response’, which extracts the reply sent via
the API.
Remember me Mutually
07 If you want to have an ongoing conversation incompatible
with a chatbot, you’ll have to give it a memory.
The gpt-3.5-
In simple_chatbot.py, we’re doing this with
turbo and text-
Python’s append function. Every time the user davinci-003
enters a question, it’s stored in the user_input APIs don’t use
variable, formatted as a compliant message object, compatible
and appended onto the end of the messages array. syntax, so you’ll
The LLM’s responses are also added to the array. need to rewrite
your bot scripts
This means that every subsequent question can be
if you want to
answered in the context of the prior conversation switch from one
and long-term instructions can be followed. to the other.
Detailed usage stats allow you to see how much credit or
money you’re using. Paying users can set spending limits However, there are limits to this.
behaviour out of an LLM chatbot comes down to sudo apt update && sudo apt upgrade
how you word the prompts. For example, to get apt remove python3-numpy
our bot to consistently write as though it’s a pirate sudo apt install libatlas3-dev
pip install numpy
OpenAI breaks text input Run the script and click the link in Thonny’s
Shell to open a browser-based chatbot interface.
into ‘tokens’
simple-chatbot.py DOWNLOAD
THE FULL CODE:
> Language: Python magpi.cc/simplechatbotcode
001. # import the OpenAI Python library for calling the OpenAI API
002. import openai
003.
004. # Your openAI API key does here:
005. openai.api_key = "PasteYourKeyHere"
006.
007. # the model we'll be using
008. MODEL = "gpt-3.5-turbo"
009.
010. # your chatbot's name
011. botname = "Captain"
012.
013. # The initial prompt. Tell the chatbot how you want it to behave.
014. messages=[
015. {"role": "system", "content": "Present yourself as a captain from the golden
age of piracy in all subsequent responses. Use colourful language and talk like a
pirate."}
016. ]
017.
018. # we want to run some commands once when we start the program, so we'll use this
flag
019. first_run = True
020.
021. # our chat routine
022. while True:
023.
024. # Show the user instructions and introduce the chatbot by name.
025. if first_run == True:
026. print("Type exit to leave the chat. Initialising chatbot: "+str(botname)+".")
027. first_run = False
028.
029. user_input = input("You: ")
030. # exit on command
031. if user_input == 'exit':
032. exit()
033.
034. prompt = {"role": "user", "content": user_input}
035. messages.append(prompt)
036.
037. # Example OpenAI Python library request - defines the model we wish to use, and
uses the ChatCompletion routine to send a prompt.
038. response = openai.ChatCompletion.create(model=MODEL, temperature=0,
messages=messages)
039.
040. # extract and print the response
041. print(str(botname)+': '+str(response['choices'][0]['message']['content'])+'\n')
042. messages.append(response['choices'][0]['message'])
Raspberry Pi Pico
Part 03
I
nputs and outputs are the ways that a in it sometimes being high and sometimes low.
Raspberry Pi Pico can interact with the To avoid this, we need to use pull-up or pull-
Stewart
MAKER
button1.value()
Handling outputs
04 Using the GPIO ports as an output gives a Some other types of buzzers, such as a piezo Figure 1 The wiring
diagram for the quiz
OTʬP]PY_[]ZMWPX?SP2;4:[TY^NLYZYWd[]ZaTOP buzzer, need to have a rapidly changing signal, buzzers system
around 12 mA from each of the pins. This is enough which would need to be included in the code.
to pass a signal on to another device and can also The buzzer uses 25 mA, which is too much for
be used to light up a standard LED, but it cannot Pico’s GPIO pins, but within the range for the
switch large currents needed by a buzzer, high-
power LED, or many other devices.
2N7000 MOSFET. It also needs to be powered
from a 5 V power supply. This can be taken from
Top Tip
A common way of switching larger loads is with the VBUS connection on pin 40 of your Pico, MOSFET
a MOSFET transistor. which is connected to the 5 V connection on the pinouts
USB connector.
%ĜýåųåĹƋ
ak8)ϱĹ
N-channel MOSFET ʱƴåÚĜýåųåĹƋ
05 Wiring up the MOSFET ŞĜĹŅƚƋŸţĘåÏĩ
A MOSFET is a semiconductor device which
is a type of transistor. It is like a switch which
07 /TʬP]PY_8:>10?^NLYSLaPOTʬP]PY_
ƋĘåÚ±Ƌ±ŸĘååƋüŅų
ƼŅƚųak8)üŅų
is controlled by an electrical signal instead of pinouts. The 2N7000 is in a TO-92 package. With ĵŅųåÚåƋ±ĜĬŸţ
pushing it down. The MOSFET has three pins: a _SPʮL_[L]_ZQ_SP8:>10?L__SPQ]ZY__SP^Z`]NP
drain and source, which is where the main current is on the left (connected to ground), the gate is in
bTWWʮZbLYOL_ST]O[TYVYZbYL^_SPRL_PbSTNS the middle (connected to the output from the GPIO
NZY_]ZW^bSP_SP]_SP8:>10?T^_`]YPOZYZ]Zʬ pin), and the drain is on the right (connected to
For the N-channel MOSFET, if a positive voltage is the buzzer’s negative terminal).
L[[WTPO_Z_SPRL_P_SPYN`]]PY_NLYʮZbQ]ZX_SP The breadboard layout for the
drain to the source. circuit can be seen in Figure 4.
MOSFETS can be used to switch bigger loads A resistor is used between the
than integrated circuits are capable of. An example
of a MOSFET is a 2N7000, which can switch up to
200 mA. See the schematic symbol and pin layout
in Figure 3.
ʭaP8:>10?^LYOʭaP]P^T^_Z]^_ZNZY_]ZWLWW_SP
LEDs. This would also take up a lot of space on the
breadboard. An alternative is to use an integrated
circuit that combines these into a single chip. A
suitable integrated circuit is the ULN2803. This is
Figure 3 Circuit
symbol and pin actually a Darlington driver chip, which is based
layout for a 2N7000 around a bipolar transistor – see the schematic
MOSFET. The gate
acts like an electronic in Figure 5. The ULN2803 has eight Darlington
version of the button
drivers (as shown in Figure 6) and can also be
on a switch
used to replace the MOSFET for the buzzer.
GPIO pin and the gate of the MOSFET. The reason
QZ]_ST^T^_SL_bSPYL8:>10?T^ʭ]^__`]YPOZY
_SP]PNLYMPLYTYT_TLWTY]`^SN`]]PY_ʮZbTYRTY_Z
Connecting the buttons
the gate. Once the MOSFET is fully turned on, the
N`]]PY_bTWWMPaP]d^XLWW,"ŧ]P^T^_Z]]PO`NP^
10 These arcade buttons have four pins, two
the inrush current. of which are for the switch and two are for the
LED (see the datasheet or supplier information
to identify which is which). The buttons and
their LEDs have spade connectors. These can be
Making some noise
08 With the wiring complete, the buzzer can
connected using pre-made wires, or you can create
your own using a crimp tool (see magpi.cc/crimp).
be activated by setting the output of the GPIO For the arcade buttons, the switch pins should
pin high. A simple while loop can be used which be connected between the GPIO pin and ground.
detects if the button is pressed: For the LED, connect the +5 V terminal to the
5 V power supply and the ground terminal to the
if button1.value() == 0: appropriate pin on the ULN2803.
The wiring is shown in Figure 1, but the number
And if so, then turn the GPIO output pin high. of crossing wires makes it hard to see. A better
diagram is the schematic in Figure 7.
buzzer = Pin(15, Pin.OUT)
buzzer.value(1)
quiz-game.py DOWNLOAD
THE FULL CODE:
> Language: MicroPython magpi.cc/arcadebuttonsgit
A for loop is used to go through each of the pin
numbers and assign them to the buttons list for 001. ## Quiz game
the inputs and the leds list for the outputs. 002. # Detects the first to press their button
The code provided allows for the buttons to be 003. # Sounds the buzzer for 1 second and lights the
`^POTYLɩʭYRP]ZY_SPM`eeP]ɪ\`TeRLXP0LNSZQ 004. # button pressed for additional 2 seconds
the buttons’ elements are checked and, if a button 005. from machine import Pin
is pressed, then the LED is turned on and the 006. import utime
buzzer sounds. 007.
008. buzzer = Pin(15, Pin.OUT)
009. # Red, Green, Yellow, Blue, White
010. button_pins = [16, 17, 18, 19, 20]
Finishing the game
12 You can play the game with the players
011.
012.
led_pins = [6, 7, 8, 9, 10]
buttons = []
holding the switches in your hand, or you can 013. leds = []
create an enclosure to hold the circuit and 014.
mount the switches. If you have a 3D printer, 015. for i in range (0, len(button_pins)):
_SPYdZ`NLYOZbYWZLO_SP>?7ʭWPQ]ZX 016. buttons.append (Pin(button_pins[i], Pin.IN,
magpi.cc/penguinquizgame. If not, you can create Pin.PULL_UP))
your own by drilling appropriate holes into a 017. leds.append (Pin(led_pins[i], Pin.OUT))
plastic storage box. 018.
?SP]PL]POTʬP]PY_RLXP^_SL_NZ`WOMP[WLdPO 019. while (1):
by changing the code. The code included here is 020. button_pressed = False
QZ]L\`TeRLXPM`eeP]4YLOOT_TZY_SP2T_3`M 021. # check for which buttons pressed
repository also includes a reaction game. 022. for i in range (0, len(buttons)):
023. if buttons[i].value() == 0:
024. print ("Button {} pressed".format(i))
025. leds[i].value(1)
026. button_pressed = True
027. else:
028. leds[i].value(0)
029. if button_pressed:
030. # Sound buzzer for 1 second
031. buzzer.value(1)
032. utime.sleep(1)
033. buzzer.value(0)
034. # Leave LEDs on for 2 more seconds
035. utime.sleep(2)
036. # Reset all buttons
037. for i in range (0, len(buttons)):
Figure 88LIǻRMWLIHKEQIGERFIMRWXEPPIHMRXSER
enclosure. This one is 3D-printed, but you could just
038. buttons[i].value(0)
use a plastic storage box and drill holes for the buttons
Create a Bluetooth
music visualiser
Use a Pico W-powered LED matrix display as a
Bluetooth speaker with real-time visual effects
A
Flash firmware to Pico W
Phil King
s the French trio Stardust once sang,
02
MAKER
=SYGERW[MXGLIǺIGXWF]TVIWWMRK
XLIFYXXSRWSRXLIVIEVSJXLIPIJX
WMHISJXLI9RMGSVRFSEVH
DOWNLOAD
THE FULL CODE:
magpi.cc/blunicornmod
The Rainbow FFT
called NWL^^TNJʬ_NXLVPDZ`ɪWWYPPO_ZPOT__SP classic2_fft IǺIGXSRXLIWQEPPIV
NZOPTYT__ZNSLYRP_SPTY^_LYNP^ZQɩNWL^^TNJʬ_ɪ Galactic Unicorn
display, reacting to
_ZɩNWL^^TNJʬ_ɪ ?ZTYNW`OP_SPPʬPN_`YOP]WTYP!LOO% Bluetooth music
being played
include(effect/classic2_fft.cmake)
Effect additions
10 BPɪWWYPPO_ZLOO_SPYPbPʬPN__Z_SP
9ZbNWTNVɩ.ZXXT_NSLYRP^ɪ
BSPYOZYPNWTNVɩ.ZXXT_NSLYRP^ɪ
Camera Module:
Part 01
Getting Started
Getting to know Raspberry Pi Camera Module options,
setting up, and testing a camera with Raspberry Pi
I
Raspberry Pi Camera Module
n this tutorial, we’ll introduce you to the
]LYRPZQOTʬP]PY_=L^[MP]]d;TNLXP]L^LYO
01 =L^[MP]]d;Tɪ^ʭ]^_ZʯNTLWNLXP]LbL^
_LWVdZ`_S]Z`RS_SP[L]_TN`WL]QPL_`]P^LYO WL`YNSPOTYLYO[]ZO`N_TZYNPL^POTY"
David MPYPʭ_^ZQPLNSZYPBPɪWW^SZbdZ`SZb_Z L^_SP^PY^Z]ZYbSTNS_SPNLXP]LT^ML^POT^YZ
MAKER
You’ll Need
> Raspberry Pi
Raspberry Pi Camera Module 2
> Camera Module
magpi.cc/
02 =L^[MP]]d;T.LXP]L8ZO`WPbL^
cameramodule TY_]ZO`NPOTY#_Z]P[WLNP_SPZ]TRTYLW.LXP]L
> Raspberry Pi OS 8ZO`WPLYOT_NZXP^TYL^TXTWL]^XLWWQZ]X
magpi.cc/imager QLN_Z]4_ZʬP]^M]ZLOWd^TXTWL]QPL_`]P^LYO
^WTRS_WdTX[]ZaPO[P]QZ]XLYNP
.LXP]L8ZO`WPT^LY#8;[TcPWOPaTNPNL[LMWP
ZQZ`_[`__TYRTXLRP^L_LXLcTX`X]P^ZW`_TZYZQ
#![TcPW^4_T^NL[LMWPZQ`[_ZQ]LXP^
[P]^PNZYOL_LA2,]P^ZW`_TZYLYOT^ML^POZY
>ZYdɪ^48C$TXLRP^PY^Z]
7TVP_SPZ]TRTYLWNLXP]LT_`^P^LʭcPOQZN`^ Camera Modules connect
WPY^bSTNST^XLY`LWWdLOU`^_PO`^TYRL^`[[WTPO directly to Raspberry Pi
_ZZW_ZTYN]PL^P_SP]LYRPZQL[[WTNL_TZY^QZ]bSTNS boards via a ribbon cable
T_NLYMPOP[WZdPO
Raspberry Pi
03 High Quality Camera
=L^[MP]]d;T3TRS<`LWT_d.LXP]LTY_]ZO`NPO
TYT^LWL]RP]OPaTNP_SL_^`[[Z]_^ Camera Module 3
TY_P]NSLYRPLMWP.LYO.>XZ`Y_WPY^P^?SP is a high-resolution
TXLRP^PY^Z]^ST[^bT_SZ`_LYTYNW`OPOWPY^ addition to Raspberry Pi
with an autofocus lens
=L^[MP]]d;T]PNZXXPYO^LbTOPLYRWP!XX.>
and the opportunity to
XZ`Y_WPY^LYOLYL]]ZbP]ʭPWOZQaTPb!XX
capture HDR images
.XZ`Y_WPY^&MZ_SL]PWZbNZ^_LYO^`T_LMWPQZ]L
bTOP]LYRPZQ`^PNL^P^1Z]^[PNTʭNL[[WTNL_TZY^
`^P]^XLdbLY__Z^PWPN_XZ]PL[[]Z[]TL_PWPY^P^
,YLW_P]YL_TaPaP]^TZYZQ_SP3<.LXP]L_SL_
LNNP[_^8WPY^P^bL^]PWPL^POTY
?SP3TRS<`LWT_d.LXP]LQPL_`]P^L8;^PY^Z] The sensor is quite capable
ZʬP]TYRLXLcTX`X]P^ZW`_TZYZQ
[TcPW^LYOMPNL`^PZQT_^[Sd^TNLWWdWL]RP]^PY^Z] for still photography, but
^TePT_NLYMPPc[PN_PO_Z[]ZO`NP
MP__P]TXLRP\`LWT_d shines particularly for video
_SLY_SP.LXP]L
8ZO`WP4_XLVP^
recording applications
`^PZQ>ZYdɪ^48C""
TXLRP^PY^Z]LYO !%$]L_SP]_SLYL%L^[PN_]L_TZ-PNL`^PZQ_SP
T^LW^Z^`T_LMWPQZ] ^[PNTLWYL_`]PZQ_ST^^PY^Z]_SP3/=QPL_`]PT^
NL[_`]TYRaTOPZ,_ YZ_LaLTWLMWPL__SPXLcTX`X]P^ZW`_TZYM`_ZYWd
WZbP]]P^ZW`_TZY^T_ L_L]P^ZW`_TZYZQ$![TcPW^
NLY]`YL_`[_Z ?SP^PY^Z]T^\`T_P Top Tip
Q]LXP^[P]^PNZYO NL[LMWPQZ]^_TWW
[SZ_ZR]L[SdM`_ NoIR
^STYP^[L]_TN`WL]Wd
QZ]aTOPZ]PNZ]OTYR Current Camera
Raspberry Pi Camera Module 3 Module devices
04 4Y_]ZO`NPOTY_SP.LXP]L8ZO`WP
L[[WTNL_TZY^
P^[PNTLWWdbSP]P
are available
without the IR
T^LYZ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TYOZbU`^_WTVPWTMNLXP]LSPWWZOTOM`_ZYNP @YQZ]_`YL_PWdYZ_LWWaTOPZ[WLdP]^bTWW[WLd_SP
T_ɪ^]`YQZ]ʭaP^PNZYO^T_bTWWNL[_`]PLSTRS S!QZ]XL_NZ]]PN_Wd^ZbPbZ`WO]PNZXXPYO
]P^ZW`_TZY^_TWW[SZ_ZR]L[SL^L5;02ʭWPLYO_SPY `^TYRL`_TWT_dWTVPʬ[WLd?Z[WLddZ`]aTOPZʭWP
\`T_?Z`^PT_WTVP_ST^PY_P]% bT_Sʬ[WLdPY_P]%
9Z_PSZb_SP-oZ[_TZY^[PNTʭP^_SPYLXP BPɪWWWPL]YWL_P]SZb_Z^LaPOTʬP]PY_QZ]XL_^ZQ
ZQ_SPʭWP_ZbSTNS_SPTXLRPT^^LaPO?SP]PT^ aTOPZL^bPWWL^XZ]PZQWTMNLXP]LaTOɪ^LOaLYNPO
LW^Z_SP-tZ[_TZYbSTNS^[PNTʭP^SZbWZYRTY QPL_`]P^TY_SP_`_Z]TLW^_SL_QZWWZb
K
ids love to play and learn, but RFID systems are everywhere. They’re in your
playing games to practice new phone, on the packaging for your parcels, on the
skills like reading, mathematics, or food in supermarkets, in your debit card, and maybe
even simple baking is something even on the door to your office or gym. Looking at its
that parents associate with either list of applications in modern society, it’s easy to see
one-on-one interaction or with the technology as a very ‘suited and booted’ security
Dr Andrew Lewis tablet computers. It doesn’t have to be that way, and business-rooted phenomenon. It’s a technology
and while computers do have their place, it’s for stock control, security, and access control. But
Dr Andrew Lewis is a nice to present a child with a more tactile with origins that lead back to the theremin, it’s a
specialist fabricator
and maker, and is the interactive experience. In this project, you’ll see technology that deserves to be seen in projects with
owner of the Andrew how to assemble a simple game board with radio a lighter, less business-focused theme.
Lewis°>orkshop
frequency identification (RFID) readers to make a Making a simple game board isn’t rocket science.
spelling game for young children. The game uses You’ll just need a shallow box that you can use as a
letter cards and picture cards. Using the letter cards board, and some creative inspiration to decorate it.
to spell the word that matches the picture makes You could hand-cut a box from thin plywood or
the board play a simple tune (see Beep Boop box, cardboard, laser-cut one in acrylic, or even reuse
overleaf). You can also use the game to program an old pizza box. The important part of this project is
new picture cards by activating a hidden reed switch the electronics, and getting the position of the RFID
on the board. readers inside your game board correct.
Left
The Pimoroni Pico
LiPo board is a little
more expensive
than the vanilla
Raspberry Pi Pico, but
it comes with some
additional LiPo battery
management and
extra memory
YOU’LL NEED
Pimoroni
Pico LiPo
(shop.pimoroni.
com/products/
pimoroni-pico-lipo)
1 × LiPo battery
pack
(shop.pimoroni.
com/products/lipo-
battery-pack)
6 × RC522
13.56MHz RFID/
NFC module
(amazon.co.uk/
AOICRIE-RFID-
Kit-Compatible-
Raspberry/dp/
B09H6PLM1C/)
40 × 13.56MHz
RFID/NFC cards,
DATA LOADING with 1kB of
memory (also
There has been a lot of talk here about reading and writing write access. By default, these cards are usually delivered called MIFARE
RFID cards, but very little about what that actually means. with the access keys set to hex FFFF. Some card sectors cards)
(shop.pimoroni.
RFID cards come in a variety of different standards, using are safe to edit, others sectors are protected. If you try to com/products/rfid-
a number of different frequencies and protocols. This mess around with these blocks and sectors and don’t know card-10-pcs)
project uses an RC522 reader, which works at a frequency what you are doing, you can trigger security features that
of 13.56MHz and is used with classic MIFARE-type cards will ruin a card permanently. The datasheet for MIFARE ISD1820 audio
that have 1kB of memory. These are the sort of cards that Classic 1K cards (hsmag.cc/MIFARE_Classic1K) gives you record module
you find used as travel passes or printer/photocopier the full breakdown on exactly how this works and which with mic and
credit cards. The memory is arranged into 16 sectors, each areas are safe to work with, but for now, you just need speaker
(amazon.co.uk/
of which contains four blocks of 16 bytes. The first three to understand that the areas used in the project files are HALJIA-ISD1820-
blocks are data blocks that are used for storage, but the ‘safe’ to use, and if you want to start messing around with Recording-
fourth block is an access control block, which defines how other areas, you should read around the subject a little bit Playback-
the information in that sector can be accessed. Writing to before you experiment. Loudspeaker/dp/
this block incorrectly can permanently break the card. In One other thing to note is that the configuration of the B06XD96N4J/
ref=asc_df_
addition to the writeable areas, there is a 4-byte long read- MIFARE card’s memory as 16 sectors containing four
B06XD96N4J)
only ID burned into the card. This ID cannot be changed, blocks each is not actually reflected in the MicroPython
and it lets you identify a particular tag if you need to. In code. In the Python examples, the code is represented A reed switch
order to read or write information on a MIFARE card, the more simply as 64 sectors of 16 bytes. This means that the (Normally
card must be authenticated using one of two keys. The access control blocks are actually every fourth sector. The open type)
multiple keys can be programmed to allow different access sectors begin numbering at 0, so sectors 3, 7, 11, 15, 19…63
A shallow box, or
levels to the information stored on the card. As an example, are all control blocks, and writing to them accidentally a piece of wood
Key A could allow read-only access, while B would allow would most likely wreck the card. or card to use as
a game board
BEEP BOOP
Detecting cards is part of the game, but so is creating
some meaningful feedback for the user. LED lights and
buzzers are one option, but you can also use a sound
Warning! module like the ISD1820 or ISD1932 to make the game
Hot solder more distinctive. These modules allow you to record
sounds using a microphone, and play them back in part,
Soldering irons get or in full, by triggering a pin high. The exact recording
very hot, and stay hot time and number of different sounds stored will depend
for a long time after
they’re unplugged. on the version of the chip and the configuration that
Make sure that you put you’re using, but you can easily record several sounds
the iron in the stand to reward your players. One consideration with these
when you’re not using
it and don’t touch the modules is that they aren’t very loud, so you will need
metal parts – even after an amplifier if you want big sounds for your game.
it’s unplugged.
magpi.cc/soldering
Ap
pli
catio
ns
Ap
TC pli
P/I catio
P ns
Ful
ly H
ard
wir
ed TC
TO
E SWIZn
P/I
P
tac et
k
So
f
Tra tware
TCP di TC
t
/IP ion P/IP
Sta al
ck
wiznet.io
T H AT M A D E
OUT
“The Computers That Made Britain
is one of the best things I’ve read
NOW
this year. It’s an incredible story of
eccentrics and oddballs, geniuses and
madmen, and one that will have you
pining for a future that could have been.
.YѣXZYYJWQ^FXYTSNXMNSLѧ
- Stuart Turton, bestselling author
and journalist
Available on
QUICK TIP
If you’re having
problems with
the position of the
cards not triggering
an RFID reader,
you could create a
slight recess in the
board so that your
cards fit in exactly
the right place.
Left
The RC522 RFID
modules use the SPI
interface, sharing
several wires
between each board.
GPIO pin 15 serves as
a trigger that starts a
recorded celebratory
tune playing
”
inkjet paper and trim them to the exact shape of the Each issue includes a
cards once they are stuck in place. This method might huge variety of maker
You want to make at least one sound quite amateurish, but it’s a low-cost solution, and projects inside and
the results are actually quite respectable. It also makes outside of the sphere
full set of letters A–Z, it easier to peel off damaged designs and refresh of Raspberry Pi, and
the cards in future. You can also experiment with
and extras to deal with words
also has amazing
”
alternatives to paper, like synthetic felt or EVA foam. tutorials. Find out
that have double letters more at hsmag.cc.
Get fit
with
Raspberry Pi
Hack yourself together some superior smart fitness devices
ou can do pretty
66 magpi.cc ,IXǻX[MXL7EWTFIVV]5M
FEATURE
Fitness
basics
What to consider before exercising
,IXǻX[MXL7EWTFIVV]5M magpi.cc 67
FEATURE
Exercise
This works with
any old exercise
bike – and we
HScQIERSPH
bike mod
Breathe new life into that old exercise bike
magpi.cc/bikemod
68 magpi.cc ,IXǻX[MXL7EWTFIVV]5M
FEATURE
8
LIW]WXIQ
Trainer
Data analytics for your fitness
D a lot of people
were working from
home, James Wong decided
to improve his workout
[P]^PNZYO
?SPNZOPT^Z[PY^Z`]NPLYO
T^]PLOTWdLaLTWLMWPZY2T_3`M
(magpi.cc/hiitpigit5LXP^
routine. 3PLW^ZbLY_PO_Z MPWTPaP^T_^SZ`WOMPPL^TWd
NZXMTYPT_bT_SST^]P^PL]NS LOL[_LMWP_ZZ_SP]^[Z]_^Z]
TY_ZXLNSTYPWPL]YTYR bZ]VZ`__d[P^ɧdZRL^[]TYR^_Z
ZY=L^[MP]]d;T3PYNP XTYObSPYT_NZXP^_Z_]LNVTYR
NZXMTYTYR344?STRSTY_PY^T_d MZOdXP_]TN^
TY_P]aLW_]LTYTYRbT_S
=L^[MP]]d;T_Z_]LNVST^ magpi.cc/hiitpi
bZ]VZ`_LYORTaPSTX`^PQ`W
OL_LZYT_
3ZbT^dZ`]OL_L`^PO*?Z
^NZ]PdZ`]^PWQLRLTY^_Z_SP]^
8LIWIXYTMWJEMVP]
YL_`]LWWd_LVTYRLOaLY_LRPZQ WMQTPIVIUYMVMRKE
NZX[P_T_TaP^_]PLV^_ZRP_dZ` Raspberry Pi and a
(EQIVE2SHYPIƳE
TX[]ZaTYR_SPPʯNTPYNdZQ TPU really helps
SYXXLSYKL
dZ`]bZ]VZ`_,.Z]LW0ORP?;@
T^`^PO_ZLTOTY_SPXLNSTYP
WPL]YTYR[L]_TX[]ZaTYR_SP
magpi.cc/picofit
,IXǻX[MXL7EWTFIVV]5M magpi.cc 69
FEATURE
IPIGX]SYV
character and
]SYGERIZIR
JMRHWSQIWXEXW
Pi Fighter SRJMKLXW
G workout has
its upsides and
downsides. However, having
a target to beat, both in terms
^N]PPYT^`^PO_ZWP_dZ`VYZb
SZbX`NSXZ]PʭRS_TYɪdZ`ɪWW
YPPO_ZOZ
7TVPLWWRZZORLXP^_SP
of a high score and pop culture OTʬP]PY_NSL]LN_P]^TYN]PL^PTY
characters to focus on, can [ZbP]XPLYTYRdZ`ɪWWMPbZ]Y
make a workout much more Z`_Md_SP_TXPdZ`_LVPOZbY
fun. 8LVTYR`^PZQ_SPVTYOZQ _SP/L]V7Z]OZQ_SP>T_S:]
_PNSYZWZRd`^POMd4aLY/]LRZY XLdMPdZ`ɪWWYPPO_ZQLNPSTX
in Rocky IVZ]PaPY[`YNS _bTNPɧOP[PYO^SZb^_]ZYR
XLNSTYP^L_L]NLOP^ dZ`L]P
=L^[MP]]d;TLN_^L^LY
LNNPWP]ZXP_P]_ZXPL^`]P magpi.cc/pifighter
_SP[ZbP]ZQdZ`][`YNS_Z
NLWN`WL_PSZbXLYdST_[ZTY_^
3;L]P_LVPYZʬ_SPNSL]LN_P]
dZ`ɪ]PʭRS_TYRɧTY^ZXPNL^P^
_ST^XPLY^7`VP>VdbLWVP]
&TVSTIVTYRGLMRK
bag will be
RIIHIHMJ]SY
really want to
go at it
Simple entertainment
Some very modern treadmills have built-in screens so you
ϱĹƵ±ƋÏĘŸƋƚýĜĹƋĘåčƼĵţåűƴåĹŅƋŸååĹƋĘåĵ
everywhere yet though so, with a simple
Kodi-powered Raspberry Pi tablet,
you can take your media anywhere
ƋŅƵ±ƋÏĘƵĘĜĬåƼŅƚģŅčŅųÏƼÏĬåţå
recommend using a SmartiPi Touch 2
to build it:
magpi.cc/smartipi2
70 magpi.cc ,IXǻX[MXL7EWTFIVV]5M
FEATURE
The Balance
scales
An encouraging weight tracker for those who need it
W revolution for
ʭ_YP^^aTOPZ
games, spawning loads of
motion-controlled workouts. 4Q
NZYYPN_^aTL-W`P_ZZ_SX`NS
WTVPBTTXZ_P^LW_SZ`RSdZ`ɪWW
YPPOLMT_ZQN`^_ZXNZOP_Z
VPP[T_[LT]PO[P]XLYPY_Wdɧ
dZ`OZYɪ_]PLWWdWTVP_Z`^PdZ`] TYNW`OPObT_S_SP]P^_ZQ_SP
-LWLYNP-ZL]OX`NSLYdXZ]P NZOPQZ]_ST^[]ZUPN_4_OZP^
The scales text dZ`NLYSLNVT__ZMPL[LT]ZQ ]P\`T]PdZ`_Z[]P^^LM`__ZY
]SYYTHEXIWSR
^XL]_^NLWP^`^TYRL=L^[MP]]d `YOP]YPL_S_SP-LWLYNP-ZL]O
]SYVTVSKVIWW[MXL
IRGSYVEKMRKQIWWEKIW ;TLYOL[PYNTW _SZ`RSLNSTPaPOMd_SP[PYNTW
bPXPY_TZYPOMPQZ]PɧL
^TX[WP^ZW`_TZY_SL_bZYɪ_YPPO
X`NSXLTY_PYLYNP
:YNPdZ`^_P[ZYT_
XPL^`]PXPY_^L]P_LVPY_Z
N]PL_PLYLaP]LRPO`P_Z
PWPN_]ZYTNYZT^PLYOT__SPY
^PYO^_SPTYQZ_ZLY4Z?^P]aTNP
NLWWPO4YT_TLW>_L_PbSTNSOZP^
_SP_]LNVTYR4_LW^Z^PYO^dZ`
_Pc_^_ZWP_dZ`VYZbdZ`]
[]ZR]P^^TYNW`OTYRPYNZ`]LRTYR
XP^^LRP^L^bPWW
magpi.cc/95
,IXǻX[MXL7EWTFIVV]5M magpi.cc 71
REVIEW
Compute Blade
Compute Blade computeblade.com £54 / $65
SPECS
INPUT/
OUTPUT: Putting Raspberry Pi Compute Module onto a blade for a
Gigabit
Ethernet, low-cost and energy-efficient alternative to a rack-based
USB-A, USB-C,
HDMI, UART, server. Lucy Hattersley weighs up the benefits
Compute
blade headers,
C
microSD card ompute Blade is a fascinating product There are security advantages to separating
slot, hardware
developed by Ivan Kuleshov at Uptime Lab ^P]aTNP^aTLMWLOP^L^T_]PO`NP^_SP^`]QLNPL]PL
switchable
Wi-Fi, BT, and (uplab.pro) that puts a Compute Module in for a hacker to gain access to the system. To this
EEPROM write- a rack-mountable carrier board to create a high- PYO.ZX[`_P-WLOPNLYQPL_`]PL?;8NST[
protection density server for industrial or home use. (Trusted Platform Module) to store cryptographic
Blade servers are the current type of format keys and encrypt your date.
SUPPORT:
Raspberry popular amongst server systems. A traditional ,MZaPLWW_SZ`RSMWLOP^P]aP]^L]PXZ]P
Pi Compute rack-mounted server houses a single computer PYP]RdPʯNTPY__SLY_]LOT_TZYLW^P]aP]^
Module 4, inside a wide chassis (like a tray). Thanks to its Energy costs are always important for server
NVMe SSD
^XLWWQZZ_[]TY_dZ`NLYʭ_`[_Z.ZX[`_P TYQ]L^_]`N_`]PLYO_ST^SL^ZYWdMPNZXPXZ]PZQ
up to 22100,
TPM 2.0 Blade devices into a rack space. an issue recently with higher energy costs. The
.ZX[`_P-WLOP[`_^LWWZQ_SPNZX[ZYPY_^ ,]XNST[^QZ`YOZY=L^[MP]]d;TNZX[`_P]^L]P
POWER: ^_Z]LRP=,8LYONZX[`_P]ZYL^TYRWP;.-4Y XZ]PPYP]RdPʯNTPY__SLY_SPT]]TaLW^
Power over
_SPNL^PZQ.ZX[`_P-WLOPT_`^P^L=L^[MP]]d;T There’s a lot here that’s interesting and we’re
Ethernet
IEEE 802.3at .ZX[`_P8ZO`WPL^_SPXLTYNZX[`_P] OPWTRS_PO_SL_4aLY6`WP^SZa]LT^POZaP]LXTWWTZY
(PoE+) up to DZ`NLYLW^ZOPOTNL_PPLNSMWLOP_ZL^[PNTʭN P`]Z^ZY6TNV^_L]_P]_ZM]TYR_SP[]ZUPN__ZWTQP
30 W (normal _L^V%bPM^P]aTYRʭWP^P]aTYRPXLTW^`[[Z]_ 4aLY^PY_`^_bZ.ZX[`_P-WLOP/PaMZL]O^LQLY
operation
aT]_`LWT^L_TZYLYO^ZZY>Z_LVTYRZYP_L^VZʰTYP LYOLQZ`]MZL]OPYNWZ^`]PQZ]_P^_TYR
2–8 W)
for maintenance leaves the rest up and running.
Check it Blade
.ZX[`_P-WLOPT^L^TYRWP;.-_SL_NLY
SZ`^PL=L^[MP]]d;T.ZX[`_P8ZO`WP
(magpi.cc/computemodule?ST^]LNVXZ`Y_LMWP
;.-XPL^`]P^ XX XX" XXbT_S
=L^[MP]]d;T.ZX[`_P8ZO`WPNZYYPN_Z]^LYO
PoE (Power over Ethernet), so you can power and
_]LY^QP]OL_LQ]ZXL^TYRWP0_SP]YP_NLMWP
BP`^POL?;7TYV?7;Z0 >QZ]^P_`[
testing (magpi.cc/poeinjectorLYOʭ__PO_SP_bZ
.ZX[`_P-WLOPMZL]O^_Z_SPXLTY=L^[MP]]d;T
]LNV^P]aP],WZYR^TOP0_SP]YP_^T_L@>-.LYO
@>-,[Z]_bT_SL^bT_NS_ZXZaPMP_bPPY_SP
The two Compute _bZLY3/84[Z]_@,=??;8XTN]Z>/NL]O
Blade boards we had in
[Z]_88VPdQZ]LY9A8P>>/`[_Z
for testing mounted in
our server rack space LYOLQLY`YT_NZYYPN_Z]?SP/Pa`YT_bP_P^_PO
^P]aP]LOXTYT^_]L_Z]OZbT_SL]LNVZQ.ZX[`_P
QPL_`]P^LYLYZOTePOSPL_^TYV^PN`]PObT_S?"SPc -WLOP^*4_bZ`WOXLVPLR]PL_NW`^_P]NZX[`_P] Verdict
^N]Pb^>_]P^^_P^_TYR]PXLTYPOMPWZb! {. QZ]_P^_TYRLYOPc[P]TXPY_L_TZY]`YYTYRdZ`]
?SP]PL]P70/^QZ]>>/;ZbP]LYO,N_TaT_d ZbY^XLWW^P]aP]PYLMWP^dZ`_ZOP[WZd[P]^ZYLW Compute Blade is
a wonderful piece
_SP^PNLYMPOT^LMWPOTY^ZQ_bL]PLYOL cloud services (much more privacy), or it could
of design that
[]ZR]LXXLMWP0ORP-`__ZYZY_SPQ]ZY_[LYPW XLVPLR]PL_;TSZWPLOMWZNVP]LOOT_TZY_ZdZ`]
combines the low-
?ST^M`__ZYLN_^L^L[`WW_LMLYONLYMPNWTNVPO YP_bZ]VDZ`NZ`WOLW^ZOP[WZdL=L^[MP]]d;TTY cost availability of
bSTWP_SPMWLOPT^XZ`Y_POTYLNSL^^T^DZ`NZ`WO _SPSZXPZYdZ`]YP_bZ]VQZ]LYdLaLTWLMWPNZOTYR Compute Module
`^PT__Z[P]QZ]XL]P^_L]_QZ]PcLX[WPZ]N`^_ZX or scripting tasks you want. We set ours up as a with storage,
^N]T[_T_T^NZYYPN_PO_Z2;4: N`^_ZX2;?NSL_MZ__SL_bPNLYWZRTY_ZLYd_TXP PoE networking,
?S]PPXZOPW^L]PLaLTWLMWP%-L^TN?;8 bT_SZ`_OP[PYOTYRZY_SP:[PY,4bPM^T_P and a blade
format. Perfect for
LYO/PabSTNSbPL]P_P^_TYRSP]P?SP .ZX[`_P-WLOPXZ]P_SLYOZ`MWPOT_^
building your Arm
.ZX[`_P-WLOP/ZN`XPY_L_TZYbPM^T_PSL^ 6TNV^_L]_P]Q`YOTYRLYO_SPPYO]P^`W_T^[]P__d cluster or
XZ]PTYQZ]XL_TZYZY_SPaL]dTYR^[PNTʭNL_TZY^ bPWWM`TW_Q]ZXZ`]_P^_TYRLYOOPXLYOT^ server solution.
10
(docs.computeblade.com?SP6TNV^_L]_P] NP]_LTYWdZ`__SP]P4QdZ`L]PWZZVTYR_ZM`TWOLY
NLX[LTRYZʬP]POYZOPNW`^_P]NL^P^TYNS ,]XML^PO^P]aP]_ST^T^Z`]]PNZXXPYOL_TZY
/10
]LNVNW`^_P]^LYO$TYNS]LNVNW`^_P]^bSTNSdZ` and we think it’s a neat product to have on your
NLY/[]TY_QZ]dZ`]]LNV home network.
A
protoboard area,
reset button imed mainly at STEM educators, as well with Grove connectors (ten supplied). The beauty
as makers in general, PicoBricks is a of this is that they can subsequently be reused
CONNECTIONS: project development kit based around ^P[L]L_PWdQZ]Z_SP][]ZUPN_^ZYNPdZ`ɪaPʭYT^SPO
20 × Grove
connectors, 2 × Raspberry Pi Pico. going through the ones in the PicoBricks e-book.
20-pin breakout ,^^`NST_NZXP^^`[[WTPObT_SL^_LYOL]O
headers, battery Raspberry Pi Pico board already slotted into Electronic learning
connector headers in the middle of the kit. This is The 234-page e-book takes learners through 25
EXTRAS: surrounded by ten assorted modules (the ‘bricks’) electronics projects of increasing complexity,
10 × Grove cables, including sensors, LEDs, potentiometer, motor from blinking an LED to setting up a mini smart
10 × male-male driver, relay, and a mini OLED display (see ‘The greenhouse. Each project features an introductory
jumper wires,
bricks’ box for details). explanation, wiring diagram, and step-by-step
micro-USB to
USB cable, two- There’s also a protoboard area, rather than a programming guide using the MicroBlocks visual
piece wooden breadboard (so the holes aren’t already connected programming system (microblocks.fun), akin
stand, battery in rows), although a mini breadboard is also to Scratch, which can be run on any type of
holder (2×AAA), ^`[[WTPO,YZ_SP]YTNP_Z`NST^_SPML__P]d connected computer – either in the browser or
mini breadboard
NZYYPN_Z]QZ]_SP^`[[WTPO,,,ML__P]dSZWOP] `^TYRLYZʰTYPL[[,;TNZ-]TNV^WTM]L]dNLYMP
so you can power the kit away from a computer. installed via its menus.
4Y_P]P^_TYRWd_SP_PYXZO`WP^L]PLW]PLOd ,W_P]YL_TaP[]ZUPN_NZOPT^LW^Z[]ZaTOPOTY_SP
NZYYPN_PO_Z;TNZɪ^2;4:[TY^aTLLQ]LXPbT_S PMZZVTY8TN]Z;d_SZYLYO,]O`TYZ4/0..
solder joints. So, you can use them all straight form, albeit without any explanation as to how it
away without having to do any wiring. works. There are also links to the code, although
,W_P]YL_TaPWddZ`NLY^YL[_SPXZO`WP^ T_^ZXP_TXP^OTʬP]^^WTRS_WdQ]ZXbSL_ɪ^TY
ZʬLYObT]P_SPX_Z;TNZ the book.
There are some fun and interesting
8
Missing components
Perhaps the biggest
/10
downside is that around
half of the projects in the
;TNZ-]TNV^4Z?XZO`WPdZ`NZ`WOLWbLd^]P[WLNP LI5MGS'VMGOWOMXWEVI
8
the kit’s removable Raspberry Pi Pico with a EMQIHQEMRP]
EXIHYGEXSVWFYX
Pico W. Either way, once you’ve learnt the basics, GERFIYWIHJSV
LSQIPIEVRMRK
_SP]Pɪ^_SP[Z_PY_TLW_ZPc[P]TXPY_bT_S4Z?
projects not fully explored in the e-book.
The bricks
The PicoBricks kit features ten 3. LED & BUTTON 7. IOT BOARD
7IH1*)ERHTYWLFYXXSR Connections for optional ESP8266
electronics modules that can ;M+MERH-('PYIXSSXLQSHYPIW
used in situ or snapped off 4. TEMPERATURE & HUMIDITY
SENSOR 8. BUZZER
XERHEVH)-8WIRWSV Active piezo buzzer for making
1. 0.96-INCH OLED WMQTPIcWSYRHW
128×64 monochrome display to 5. RELAY
show text, sensor readings, and Relay switch with two terminal 9. LIGHT SENSOR
WMQTPIcKVETLMGW FPSGOcGSRRIGXMSRW Light-dependent resistor (LDR) for
HIXIGXMRKPMKLXPIZIPW
2. RGB LED 6. MOTOR DRIVER
Addressable WS2812 RGB multicolour Dual H-bridge for connecting two 10. POTENTIOMETER
1*)[MXLSYXTYXGSRRIGXSV )(QSXSVWSVcWIVZSW :EVMEFPIVIWMWXSV[MXLVSXEV]ORSF
10 Amazing:
Browsers
The best ways to surf the web Tor
on Raspberry Pi
Ultimate privacy
T
FüƼŅƚĹååÚƋŅÆųŅƵŸåƵĜƋĘÏŅĵŞĬåƋåÏŅĹĀÚåĹÏåŅüƼŅƚų±ĹŅĹƼĵĜƋƼØŅų
here are many, many browsers available on every ųŅƵŸåųƚŸåŸƋĘåŅųĹåƋƵŅųĩƋұĹŅĹƼĵĜŸåƼŅƚųĬŅϱƋĜŅűĹÚF{ţ
kind of operating system, and Raspberry Pi and
T_^:>T^YZOTʬP]PY_ We’ve got the lowdown on torproject.org
ten of the best browsers you can use on Raspberry Pi,
whether you’re using Raspberry Pi as a desktop, or for a
fun project.
Firefox
Open-source darling
ĘåÆųŅƵŸåųƋʱƋŸƋ±ųƋåÚƋĘåčųå±Ƌ
ĵŅƴå±Ƶ±ƼüųŅĵFĹƋåųĹåƋ)ƻŞĬŅųåų
has a special version for Raspberry
{ĜƋʱƋĜĹÏĬƚÚåŸĵ±ĹƼŅüƋĘå
ĹŅųĵ±ĬƴåųŸĜŅĹűŸüå±ƋƚųåŸţ
ܪWJKT]HTR
Luakit
Chromium Fast and customisable
åųƼŧƚĜÏĩ±ĹÚƴåųƼÏŅĹĀčƚų±ÆĬåØ
Default browsing
Xƚ±ĩĜƋĜŸ±ÆĜƋŅü±ĵĜĹĜĵ±ĬĜŸƋ
It’s the browser you have installed on Raspberry Pi OS by default! It’s browser that power users
ƴåųƼŸŅĬĜÚ±ĹÚʱŸŸŞåÏĜĀÏŅŞƋĜĵĜŸ±ƋĜŅĹŸüŅų±ŸŞÆåųųƼ{Ĝkţ ĵ±ƼŞųåüåųţ
chromium.org luakit.github.io
Browsers magpi.cc 77
RESOURCES
Midori
Lightweight excellence
aĜÚŅųĜĜŸ±ƴåĹåų±ÆĬåĬĜčĘƋƵåĜčĘƋÆųŅƵŸåų±ĬƋåųűƋĜƴåƵĘĜÏĘĹŅƵʱŸåƻƋų± Vivaldi
ŸåÏƚųĜƋƼ±ĹÚ±čųå±ƋeĹÚųŅĜÚŸŞĜĹěŅýţ
Opera reborn
magpi.cc/midori
eĵƚÏĘĹåƵåųÆųŅƵŸåųƋʱƋųåϱŞƋƚųåŸĵ±ĹƼŅüƋĘåüƚĹÏƋĜŅĹŸŅü
ŅĬÚåųkŞåų±ÆųŅƵŸåųŸţFƋűŸĵŅŸƋĬƼŅŞåĹěŸŅƚųÏåƋŅŅţ
Lynx vivaldi.com
dillo.org
5YǽR(PSYH1IEVRMRK
Kweb
Cloud rendering
Kiosk web browsing
ĘĜŸƚĹĜŧƚåÆųŅƵŸåųųåĹÚåųŸÏŅĹƋåĹƋŅĹåĹÏųƼŞƋåÚÏĬŅƚÚŸåųƴåųŸƵĘĜÏĘ
±ųåƋĘåĹŸƋųå±ĵåÚƋŅƋĘåƵ寯ųŅƵŸåųţFƋÏ±ĹÆåĵƚÏĘü±ŸƋåųƋʱŠeűĬƋåųűƋĜƴåƋŅƋĘåÚåü±ƚĬƋÆųŅƵŸåųƋŅƋƚųűŸŞÆåųųƼ{ĜĜĹƋұƵåÆ
ųåčƚĬ±ųÆųŅƵŸåųŸţ ĩĜŅŸĩØŞåųüåÏƋüŅųŞƚÆĬĜÏŞĬ±ÏåŸţ
UZKܪSHTR magpi.cc/kweb
78 magpi.cc Browsers
English not your
mother tongue?
The MagPi is also available in German!
BUILD A RASPBERRY PI
MEDIA PLAYER
Power up your TV and music system
magpi.cc/mediaplayer
RESOURCES
Sense HAT
Raspberry Pi The Raspberry Pi Sense to send Raspberry Pi
AUTHOR
Projects
RASPBERRY PI SENSE marble (in the guise of coloured
Movement and LED-based HAT PONG LEDs) is travelling in this tricky maze
Paying homage to the original puzzle. Have fun following the setup
projects to try for yourself computer game, this walkthrough guide, before setting a timer and
on how combine a Sense HAT and challenging your friends to escape
Raspberry Pi, plus some Python the maze in the fastest time.
code to create classic Pong, is magpi.cc/sensehatmarble
bound to appeal to retro gamers.
There’s even a link to a video of the NIGHT CLOCK
original game being played on Lorna Jane’s tutorial shows you how
an oscilloscope. the LED matrix can be used as a
magpi.cc/sensehatpong useful and quirky display that can be
used as an at-a-glance bedside time
SENSE HAT MARBLE MAZE check, without having to turn on the
Orientation sensors on the Sense light or phone display.
HAT detect which way the virtual magpi.cc/sensehatnightclock
Raspberry Pi YouTube
Sense HAT Videos
Raspberry Pi Now we’ve whetted your Easy setup guides
AUTHOR
will walk you through some of including C++ as well as and provides a video tutorial
Price: the more advanced aspects of Scratch and Python. Each of that follows the instructions
free
Sense HAT and how to use this the sensors (gyroscope and and code on the Raspberry
magpi.cc/sensehatdocs
Raspberry Pi accessory with magnetometer and barometric Pi website. It’s ideal viewing
pressure sensor among them) is MJ]SY[ERXXSXEOI]SYVǻVWX
covered, along with calibration steps into using HATs. Ellora
for the magnetometer and also has plenty of other useful
LNNPWP]ZXP_P]?SPZʯNTLW Raspberry Pi YouTube guides.
documentation also covered magpi.cc/sensehatej
reading and writing the EEPROM
data. Also take a look at the
corresponding Sense HAT THE RASPBERRY PI
Python documentation, linked to SENSE HAT IS AWESOME!
Q]ZX_SPZʯNTLWOZN`XPY_L_TZY ETA Prime takes you through
3P]PdZ`bTWWʭYO;d_SZY,;4 the LED matrix and all the
examples and the Sense HAT sensors, focusing on the parts
API reference guide, ideal for all and capabilities of Raspberry
your coding needs: Pi Sense HAT.
magpi.cc/sensehatAPI. magpi.cc/sensehateta
RASPBERRY PI 2 ND E D I T I O N
Retro Gaming with Raspberry Pi shows you how to set up a
Raspberry Pi to play classic games. Build your own games console
or full-size arcade cabinet, install emulation software and download
classic arcade games with our step-by-step guides. Want to make
games? Learn how to code your own with Python and Pygame Zero.
BUY ONLINE:
magpi.cc/store
INTERVIEW
Brian
Jepson
A long-time programmer, maker, and tinkerer,
meet the new publishing director for Raspberry Pi
“
I
grew up in the smallest maker interests ended up getting
state in the US (Rhode pushed to the side as I spent
Island) during the golden more time with computers.
age of Radio Shack,” Brian Immediately preceding my
Jepson tells us. He’s the new time at university, and really
publishing director here at throughout my life, I fell in with
Raspberry Pi Towers, but he’s an an unjuried, uncensored arts
old hand at making. organisation (as220.org) that
“I’ve been a lot of things over very much embraces the DIY
the years, but if we go back spirit. In those years, I made
to the beginning, I’d say I’m zines, posters, performance art,
a computer programmer and but very little visual art outside
tinkerer,” Brian continues. “I of printed works. I went away
got my start programming on a to New York for a few years,
somewhat customised Atari 400 came back, and stayed involved
with Atari BASIC, Forth, and a with AS220 as a volunteer and
smattering of 6502 assembler. I occasional board member.
kept up with that kind of thing Over time, AS220 itself has
over the years, and ended up grown a lot, and now operates
programming for a time, then three mixed-use buildings
writing, and eventually editing in downtown Providence, RI,
and publishing, but always supporting everything from
with a dash of programming on live-work studios to a vibrant
the side.” youth program.
His previous work in In the past several years, I’ve
publishing includes O’Reilly become involved in the Rhode
Media and Make Magazine – he Island Computer Museum, which
even helped run a Maker Faire in has allowed me to fuse my
his native Rhode Island. interest in computers (especially
old computers) with making.
What is your history
with making? Where did you learn about
I had one of those 150-in-1 Raspberry Pi?
project kits where you connected Raspberry Pi was such big news
wires using spring terminals. when it launched that a better
I was terrible with a soldering question would be ‘where didn’t
Brian helps out at the Rhode Island Computer Museum iron until I was much older. My I learn about Raspberry Pi’?
A custom
Raspberry Pi
MIDI synthesizer
Working on the Make books Pi with mt32-pi, which turns with Atari STs. In addition to
portfolio at the time meant this a Raspberry Pi into a MIDI the many games that use MIDI,
was huge news. We managed synthesizer that works just like there are many music apps for
to get a book out by January the Roland MT-32, and various the Atari ST that work with
2013, co-written by Raspberry General MIDI synthesizers that MIDI, such as Steinberg Cubase
Pi’s own Matt Richardson, as can be used with old games and and C-Lab Notator. Many of
well as Shawn Wallace. Shawn other software. I have built two these old music apps hold up
is a fellow Rhode Island maker/ mt32-pi boards and use them pretty well to this day.
artist who has been part of
my adventures going back to
the campus daily and literary I rely heavily on Raspberry Pi to keep
magazine, through AS220 (where
he was the founding director of old computers up and running
the Providence Fab Lab), and
into nearly every Rhode Island
maker event I’ve been part of.
01
MagPi
Monday
03
02
E
very Monday we ask the question: have you
made something with a Raspberry Pi over
the weekend? Every Monday, our followers
send us amazing photos and videos of the things
they’ve made.
Here’s a selection of some of the awesome
things we got sent this month – and remember to
follow along at the hashtag #MagPiMonday!
#MonthOfMaking
Y’all got making online in March. Here’s some of the cool stuff we saw
03
07
04
06
05
#monthofmaking magpi.cc 87
THIS MONTH IN RASPBERRY PI
Events in pictures
Community and official events in the wild
T ABOUT
N EX T
his month, a Raspberry Pi pop-up store
D O U T A ND
opened in Southampton, and we went along FI N EV EN TS
N T H ’S
to see just how it went down. According to
MO ON
_SP^SZ[^_LʬOTʬP]PY_L]PL^_PYO_ZM`dOTʬP]PY_ POP-UP
92
kinds of products at the pop-ups, with Raspberry
Pi 400 kits and Debuggers going down very well. PAGE
Cheap Oscilloscope
Internet/Local Network
Ed Mikkelsen emailed us about this cool project. “I wanted to
build my own oscilloscope with inexpensive parts, and do my own
Monitoring Service
ŞųŅčų±ĵĵĜĹčţF±ĬŸŅƵ±ĹƋåÚƋŅŸååĘŅƵü±ŸƋFÏŅƚĬÚĵ±ĩåĜƋţFĀųŸƋ
programmed the oscilloscope in C++ using GTK for the graphics and A great network monitoring setup was sent to us by John Loop, which
achieved a conversion rate of 8 usec. I also programmed it Python with he described as such: “Completely self-contained performance
a considerably slower conversion rate because Python is a scripting monitoring setup. Does not rely on third party servers. GREAT use
language. With C++ I have also added a second trace, zero crossing for an older Raspberry Pi 3B/3B+ lying around. All it requires is
detection, and automatic refreshing. All in all, loads of fun.” downloading the image and burning an SD card. Comes up running.”
magpi.cc/github129 magpi.cc/imonitorg
Together we can
make a difference
Give young people the opportunity
to learn about technology
Your
Letters
Readall solution
In the latest The MagPi correspondence, Marian asked “you could print articles on the
following: gpio readall - the installation of and usage of as a means of checking the status of
inputs and outputs.”
When WiringPi was deprecated, I wrote a Python replacement for gpio readall. I have since
written versions for many of the popular libraries (including my own pi_gpio).
This has the advantage of displaying the ACTUAL programmed GPIO function (if changed)
and pulls (on Raspberry Pi 4).
I have been playing recently with the gpiochip interface (included in recent kernels) and
realised that the raspi-gpio debug tool actually has all the details needed. raspi-gpio
should be included in all recent Raspberry Pi OS, but if not you can install raspi-gpio from
the repository.
This version of my program (which I call gpioreadall)
reformats the output of raspi-gpio into a user-friendly
format, similar to the WiringPi gpio readall.
This produces output identical to Figure 1, but is
independent of any other libraries/daemons.
The code can be downloaded from here:
magpi.cc/gpioreadall.
Figure 1: An example of
how the script displays
GPIO readings
FREE
RASPBERRY PI
PICO W
If you miss stock of a particular product on one day,
the pop-ups try and restock the following day!
Contact us!
>
>
Twitter
Facebook
@TheMagPi
magpi.cc/facebook
Subscribe online:
>
>
Email
Online
magpi@raspberrypi.com
forums.raspberrypi.com
magpi.cc/subscribe
Price is charged at £35 sterling. The dollar price will depend on the exchange rate. Six issues and free
Pico W for £35 is also available in Canada and Europe. Subscription is for the next six issues and does
not renew 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…
01. Exeter Pi Jam 03. Cornwall
Saturday 6 May Tech Jam
Exeter Central Library, Saturday 20 May
Exeter, UK FibreHub, Pool, UK
magpi.cc/exeterjam129 magpi.cc/ctm129
First Saturday of every month, Cornwall Tech Jams
a group of enthusiasts of all are run by volunteers
ages bring their projects or working in IT and education throughout Cornwall. They
just come along to make, are supported by Software Cornwall, its members, and
learn, and talk. There is a range of equipment for people other local businesses. Our volunteers give their own time
to try or use to work though projects. Come and see, and and expertise to plan each Cornwall Tech Jam and to the
have a chat. regular maintenance of all our equipment.
FULL CALENDAR
02. Melbourne Raspberry Pi Meetup 04. Hybrid Raspberry Pint Get a full list of upcoming
Sunday 7 May Tuesday 30 May ÏŅĵĵƚĹĜƋƼåƴåĹƋŸƤĘåųå×
RASPBERRY PI 02
STORE POP-UP
9JGTGECP[QWƓPF
Raspberry Pi next?
> Next location Raspberry Pi Store pop-up Birmingham
> Where Bull Ring, Birmingham, UK
> When Friday 28 May and Saturday 29 May
A
t this Raspberry Pi Store pop-
up in Birmingham, you can
experience and buy Raspberry
04 Pi products. Explore some of the things
you can do with a Raspberry Pi, discover
our accessories and books, and get your
magpi.cc/popup2023bham
SAVE UP
TO
ISSUE #66
OUT NOW
hsmag.cc
COMPETITION
Competition magpi.cc 95
AN INTRODUCTION TO
&
PROGRAMMING
All you need to know
to write simple
programs in C and
start creating GUIs
Inside:
QCreate simple command-line C programs
Q.ZY_]ZWʮZbbT_SNZYOT_TZY^LYOWZZ[^
Q3LYOWPaL]TLMWP^^_]TYR^LYOʭWP^
Q/P^TRYR]L[STNLW`^P]TY_P]QLNP
applications in C
Q3LYOWP`^P]TY[`_bT_SM`__ZY^LYOXPY`^
Q@^PLOaLYNPO@4QPL_`]P^^`NSL^OL_L
AL
lucy@raspberrypi.com
u
n a
Li m
Features Editor
Co
m
CI Rob Zwetsloot
E
rob@raspberrypi.com
e
Th
SP
Sub Editor
Nicola King
ADVERTISING
Charlotte Milligan
charlotte.milligan@raspberrypi.com
+44 (0)7725 368887
DESIGN
criticalmedia.co.uk
Head of Design
Lee Allen
Designers
Olivia Mitchell, Sam Ribbits
Illustrator
Sam Alder
!
CONTRIBUTORS
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
with Raspberry Pi
+44 (0)207 429 4000
SUBSCRIPTIONS
Unit 6 The Enterprise Centre
Kelvin Lane, Manor Royal,
Crawley, West Sussex, RH10 9PE
+44 (0)1293 312193
magpi.cc/subscribe
Move to an magpi.cc/subscribe
Raspberry Pi Ltd, Maurice Wilkes Building,
St. John’s Innovation Park, Cowley Road,
Taking a break
Resting can be important, even when it comes
to making, says Rob Zwetsloot
T
his issue, I wrote a feature times when a bit of engineering and/ they’re a little harder to do anyway.
LMZ`_RP__TYRʭ_bT_S or code have stumped me until It means I’m doing them much
Raspberry Pi and it reminded I looked at it with fresh eyes the less though.
XPZQ_SPʭ_YP^^NZYNP[_ZQSZb next morning.
]P^_T^P\`LWWdTX[Z]_LY_L^LN_`LWWd 0aPYb]T_TYR^_`ʬQZ]_SPXLRLeTYP On hiatus
working out. In terms of your body, NLYMPYPʭ_Q]ZXLM]PLV>ZXP_TXP^ As well as short breaks, sometimes
exercising depletes you of resources an angle or a subject isn’t quite dZ`YPPO_ZU`^__LVP_TXPZʬL
LYOOLXLRP^X`^NWPʭM]P^ɧ]P^_TYR making sense and that little bit of hobby. Burnout is very real, whether
allows you to get your energy back, time apart helps focus my thoughts. it’s with work or with something
and for the muscles to repair And in terms of focus, the Pomodoro you’re doing for fun, and you don’t
stronger than before. method of 30 minutes of work with a want to ruin your relationship with
On a basic level, making sure to ʭaPXTY`_PM]PLVLW^Z]PLWWdSPW[^ your favourite hobby because you
take breaks while making can be a forced yourself to keep doing
safety precaution. Nobody should be something. When taking breaks from
soldering while they can barely stay
awake, after all. More importantly,
As well as short one hobby in the past, I’ve focussed
on another hobby instead. Flexing a
sometimes you need to put some breaks, sometimes OTʬP]PY_[L]_ZQdZ`]XTYOLYOZ]
space between yourself and a project skill set is always good for growth
to allow your brain to rest. you need to just ɧLYONLYPaPYLTOdZ`TYZ_SP]
Constantly hitting it against a hobbies. Although, sometimes, you
problem you’re having is hardly a take time off a have that con crunch and need to get
good way to solve it.
hobby. Burnout is your prop working by any means
necessary. Just make sure not to do
Sleep on it very real any soldering in the hotel room; I
I once read a (possibly apocryphal) speak from experience. It’s not a very
story about how a scientist fell asleep suitable space.
bSTWP_]dTYR_ZʭR`]PZ`_SZb_SPd me. We had a project about making
RZ_^ZXP^[PNTʭN]P^`W_^ɧbSTWP your own Pomodoro timer in issue
Rob Zwetsloot
AUTHOR
myself, but there have been plenty of feel, although as I near my fourties, magpi.cc
"DPTUFŗFDUJWFTPMVUJPOGPSEBUBDFOUFST
*5EFQBSUNFOUTPSSFNPUFNBDIJOFT
1J,7.)"5
GPS%*:BOEDVTUPNQSPKFDUT 1SF"TTFNCMFEWFSTJPO
3FBMUJNFDMPDLXJUISFDIBSHFBCMFTVQFSDBQBDJUPS0-&%%JTQMBZ#PPUBCMFWJSUVBM$%30.
ŚBTIESJWF4FSJBMDPOTPMF0QFOTPVSDF"1*JOUFHSBUJPO0QFOTPVSDFTPGUXBSF
$YDLODEOHDWWKHPDLQ5DVSEHUU\3LUHVHOOHUV
3FTFMMFSTVHHFTUJPOTBOEJORVJSJFT
XIPMFTBMF!IJQJJP