0% found this document useful (0 votes)
221 views100 pages

Mag Pi 136

The document is the December 2023 issue of The MagPi magazine. It features coverage of the new Raspberry Pi 5 including in-depth guides on overclocking and benchmarking it. It also includes several project ideas for the holiday season, such as robots, weather stations, and retro gaming builds. The issue highlights an interview with a maker who created a retro radio using a Raspberry Pi inside an old valve radio housing to inspire kids to learn coding.

Uploaded by

Bobby
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
221 views100 pages

Mag Pi 136

The document is the December 2023 issue of The MagPi magazine. It features coverage of the new Raspberry Pi 5 including in-depth guides on overclocking and benchmarking it. It also includes several project ideas for the holiday season, such as robots, weather stations, and retro gaming builds. The issue highlights an interview with a maker who created a retro radio using a Raspberry Pi inside an old valve radio housing to inspire kids to learn coding.

Uploaded by

Bobby
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 100

YOUR OFFICIAL RASPBERRY PI MAGAZINE

Issue 136 December 2023 magpi.cc The official Raspberry Pi magazine

£5.99

OVERCLOCK & BENCHMARK RASPBERRY PI 5


Industrial Raspberry Pi

ComfilePi
WELCOME

WELCOME
to The MagPi 136

T
here’s a lot of excitement around Raspberry Pi
thanks to the ongoing waves of Raspberry Pi 5’s epic
launch.
We’ve got a lot of Raspberry Pi 5 coverage this month. From
in-depth heating, cooling and thermal testing (page 66) to Lucy

EDITOR
benchmarking (page 72). We’ve also got an in-depth guide Hattersley
to Overclocking (page 42). Lucy is editor of
The MagPi and has
Once you’re done speed testing and overclocking your new thoroughly enjoyed
overclocking
Raspberry Pi 5 you’ll want to make something with it. Check her Raspberry
Pi. Next up is a
out our Buyer’s Guide (page 32). This is packed with present seriously fast retro
ideas for the holiday season. From dynamic robots to weather gaming project.

magpi.cc
trackers this feature is packed with gifts that will put a smile
on any maker’s face.
Happy holidays!

Lucy Hattersley Editor GET A


RASPBERRY PI
PICO W
PAGE 30

magpi.cc 03
GET YOUR
RASPBERRY PI 5
FIRST!
We’ve reserved Raspberry Pi 5 boards
for The MagPi subscribers

New subscribers to The MagPi will get a Priority Boarding


code when they sign up. So don’t delay. Take out a
subscription today! You’ll be able to buy your Raspberry Pi 5
first and get incredible Raspberry Pi tutorials, projects, and
community events every month.

magpi.cc/priorityboarding
TERMS & CONDITIONS A Priority Boarding code will be emailed to everybody who takes out a print subscription to The
MagPi or HackSpace magazine. People who subscribe to both magazines will get two codes. Print subs only! Priority
Boarding does not apply to people with App Store, Google Play, Zinio, PDF contributions, or other paid-for subscriptions. Each
code will entitle you to purchase 1x (one) Raspberry Pi 5 model (either 4 GB or 8 GB) for the standard retail price and delivery.
Multiple codes need to be used individually. This is a limited offer and is subject to change or withdrawal at any time.
CONTENTS

Contents
> Issue 136 > December 2023

Cover Feature

32 Complete Raspberry Pi 32
Buyer’s Guide
Regulars
90 Your Letters
92 Community events calendar
97 Next Month
98 The Final Word

Project Showcases

08 Retro Pi World Radio


12 Confetti Bot
14 Pico Bubble Machine
16 RePalm 20
20 Badger and Fox Deterrent
24 Tide Clock
26 Pihome
28 Bullet Time Wedding Booth

08

Retro Pi World Radio Badger and Fox Deterrent

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 60 46
42 Overclock Raspberry Pi 5
46 Cloud gaming on Raspberry Pi 5
50 Python coding on Raspberry Pi 5
54 Remote control with TigerVNC
56 Using Ubuntu – part 2
Make a mecanum robot – part 2 Cloud gaming on Raspberry Pi 5
60 Make a mecanum robot – part 2
76
The Big Feature
66

PicoVision review

84
 Benchmarking Raspberry Pi 5

Reviews
76 PicoVision
79 10 amazing 3D prints
82 Learn Scratch

Community
84 Odd Jayy interview
86 This Month in Raspberry Pi Odd Jayy interview

WIN RASPBERRY PI 5 95

1 OF 10 ACCESSORY PACKS
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
many of the topics in The MagPi magazine are different between countries, and are always subject to change. You are responsible for understanding the requirements in your jurisdiction
and ensuring that you comply with them. Some manufacturers place limits on the use of their hardware which some projects or suggestions in The MagPi magazine may go beyond. It is
your responsibility to understand the manufacturer’s limits.

06 magpi.cc
PROJECT SHOWCASE

Retro Pi
World Radio
An old valve radio provides the ideal housing for this
nostalgic Raspberry Pi build, finds Rosie Hattersley

M
ost of the maker-interviewees who Raju describes himself as an AFOL (adult fan of
feature in The MagPi’s project showcase LEGO) and, as well as building his own Optimus
pages have a deep love of technology Prime, Hulkbuster and other complex kits, he has
and, often, a career in computing. Retro Pi World used the brightly-coloured bricks in his mission
Radio creator Raju Salubramanian is just such a to teach his kids and their friends how to code. He
fellow, but he is also on a mission to teach the does this as a ‘coach’ for the FIRST LEGO League
next generation to code: something that exactly (firstlegoleague.org) in his home town of San Jose,
chimes with why Raspberry Pi exists in the California. He is almost as big a fan of Raspberry
Raju
MAKER

first place. Pi as he is of LEGO, with multiple projects under


Subramanian
Software engineer
Raju loves
tinkering with tech,
assembling classic
characters from
LEGO and helping
kids get to grips
with code

magpi.cc/
worldradio

 e posted a video
H
of his project on
YouTube showing
station selection

08 magpi.cc Retro Pi World Radio


PROJECT SHOWCASE

Python handles the GPIO


input from the rotary
knobs and converts
it into keyboard input
events, such as scrolling
for radio stations

Quick FACTS
>  Raju and his partner
both love 3D
An old wooden radio case with off-centre Raju wrote a single-page printing projects
speaker has been turned into a world radio web app to display the
controlled via a 2GB Raspberry Pi 4 map and stations menu >  And sell their
designs online

>  This build would


cost roughly $275
if if you made it
 aju wanted something that would force us to slow down
R from scratch

in our current fast-paced digital world >  But Raju was able
to repurpose many
components he
his belt and six Raspberry Pi boards in use around already owned
his home (not all disclosed to his partner!).
Despite his thoroughly modern career as a >  Next, he’s going
software engineer in Silicon Valley and a CV that to tackle a
lists VMware and Google among his credits, Raju Raspberry Pi LEGO
has a fondness for the old days. “I have always Robotics project

loved to tinker and repurpose old hardware


to build something new”, he says, favouring
Raspberry Pi boards because they are “perfect” for
the projects he likes to work on since “they are so
easy to setup and get started with”.

A nod to nostalgia
For the retro radio build Raju wanted something
that would force us to slow down in our current
fast-paced digital world. He says the analogue
controls of the radio are in some way the opposite
of how we interact with our devices today with
touch and voice. The project was also meant to  e posted a video of his project on YouTube showing station selection
H

Retro Pi World Radio magpi.cc 09


PROJECT SHOWCASE

Keep on improving
Raju had seen other retro radio upcycling projects
online, and was particularly keen on creating one
similar to this internet radio project:
magpi.cc/internetradio. He used a 2GB Raspberry
Pi 4 because he “needed the extra horsepower of
Raspberry Pi 4 to get experience with the map
display”. He bought the main components from
online stores such as Adafruit.
Sourcing a suitable radio and writing the
software interface were his main challenges,

 etro World Radio


R
can tune in to a vast
collection of internet
R
 adio.Garden remind Raju of his childhood of using analogue
streaming radio stations
provides a user- knobs to change stations. His lengthy search for
friendly global
station selector the ideal old radio eventually led to him choosing since backend engineering is his professional
one with a speaker to one side and enough space forte. “I enjoyed the experience of writing all
to cut out a window and fit a new 5in screen. His the Javascript code for the display and I am
Retro World Radio can tune in to a vast collection still thinking of ways to improve the overall
of internet streaming radio stations from around aesthetic. Raju designed the new parts himself
the globe, and features a vintage map to browse including a new front face for the radio, using
and find radio streams. CAD software to design and create some

 he searchable Radio Garden site serves up stations from around the globe
T

10 magpi.cc Retro Pi World Radio


PROJECT SHOWCASE

Rig up a radio

Having sourced a lovely vintage radio


01 through eBay, Raju replaced the old backing
board and fitted new rotary encoders and fitted a
Raspberry Pi and AudioDAC.
3D-printed parts. He also wrote software R
 aju bought an old
radio from eBay for its
for the Retro World Radio, making liberal
off-centre speaker and
use of existing SDKs and open source or free warm acoustics
online libraries.
He began with a development platform using
a breadboard, which allowed him to test the
software. The first version had three rotary knobs
mapped to Raspberry Pi’s GPIO pins, but Raju later
decided to use four knobs. These pull in internet
streams from Radio.Garden and can be chosen by
location as well as genre.
Having completed the radio project, Raju is
now gearing up to combine his love of tinkering H
 e used the
remaining cabinet
with tech with LEGO, and has recently acquired a space for the new
Raspberry Pi Zero W. radio menu
He used the preconfigured version of
02 Raspberry Pi OS Lite he found on Comitup
to launch an automatic wireless connection:
magpi.cc/comitup

NodeJS controls backend functions and serves


03 up static images for the display. Raju’s build
details are at magpi.cc/worldradio.

Retro Pi World Radio magpi.cc 11


PROJECT SHOWCASE

Confetti Bot
Want a party to go off with a bang? Then you want a
device that fires confetti, as David Crookes explains

I
f you’re going to celebrate, then you should all confetti cannons are not the same size so, even
do so in style. So what better way than sending between brands, sometimes the clasp wouldn’t hold
a stream of confetti flying through the air at a the cannon strongly and the cannon would turn with
press of a button? That’s the premise behind the the motor without popping anything. The cables
Confetti Bot, a small cannon that shoots small to the battery are still hanging out, so hopefully a
pieces of coloured paper (biodegradable, of course) second version will enclose everything.”
skywards with a decent amount of power. With
a Raspberry Pi 3 B+ at its heart, it’s a relatively Party time
Hazal
MAKER

inexpensive way to get a party started. The software was written in Python, making use of
Mestci The device was created to mark the public launch the Viam Python SDK. “Viam’s compatibility with a
of Viam, a software platform for smart machines. variety of hardware components allowed seamless
Hazal Mestci is a
Turkish technologist The company’s project manager, Fahmina Ahmed, integration,” Hazal explains. “I didn’t have to write
and artist who lives wired a button and a motor together to pop confetti backend code to activate the specific motor I was
in NYC. Her day-
in celebration of the milestone. using, and I didn’t have to understand the nits and
to-day life involves
building fun robots, Developer advocate Hazal Mestci then suggested grits of computing boards to be able to get a reading
coding, drawing, taking the device further. “I thought we should from a pin.
reading, doing make this project presentable and fully functional “Thanks to the Python SDK, most of the
sports, and cooking.
and provide a step-by-step tutorial for Viam users boilerplate code was already dynamically created for
magpi.cc/ to follow,” Hazal says.What emerged was a device me. In the Viam app, as you add your components
confettibot
to your config, the Code Sample tab automatically
F itting all the components gives you working code to get your resources. So it
initiated the board and the motor as I added them,
inside was the hardest part and imported all relevant libraries for me.”
Although the Confetti Bot works well as it
that uses Raspberry Pi 3 B+ and an L298N motor is, Hazal says it can certainly be improved, and
driver to turn a GPIO motor when the button is she has one particular idea in mind: “I want
pressed to trigger the release of confetti. “I chose to incorporate a camera and machine learning
ALERT! to use Raspberry Pi due to its versatility and ability capabilities so that it can automatically release
to function as a compact and affordable computing confetti when a person approaches my desk,” she
Make sure you handle platform,” Hazal says. “It provided the necessary says. “It will surprise them on a good day and
and use confetti
cannons carefully. computing power to control the button, motor and scare them on a bad one.”
other hardware components involved, and its GPIO
allowed me to program and control the actions of
the Confetti Bot.”

Tight squeeze
The device is connected to a 12V battery to make
it portable, and the components are placed within
an enclosure designed with the assistance of senior
robotics engineer Jeremy Hyde using the 3D CAD
package SolidWorks. “Fitting all the components
The motor driver inside was the hardest part,” Hazal says. “I had to
is an inexpensive
design multiple versions of the enclosure and test
but important
part of the build the prototype many times. I was also unaware that

12 magpi.cc Confetti Bot


PROJECT SHOWCASE

The main device includes a


3D-printed enclosure with
When the button is the motor, motor driver and
pressed, the motor starts Raspberry Pi wired together
to turn and sets off the
confetti cannon, all
powered by a 12V battery

With a robot created


in the Viam app, and
the board and motor
configured, a simple
code loop checks if the
button is being pressed Quick FACTS
>  It makes use of
confetti cannons

>  The device is


fully portable

>  It uses the Viam


robotics-building
platform

>  All the code is on


GitHub: magpi.cc/
confettibotgit

>  There’s lots of


scope for expansion

Confetti Bot magpi.cc 13


PROJECT SHOWCASE

Pico Bubble Machine


A Syrian academic uses MicroPython to teach kids the joy of coding. By Rosie Hattersley

S
yrian electronic engineer Aula Jazmati
was amazed when she encountered her
first Raspberry Pi in 2014. “It was like
a miracle in a country suffering from difficult
circumstances”, so much so that Aula set about
sharing the joy with students and children as
a means to inspire their love of making. Many
Raspberry Pi and Hexabit projects later, Aula
Aula Jazmati
MAKER

decided to take on a more whimsical creation


Aula has a – a Pico Bubble Machine – figuring “soap bubbles
doctorate in have always fascinated children and adults alike.
electronic They bring joy and excitement, creating beautiful
engineering and
uses her Raspberry floating spheres that reflect light in mesmerising
Pi projects to inspire colours.” This DIY project also offers an exciting The water bath and motor prior to attaching Raspberry Pi Pico
other makers opportunity for children to learn about electronics.
magpi.cc/aulaj At its simplest, washing up liquid and a loop in encountered the low-cost computer when on
which to form bubbles is all that’s needed to create the hunt for a good value processor with an
this low-cost and playful distraction. But having set easy-to-read temperature sensor inside for use
a precedent delighting pupils with her builds and in thermal studies. “Thus began my friendship
science experiments, Aula was determined to design with the wonderful Raspberry Pi board, and I
something that would catch their imagination while transferred the energy of love and optimism that
also encouraging them to build their own bubble the Raspberry Pi gave me to my students and
machine. “With this project, children can explore everyone around me.” She particularly appreciates
the science behind soap bubbles while having fun the open-source approach, and the attitude that
building their own machine”, she reasons. science is for everyone from a community that
ensures others can research and overcome any
This diagram shows An amazing mentor technical difficulties they encounter.
how Pico is used to Aula has been using Raspberry Pi as a teaching
control the motor
and rotating disc resource in her lab since 2014. She first Spinning things out
This project introduces children to basic
electronics and encourages their creativity with
options to customise their bubble machine,
designing and decorating their own plastic discs
or experiment with different fan sizes for varying
bubble sizes. By programming the Raspberry Pi
Pico, children can learn about coding concepts
such as loops, conditionals, and functions.
The heart of Aula’s bubble machine is its
perforated circular plastic disc, which performs the
same role as a bubble wand. When the disc rotates,
it dips into a soap solution, creating a film of soap
on its surface, she explains, while air from the
fan blows through the holes, forming bubbles that
detach from the disc and float away. A DC motor
connected to an L298 driver circuit controls both

14 magpi.cc Pico Bubble Machine


PROJECT SHOWCASE

Raspberry Pi Pico controls an


L298 motor that governs the
disc spin speed and therefore
how frequently bubbles appear

Mentor Aula encourages pupils to Soapy water is drawn up


customise both the disc to create from the water bottle trough
different bubble effects and the and caught in the holes of Quick FACTS
bubble machine’s aesthetic design the spinning plastic disc
>  Aula made a
point of upcycling
materials for
the project

 oap bubbles have always


S > Reusing plastic
tools and
fascinated children and repurposing
electronic
adults alike components

the fan speed and disc rotation. These signals are >  Though you could
provided by Raspberry Pi Pico and a potentiometer design and 3D print
connected to it by an ADC pin. your own

“Raspberry Pi Pico controls when to start and


>  Aula loves the
stop the motor, as well as adjusting its speed, and
Raspberry Pi
was the ideal choice”, says Aula. It allows her to
community
calibrate the speed at which the disc releases the
bubbles and helps to optimise energy consumption >  And is a long-
so both the battery and kids’ enjoyment lasts as term translation
Raspberry Pi Pico and motor hooked up and ready for
long as possible. Aula to test them volunteer for it

Pico Bubble Machine magpi.cc 15


PROJECT SHOWCASE

rePalm
You’ve got to hand it to Dmitry Grinberg – squeezing PalmOS 5 onto
Raspberry Pi Pico is no mean feat, as David Crookes discovers

Y
ou can’t run Raspberry Pi OS on a RP2040
microcontroller, but that doesn’t mean
Raspberry Pi Pico is too underpowered
for an operating system. As Dmitry Grinberg
has shown, it’s capable of running a port of the
classic PalmOS 5 – the mobile operating system
unveiled in 2002 – although it’s not been without
considerable effort.
Dmitry
MAKER

PalmOS 5 was the first version of Palm’s


Grinberg operating system to support ARM devices. Before
Dmitry is a tinkerer that, the OS, which dates back to 1996, ran on
from Austin, TX the Motorola 68K processor line. “The move to
who specialises ARM was a bit more interesting,” Dmitry says.
in squeezing Raspberry Pi Pico connected to the CortextProg
every cycle out of
“There were rumours about the large internal
(cortexprog.com), a Cortex-M debugger Dmitry created to
microcontrollers re-architecting of the OS at the time but no details read and write data from and to a microcontroller

magpi.cc/ were known. In the end, the ACCESS company of


repalm Japan bought the OS and that was that. The source “It culminated in the release of the source
code was never released.” earlier this year, and now one can bring up
With an ongoing fascination with PalmOS – “it PalmOS even on processors that it never
was the first mobile OS with any sort of success actually supported, like tiny Cortex-M0 cores,”
and it gave the world the term ‘smartphone” Dmitry continues. Having tried numerous other
– Dmitry says he wanted to see if he could put the boards from STMicroelectronics’ STM32F429
operating system on another device with minimal to the STM32H7, RP2040 showed the most
changes. He looked into emulating the hardware promise. “I had never encountered a Cortex-M0
with success (check it out at magpi.cc/uarm). “But microcontroller that had enough RAM for
that was cheating,” he continues. “The goal was PalmOS,” he says. “RP2040 does – barely – so I
to port it to new hardware, which is usually hard wanted to try.”
without source code, but I figured I’d try.
“I knew that, in theory, most of the drivers Screen time
were contained in the Device Abstraction Layer The idea was to get PalmOS 5 running on
(DAL) module, with a few others being separate a Raspberry Pi Pico or other RP2040-based
(SD card, serial port, DMA). I figured that if I development board and connect the device to a
managed to replace those modules with some suitable touchscreen. Dmitry says the only one
I wrote myself, that the OS should, again in that fit his requirements was a low-cost $15.99,
theory, run on any ARM device with a compatible 2.8-inch touchscreen display from Waveshare
processor – any processor supporting ARMv4T offering a resolution of 320 × 240px.
or ARMv5T architecture.” This tech adventure “It is a resolution that PalmOS supports well and
spanned multiple years, but the effort has certainly really this is about the applications – the OS itself
been worthwhile. does not care about screen resolution,” he says.

16 magpi.cc rePalm
PROJECT SHOWCASE

RP2040 is able to run an Dmitry hasn’t gone to the


unmodified PalmOS 5.2.8 but bother of creating a case.
only after a lot of hard work “Really, the PS2040 PalmOS is
more me showing off,” he says

Quick FACTS
> The project ports
PalmOS 5 to
Raspberry Pi Pico

> It uses a custom


kernel to run
on Cortex-M
processors

> rePalm can be


replicated for less
than $20

> The biggest


problem is a lack
Capable of displaying 262,000 of RAM
colours, this Waveshare 2.8-inch
touchscreen display is nevertheless > The software can
being used to output in greyscale be downloaded
from Dmitry’s
website

rePalm magpi.cc 17
PROJECT SHOWCASE

Raspberry Pi Pico
is mounted on
the back of the
touchscreen display.
As Dmitry says, a
$1 microcontroller
is being used to
replicate what was
once a $400 device

“Applications work best at resolutions that are also allowed the thing being tapped to be seen,
integer multiples of 160 × 160, and extra space can while fingers are relatively large and obscure
be used for the dynamic input area. A 320 × 240 what you tap.”
resolution is not super common but is supported
relatively well.” Ramming in RAM
Dmitry says it helped that the screen was easy The more Dmitry used RP2040, the more he
to purchase. “It is a pet peeve of mine when realised it was a good fit for the project. “First, the
people publish a project and their parts list PIO system is very versatile, allowing me to pretend
includes ‘that one thing I bought at a garage sale to be a RAM and a ROM to the host 68k processor
once’ or ‘an old tube my grandpa left me in his (in the case of PalmCard) while also driving my
will’,” he explains. But it was also important to display with no CPU cycles needed. No other micro
have a resistive touchscreen. out there has anything quite like it,” he says.
“Devices today are designed for capacitive “Second, the performance is good. Cortex-M0
touch, hence the large touch targets,” he says. may not be a very performant core per-cycles, but
“PalmOS predates cheap capacitive touch so it the fact that I can easily run it at 200MHz+ surely
is designed for resistive touch screens which papers over a lot of that! Third, the documentation
needed quite a bit of pressure to work, hence does not suck, and this cannot be overstated.
the fact that styluses had a fine tip. The fine tip Whoever wrote the RP2040 docs needs a medal, a
bonus or a hug because it is clear and accurate.”
[That would be Alasdair Allan – Ed].
But that’s not to say Pico is perfect. “There is
barely enough RAM to turn around in, so it’s not
a practical PalmOS device,” he laments. “PalmOS
5 needs at least 64KB of RAM for the storage heap
where the databases are stored and at least 128KB
of dynamic heap, where temporary allocations
come from, to boot.
Dmitry has also “My kernel and DAL need about 30KB for itself
found a way to wire and we also need to fit at least one full frame
up external RAM to
the RP2040 in a way buffer [screen image] into the RAM. At 320 × 240
that it’s writable,
× 2 bits per pixel, the framebuffer is almost 19KB.
readable, and cached
(magpi.cc/romram) Adding that up gives us 241KB. Now, RP2040 has

18 magpi.cc rePalm
PROJECT SHOWCASE

Getting to grips with PalmOS

The project began as an experiment. Dmitry


01 wanted to figure out how PalmOS 5 was built
and how it worked. Other than replacing the DAL
module, the rest of the ROM image that runs is the
unmodified PalmOS.
The rePalm device
256KB of RAM – the other pieces are not easily looks very much
usable for various reasons. This is tight, but it at home here. It
can force-pause
fits. That 30KB was after a lot of extra work I put threats, disable
task switching,
in to shrink that footprint. Initially, it was closer and supports local
to 100KB.” thread storage

Looking ahead
This all means PalmOS 5 just about barely fits on
Raspberry Pi Pico and, once it boots, only basic
programs run with a few KB of RAM left over for a
memo pad note or two. There’s not enough RAM
to load a game, and Dmitry would love an RP2040
with more RAM. “It would work better,” he says.
Every feature that existed in PalmOS is
02 available – including every bug – and that
T here is barely enough RAM to makes the build great for software compatibility,
Dmitry says. The OS can be navigated using a
turn around in, so it’s not a stylus, just as Palm devices were back in the day.

practical PalmOS device


Still, rePalm is a huge feat that deserves a lot of
applause. Hours and hours of disassembly went
into its creation and using it shows how well
created PalmOS was. “The rules were simple: any
common activity should be no more than two
device interactions away,” Dmitry says. “People
who want a modern PalmOS device don’t seek
to replace their phone. They seek to escape the
constant advertisements and distractions.”
Dmitry has considered using Raspberry Pi
With rePalm, he is showing once more what 03 Pico W: “But to use Bluetooth, you’d need to
is possible. “Current plans include making a
send or receive things and to use Wi-Fi, you’d want
PalmOS-based smartwatch as well as a new a web browser, email client or chat app. There is not
PalmOS-based device,” he adds. enough RAM for that.”
Why? “Just because.”

rePalm magpi.cc 19
PROJECT SHOWCASE

Badger and Fox


Deterrent
Warning!
Working with
animals
Please be mindful when
creating devices that
Scaring off unwelcome garden visitors with a interact with animals.
Read the RSPCA’s guide
on deterrents and animal
nocturnal scarecrow simply screamed Raspberry Pi population control.

magpi.cc/
project for one maker, learns Rosie Hattersley rspcadeterrents

M
oving house is stressful enough; significant compute capabilities of Raspberry Pi
unpacking only to discover your new 4 prompted him to explore its machine learning
garden is favoured by unexpected potential at home.
local wildlife that doesn’t respond to unsubtle
hints is unsettling too. Software engineer James Inaudible alarm bells
Milward decided on a technology-based approach Having moved house in 2022, James and his
to tackling his night-time visitors, creating a family quickly discovered an issue with their
Badger and Fox Deterrent based around Raspberry new home: local foxes and badgers “loved
James
MAKER

Pi 4 and some machine learning. With a day job ripping the garden up, digging deep holes
Milward involving data and AI, James already had a fair and leaving ‘gifts’ everywhere for us”. Most
clue of how to go about it. disturbingly, they brought in insects carrying
James is a software
engineer for a He had a number of Raspberry Pis at home who knew what in terms of germs and potentially
company that and built a solar-powered watering system harmful diseases. Once local wildlife experts
manages data and using Raspberry Pi A+ back in 2015. He says confirmed these fleas and ticks were definitely
uses AI and enjoys
3D printing and the low-powered footprint paired with the from their garden visitors, James was “set on a
creating electronic
projects

medium.com/@
james.milward

 ifferent frequencies
D
warn off foxes and
badgers, respectively

20 magpi.cc Badger and Fox Deterrent


PROJECT SHOWCASE

Footage from the wireless


deterrent can be viewed
remotely, while unwelcome
visitors get a warning
audible only to them

Quick FACTS
>  TensorFlow Lite
draws less than 6 W
on Raspberry Pi
James repurposed an He used TensorFlow
ultrasonic wildlife deterrent to Lite machine learning on >  Even while
automatically detect different Raspberry Pi to detect foxes actively processing
types of nocturnal visitor and badgers, but trained it to images and cross-
ignore other moving objects checking them

>  The challenge


for James was
implementing this
on night images

>  Extracting usable,


accurate video
footage across
a large area
path to create a deterrent that could help with
our problem”. >  And at more
He initially tried scent-marking repellent than two frames
and natural mixes of citronella and chilli, per second
blocking entry points along the fences in the
garden, but “This just resulted in our fluffy
friends ignoring my initial attempts and digging
more holes”. He tried one solution that offered
a glimmer of hope: solar-powered ultrasonic
repellents. The Milwards duly placed a few around
their garden. However, the repellents required
manual setting depending on whether it was
badgers or foxes they wanted to warn off, as well
as deactivating so as not to trigger when the
family was in the garden. This led to occasions
when no ultrasonic repellent was in use, and
a further incursion of wildlife. Combined with
inconsistent charging of the solar-powered units,
James realised he needed something smarter:  he TensorFlow Lite system successfully recognises a visiting badger exploring James’ garden
T

Badger and Fox Deterrent magpi.cc 21


PROJECT SHOWCASE

 Ring doorbell
A
camera added Raspberry Pi was the perfect Raspberry Pi would be the perfect choice to help
add some intelligence to these very basic devices.
to the setup also
triggers an alarm
choice to add some intelligence
Tense, nervous, headache
to these very basic devices James had already experimented with TensorFlow
and figured the combination
of this open-source machine
learning platform’s object
recognition capabilities
and Raspberry Pi could
work well for his Fox and
Badger Deterrent, modifying
the ultrasonic repellent
for remote use. By adding
wireless connectivity and an
ESP8266 microprocessor, he
would even be able to have
the repellent operate at a
targeted frequency range to
“accurately deter targets”.
The project’s real headache
 he fox and badger
T came when trying to get video
detector machine
learning to detect frame rates good enough
the two animals
for object detection at a

22 magpi.cc Badger and Fox Deterrent


PROJECT SHOWCASE

Scare the cat!

 he machine learning
T
model identifying a fox

resolution of 640×640 pixels. James used existing


YouTube tutorials designed for 320×320 models,
but soon found that more detailed images would
be needed, and set about reducing the complexity
of the model without losing too much accuracy. You will need at least one solar ultrasonic
Unfortunately, this method brought the frame rate 01 repellent device, Raspberry Pi 4, a Ring
up to just under 1 FPS, which was fine for a single camera or compatible RTSP webcam, Arduino
video stream, but James had built the code to work ESP2866, a wireless connection and power supply.
on multiple cameras at once. He then discovered James details the build at magpi.cc/deterfox.
that the Coral USB Accelerator Edge TPU works
superbly with Raspberry Pi 4, which has the
necessary USB 3.0 ports. “I was able to use this
device to get the frame rate for object detection up
to 5 FPS for one video feed and about 2 FPS for two  badger detected
A
around the flower
feeds running concurrently.” pots in the garden

Install and configure James’ Python


02 application onto Raspberry Pi 4 or 5 alongside
a Coral USB3 Edge TPU (Tensor Processing Unit).

Modify the ultrasonic deterrent following


03 James’ GitHub, which has pretrained the object
detection module to discern badgers and foxes
(magpi.cc/tfanimal). You will also need a housing
for the device and a means of mounting it.

Badger and Fox Deterrent magpi.cc 23


PROJECT SHOWCASE

Tide Clock
How do you know the tide is right for a walk? If you’re
Levi Maaia, you create a special – and very pretty
– tide clock. Rob Zwetsloot braves the seas for a look

I
f you’ve ever lived near the sea, you’ll know be found here. As it turns out, there’s a good
that it never gets old to walk along the reason for that. Similar to many coastal areas
beach, especially when the weather is good. around the Pacific and some of the northern
For Levi Maaia, it turned out the weather wasn’t Mediterranean coast, the US west coast has a
the main problem. more complex tidal pattern, which means that
“I live 200 feet above the Pacific on an ocean without constant adjustment, a basic tide clock
cliff,” Levi explains. “I try to make it a weekly ritual would get out of sync with the ‘mixed semi-diurnal’
to walk down the cliff to the shore. However, it’s tides here in just a few days.”
Levi
MAKER

disappointing to reach the seaside stairs, expecting a This meant Levi needed a way to keep the clock
Maaia nice sandy walk, only to find waves lapping against up to date with the NOAA (National Oceanic and
the base of the bluff.” Atmospheric Administration) tide data, which led
A researcher,
film-maker, and For us landlubbers, tides aren’t always something him to turn to Raspberry Pi. “The device stays
educator, Levi likes we have to think about, although Levi was familiar
to tinker with tech with the tide clocks where he grew up. Not being
and learn about the
people who tinker able to find one for his new Californian home, Levi
 ll of the meters and
A
with it too decided to make his own: “It displays current tide
height in feet, predicted hours until next tide and
lights are driven by
pathwaysto
invention.org predicted height of the next tide using analogue the GPIO pins on a
meters and LED lights.”
Raspberry Pi 3B+ running
Tidal changes
Making a clock wasn’t quite as easy as he first a Python script that
thought, though.
“Growing up in Rhode Island, round, four- gathers tide predictions
segmented tide clocks were a common sight
The LEDs let you
know if it’s a good in homes near the Atlantic,” Levi tells us. accurate as long as it has a Wi-Fi connection,” Levi
time to head out,
“But after moving to California, I noticed that says. “The red light on the right side of the front
with green as the
usual ‘go’ signal these simple analogue clocks were nowhere to panel indicates a rising tide and the green light on
the left illuminates when the tide is falling. All of
the meters and lights are driven by the GPIO pins
on a Raspberry Pi 3B+ running a Python script
that gathers tide predictions from the US National
Oceanic and Atmospheric Administration’s API.
The script converts the raw tidal data into PWM
values to drive the meters and the binary state
voltage for the LEDs.”

Sea worthy
As well as the electronic aspect of the project,
Levi was keen to make it look more rustic to
camouflage the internal tech, using analogue
gauges and a wooden fascia. “Obviously there

24 magpi.cc Tide Clock


PROJECT SHOWCASE

A temporary wooden box


for the electronics that
maintains a rustic look

The required wooden


pelican to indicate
this is a coastal house

Quick FACTS
All the information >  Gohar Muzammil
you’ll need before helped with the
taking a stroll Python code
down the cliff
>  Levi wants to make
a durable wooden
enclosure for it

>  A Raspberry Pi Zero


are more efficient ways to communicate tide was tried originally…
predictions than with analogue meters,” Levi
admits. “A digital display driven by a Raspberry Pi >  …however the
needles were a
could easily show graphs and numbers based on
bit jittery, possibly
the tide API. But I wanted something more rustic
due to lack of
but just as accurate. They say measure twice and processing power
cut once. I must have tinkered mentally with the
physical build design a thousand times over the >  The API uses live
past two years. data on tide height
“So when it finally came time to assemble it, I for the harbour
had a very clear vision of how it should look, down
to the brass plaque declaring that the information
displayed was for ‘Santa Barbara Harbor’.”
According to Levi the finished project works
‘really well’, which hopefully means he’s been able
to go for his weekly walks without worrying about
The gauges and LEDs are controlled
the tide since completing it. by the GPIO pins on Raspberry Pi

Tide Clock magpi.cc 25


PROJECT SHOWCASE

Pihome
Save money on energy bills using Raspberry Pi Pico?
It’s more likely than you think. Rob Zwetsloot takes a reading.

I
n the current climate, saving money on Efficient code
heating is something a lot of people are While initial work was done on Raspberry Pi,
interested in doing, so it’s no surprise that Thomas switched to Pico for the project.
someone decided to tackle this head on using “Raspberry Pi Pico W is used to collect
Raspberry Pi Pico W. temperature and humidity data sent by
“I’m using temperature and humidity trend ThermoBeacons and transmits it to a cloud
data for optimising my heating systems and application for further analysis,” Thomas says.
monitoring individual room temperatures and “Actual data is additionally shown on a local
Thomas
MAKER

humidity,” Thomas Ackermann tells us. He display and provided by a local web server running
Ackermann lives in Bavaria, which has a similar climate to on Pico W.”
the UK with distinct seasons and a temperature Thomas had to do some serious coding
A software engineer
since the ’90s, ranging from freezing in the winter to too hot wizardry to get everything to run properly on
Thomas started his (25-30 °C) in the summer. “Up until now I have Pico – including tracking down a memory leak
career writing C on
had three systems running: two systems for room in MicroPython.
Unix systems.
monitoring which I am using for rooms which “I had to extend the original Pico LCD driver
magpi.cc/ are not occupied currently and need monitoring to support a configurable frame buffer,” explains
pihome
for deep temperatures and high humidity in the
winter. The other system is for optimising an old
oil heating system. The sensors are attached to the
T his helped to identify
piping and so indicate when the individual pumps
for heating, hot water and hot water circulation,
a useless circulation
and the oil burner, are active.” pump which could be
Thomas began this project with the goal of
refreshing his Unix/Linux skills and learning disconnected and so
Python on Raspberry Pi – and has ended up with a
saving of about €700 (£609/$741) a year on oil. power could be saved

The hygrometer
is hidden away
by some pipes to
take readings

26 magpi.cc Pihome
PROJECT SHOWCASE

Live readings can be seen at This hygrometer


a glance without needing to is used to take
log onto the cloud database humidity readings
for the system

This Bluetooth
ThermoBeacon
sends sensor
Quick FACTS
data to Pico
>  The code makes
use of asyncio for
multitasking on Pico

Thomas. “This is used to have enough free memory heating system; the real temperature was 5 °C
>  Data is sent to
for the https communication to the cloud service” higher than the temperature measured from the
the ThingSpeak
You can get the full code at magpi.cc/pihome heating controller and so the hot water pump cloud platform…
was activated too often. Finally it was used to
What a savings measure the effect of added insulation. The >  …which also
With the data collected from his sensors, Thomas burner temperatures are significantly lower includes diagnostic
was able to make some interesting discoveries. with the new insulation.” data on how Pico
“This helped to identify a useless circulation Now that Thomas has taken his project is performing
pump which could be disconnected and so this far, he’s keen to add more Bluetooth
power could be saved,” Thomas says. “It was also beacons and more types of sensor to the overall >  TI SensorTags were
switched out for
used to track down a problem with an incorrect system. Here’s hoping it helps him save even
ThermoBeacons
hot water temperature measurement in the more money…
>  With a smart
thermostat, a
project like this
could control
your heating

You can get readings


from Picos dotted
around the house

Pihome magpi.cc 27
PROJECT SHOWCASE

Bullet Time wedding


photo booth
One maker used a dozen cameras and Raspberry Pi Pico to build
the ultimate action-packed photo booth. By Ashley Whittaker

I
f you’re already tiring of the wedding season, which the chosen one, played by Keanu Reeves,
this project isn’t going to make you feel any dodges bullets with an impressive backbend.
better. Sebastian Staacks has out-gifted us all. You might also have heard of it as a frozen
No serving spoon sets or gift vouchers here. For moment, dead time, flow motion, or time
his cousin’s wedding he made a bullet time photo slice video.
booth using an array of DSLR cameras triggered by “My cousin asked me if I could build a photo
Raspberry Pi Picos. booth for his wedding,” explains Sebastian,
“where guests could create fun memories with
Sebastian
MAKER

Staacks What does bullet time mean? props like hats and giant glasses. I wanted to try
Bullet time photo booths comprise multiple something fancier. A video booth with a bullet
Sebastian is a cameras rigged together. Each camera takes a time effect”.
physicist and photograph at the same moment simultaneously,
the developer of
phyphox (phyphox.
or with a small delay between them. Software then A three-Pico wedding
org). He is a father joins each of the photographs to create a video Twelve cameras are attached to a curved rig that
of two, a drummer, with the striking “bullet time” effect. The effect looks a bit like a ballet barre. Look at the image
coder, and maker. is best known for – and indeed named after – its and you’ll notice the cameras are placed at greater
staacks.de use in The Matrix (magpi.cc/matrixbullettime) in distances apart towards the wall on the left,
and much closer together on the other end. This
The green button is used to start the recording
countdown and to confirm that a recording achieves the impression of the action accelerating
should be kept when the guests review their when the shots are played back in sequence.
result. The red button discards the recording
“I set myself a limit of €50 [£43.50] per
camera,” says Sebastian. “which means that the 12
cameras alone would cost €600 [£521].”
Sebastian did consider Raspberry Pi Camera
Module but decided on picking up extremely
old DSLR cameras instead, picking “the oldest
mainstream beginner DSLR that has a decent
resolution”. He settled on 12 10MP Canon EOS
400D cameras, which he picked up on Craigslist.
A Raspberry Pi Pico (magpi.cc/pico) acts as the
camera trigger. It has to make sure all the camera
shutters go simultaneously in order for the bullet
time effect to work. Two further Raspberry Pi
Pico Ws sit inside Bluetooth wireless buttons so
the wedding guests can control the action. The
green button starts the countdown to a recording
and saves it, and the red button can cancel a
countdown, or trash it if everyone looks idiotic.

28 magpi.cc Bullet Time wedding photo booth


PROJECT SHOWCASE

Twelve Canon 400D cameras are A Sony a5000


spaced out. Notice how the ones camera is used to
on the left are spaced more than grab the photos as
the right, this speeds up the visual a video file
effect towards the end

Raspberry Pi Pico is used


to control the buttons Quick FACTS
and cameras bringing all
the interactions together >  Sebastian originally
made a standard
photo booth for
his own wedding

>  The EOS 400D has


a photo resolution
 aspberry Pi Pico acts
R of 3888×2592 pixels

as the camera trigger >  More than the


3840×2160 used
Raspberry Pi Pico offers a serial interface via USB, which pulls
either of the two signal lines of the trigger cable to ground in the final video

>  But the EOS


DaVinci Resolve software created the final video
400D cannot
of all the shots stitched together. Its Optical Flow
record video…
Estimation generated artificial additional frames,
and allowed sections to be blurred or slowed down >  …so a Sony a5000
to making the stitching look more fluid. is used as a HDMI
grabbing device
Details, details, details
Sebastian created an incredibly detailed project
page (magpi.cc/tobbullettime) delving into each
element of the build, from the camera triggers to
building the rig and post-processing the images.
His GitHub (magpi.cc/bullettimegit) repo is also
a treasure trove of all the code you’ll need to build Raspberry Pi Pico
W fits into the push
your own and become the most popular wedding
buttons with two
guest ever. Well, maybe next wedding season. AA batteries

Bullet Time wedding photo booth magpi.cc 29


SUBSCRIPTION

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 £10


Free Pico W
3 issues of The MagPi

GET Priority Boarding code


RASPBERRY £10 (UK only)
PI 5 FIRST!
Priority Boarding Subscribe for 6 Months
Free Pico W

+ 6 issues of The MagPi


Priority Boarding code
£30 (UK) $43 (USA)
€43 (EU) £45 (Rest of World)

Subscribe by phone: 01293 312193


Subscribe online: magpi.cc/subscribe
Email: [email protected]
Subscribe for £10 is a UK-only offer. The subscription will renew at £15 every three months unless
cancelled. A free Pico W is included with a 6-month subscription in USA, Europe and Rest of World.

30 magpi.cc
SUBSCRIPTION

SUBSCRIBE TODAY AND GET A


FREE Raspberry Pi Pico W
Subscribe in print
today and get a FREE
development board WORTH

A brand new RP2040-


based Raspberry Pi Pico
$6
W development board

Learn to code with


electronics and build
your own projects This is a limited
offer. Not included
with renewals. Offer
Make your own home subject to change or
withdrawal at any time.
automation projects,
handheld consoles,
tiny robots, and much,
much more

New subscribers to The MagPi


will get a Priority Boarding
code when they sign up.
So don’t delay. Take out a
subscription today! You’ll be
able to buy your Raspberry
Pi 5 first and get incredible
Raspberry Pi tutorials,
We’ve reserved Raspberry Pi 5 boards projects, and community
for The MagPi subscribers events every month.

GET YOUR RASPBERRY PI 5 FIRST! magpi.cc/priorityboarding


Terms & Conditions: A Priority Boarding code will be emailed to everybody who takes out a print subscription to The MagPi or HackSpace magazine. People who subscribe to both
magazines will get two codes. Print subs only! Priority Boarding does not apply to people with App Store, Google Play, Zinio, PDF contributions, or other paid-for subscriptions. Each
code will entitle you to purchase 1x Raspberry Pi 5 model (either 4 GB or 8 GB) for the standard retail price and delivery. Multiple codes need to be used individually. This is a limited
offer and is subject to change or withdrawal at any time.

magpi.cc 31
COMPLETE
RASPBERRY PI
BUYER’S
GUIDE
Everything you
need for starting
your Raspberry
Pi adventure

R
aspberry Pi is an incredible device that
can empower people to do, well, just
about anything. It can’t do it all on its
own though without the help of the incredible
accessories, add-ons, and kits available.
Whether you got a new Raspberry Pi 5 over the
holiday season or looking for something new to
do with your existing boards, we’ve put together
a definitive list of essential and not-essential-
but-very-cool items for you to peruse that could
help kickstart your next project.
Let’s get making.

32 magpi.cc Complete Raspberry Pi Buyer’s Guide


HOW TO BUY
The best place to buy a Raspberry Pi 5 – or
any other kind of Raspberry Pi! - is from an
Approved Reseller. This is a network of shops
and online stores that work with Raspberry Pi
to distribute hardware, and you can find lists
of which ones have stock in your country from
the product pages on the Raspberry Pi website:
raspberrypi.com/products

There’s still time to get Priority Boarding


codes! Existing and new subscribers to the print
edition of The MagPi and Hackspace magazine
will get a code that lets them order and receive
their Raspberry Pi 5 earlier than others.
Check out page 4 for more details, or head to
magpi.cc/priorityboarding

Complete Raspberry Pi Buyer’s Guide magpi.cc 33


THE ESSENTIALS
Accessories and add-ons that every
Raspberry Pi owner should have

THE BASICS OFFICIAL KEYBOARD


PRICE £20 / URL magpi.cc/keyboard

Type in style with this nifty keyboard


OFFICIAL CASE
PRICE £10 / URL magpi.cc/case

Protect and cool your Raspberry Pi

OFFICIAL MOUSE
PRICE £9 / URL magpi.cc/mouse
OFFICIAL
A USB mouse in POWER SUPPLY
Raspberry Pi colours
PRICE £12 / URL magpi.cc/psu
ARGON
Make sure your Raspberry Pi
is properly powered
NEO CASE
PRICE £15 / URL magpi.cc/argonneo
HDMI TO MICRO
HDMI CABLE
Add passive cooling with a great
looking aluminium case

PRICE £9 / URL magpi.cc/hdmi

Connect Raspberry Pi with no converters

34 magpi.cc Complete Raspberry Pi Buyer’s Guide


ACTIVE CASE
COOLER FAN
PRICE £5 / URL magpi.cc/activecooler PRICE £6 / URL magpi.cc/casefan

Keep your Raspberry Pi 5 cool Raspberry Pi 4 cooling solution

OTHER ACCESSORIES

MEDIA CENTRE CASE FLIRC IR DONGLE


PRICE £12 / URL magpi.cc/flirczero PRICE £12 / URL magpi.cc/flirc

Camouflage Raspberry Pi under your TV Remote control support for


Raspberry Pi media centres

PICADE X HAT
PRICE £16 / URL magpi.cc/picadex

Turn your Raspberry Pi into an arcade cabinet

POE HAT
PRICE £23 / URL magpi.cc/poehat
RASPBERRY PI
Power-over-Ethernet for industry
CAMERA MODULE
PRICE £34 / URL magpi.cc/camera

Use AI vision or simply take photos

TV HAT
PRICE £16 / URL magpi.cc/tvhat

Watch Freeview via Raspberry Pi

Complete Raspberry Pi Buyer’s Guide magpi.cc 35


ELECTRONICS &
CIRCUITS
Take components and wires, and MULTIMETER
A good way to test your circuit
program them with Raspberry Pi for any faults

ESSENTIAL ITEMS
SOLDERING IRON
Use liquid metal to join components

SOLDERING BREADBOARD PROTOTYPING


ACCESSORIES For quickly setting up test WIRE
circuits, a breadboard
A soldering stand, some solder, Using different
is essential
flux, and a solder sucker wire colours can
help you follow
your circuit and
identify issues

HELPING HANDS RESISTORS


Hold fiddly parts We like to have a variety
together to make of resistors to hand for a
soldering easy range of uses

WIRE
CUTTERS
A good pair of wire
cutters can also
strip them

36 magpi.cc Complete Raspberry Pi Buyer’s Guide


RASPBERRY PI PICO ADVANCED KIT WHERE TO BUY
PRICE £31 / URL magpi.cc/advpicokit COMPONENTS
Components like LEDs, buttons, sensors,
Another Pico-themed electronics kit, etc, are not too hard to find but we
this one comes with a huge number recommend these sites in the UK for
of different electronic components buying components:
to chose from. There’s 32 tutorials shop.pimoroni.com
that come with it, all leading up to thepihut.com
building your own robot, and once coolcomponents.co.uk
again a lot of the parts can also be
used with a regular Raspberry Pi for
bigger projects.

ELECTRONICS KITS
STARTER KIT FOR
RASPBERRY PI PICO
PRICE £10 / URL magpi.cc/starterpico

Pico is a fantastic board for learning electronics,


and this kit comes with some basic components
to get you started with lighting LEDs. It can also
be used with Raspberry Pi with different jumper
cables. It also comes with a Pico H – a Pico with a
GPIO header attached.
GROVEPI+ STARTER KIT
PRICE £110 / URL magpi.cc/groveplus

STORAGE SOLUTIONS If you want to get stuck in with


some home automation and
Electronic components can
be small but they also tend other IoT projects, this kit is
to come in resealable bags a great way to start. The
– for some, putting them in special GrovePi+ connects
a drawer in their bags is good on top of Raspberry Pi and
enough, but storage boxes has connectors to several
can make organising many included modules, which
components much easier. can be programmed in
The one in the photo can be
Python and C.
found at magpi.cc/compbox.

Complete Raspberry Pi Buyer’s Guide magpi.cc 37


ROBOTS, ROBOTS,
ROBOTS Make an automaton with
a Raspberry Pi or Pico

CAMJAM EDUKIT 3 MONSTERBORG


PRICE £20 / URL magpi.cc/edukit3 PRICE £210 / URL magpi.cc/monsterborg

Probably the greatest


This is our go-to recommendation
wheeled robot for
for a robot kit for beginners – it’s
makers, this stylish
low cost and easy to program, and
masterpiece from
the coding and components can be
the folks at PiBorg
used in future, bigger robot projects.
was used in the Formula Pi
It works with just about every kind of
racing series and is able to flip
Raspberry Pi (and probably with Raspberry
over and drive upside down like the
Pi Pico if you’re a bit more experienced)
classic Tyco Rebound RC car from the nineties.
and there are a few 3D printable chassis for
Powerful and easy to program, it includes the
it if you’d rather not use the cardboard box it
fantastic ThunderBorg robot controller which
comes in as its frame.
can be used for this and other robot projects, as
well as the ability to make use of a Raspberry Pi
camera module for computer vision/machine
AUTONOMOUS ROBOTICS learning tasks when in automated mode. It’s also

PLATFORM FOR PICO very sturdy.

PRICE £41 / URL magpi.cc/autorobot


XGO-LITE ROBOT DOG
If you have a Raspberry Pi Pico and you’re
interested in robotics, you can’t go far wrong PRICE £484 / URL magpi.cc/cm4xgo
with this kit from Kitronik. It’s a little easier
to assemble than most, requiring This five-limbed robot dog is a very powerful piece of kit, able to
no soldering, and has room walk along on four of those limbs and having great articulation
for growth with extra with the fifth to pick up objects aided by its camera and
components. computer vision.
Like a lot of It also has machine-learning
Raspberry Pi Pico powered face and expression
projects, tutorials recognition so it will react to
and examples are in you with cute animations on its
MicroPython so they’re screen, and can be programmed
easy to pick up and in Python and Blockly remotely for
customise by rookie coders excellent automation.

38 magpi.cc Complete Raspberry Pi Buyer’s Guide


3D PRINTING
Level your projects up by making your own parts

CHOOSE A RASPBERRY PI
3D PRINTER
With so many 3D printers to choose
MERCH!
from, its best to ask the experts, which in Show off your love for Raspberry Pi
our mind is our colleagues on our sibling with official merchandise
publication HackSpace magazine.
Issue 59 (hsmag.cc/59) has a guide on
building an open source 3D printer, as
Enamel pin
well as reviews of 3D printers throughout
its other issues, such as the new Prusa PRICE £4
MK4 in issue 67 (hsmag.cc/67). URL magpi.cc/pin

FIND 3D PRINTS Mug


There’s an absolutely PRICE £9
massive community of 3D URL magpi.cc/mug
printers sharing their files on
the internet, and mostly for
free! If you have an idea for a
part or print in general, you
should look on Thingiverse Badges
(thingiverse.com) or PRICE £6
Printables (printables.com). URL magpi.cc/badges
We’ve also seen files on Etsy for sale of great
items, so don’t forget to look around for prints.

Water bottle
MAKE YOUR OWN PRICE £18

3D PRINTS URL magpi.cc/bottle

If you can’t find what you need, FreeCAD


(freecad.org) is online software that helps
you create 3D objects that can be used in
printing, and its very easy to use, especially
for simpler projects like cases.

Complete Raspberry Pi Buyer’s Guide magpi.cc 39


2024

200 PAGES OF RASPBERRY PI


Get started guide covering Have some serious fun with
every Raspberry Pi electronics

Everything you need to Learn robotics with our


know about the brand new super-simple robotics
Raspberry Pi 5 tutorial

Inspiring projects for your Play retro games with the


next build idea diminutive Raspberry Pi Pico

Buy online: magpi.cc/handbook


* Raspberry Pi hardware not included
TUTORIAL

Overclock
Raspberry Pi 5
Take the already speedy Raspberry Pi 5 all
the way up to 3.0GHz. By Lucy Hattersley

B
y default, Raspberry Pi 5 offers a huge But more speed is what we’re after here, so we
speed increase over previous models. heavily suggest using a cooling device, such as
Lucy Having said that, more is always a bonus the Active Cooler or official Raspberry Pi Case for
MAKER

Hattersley and it’s possible – if not always desirable, or Raspberry Pi 5. These devices contain fans which
necessary – to push the speed pedal a little harder. will keep the temperature down and the speed up.
Lucy is editor of The With some Raspberry Pi devices, you can make Thanks go out to Jeff Geerling whose work
MagPi magazine the clock speeds run even faster, a process known predated ours (magpi.cc/jeffoverlock) and forms
and enjoys
computers and her as “overclocking”. the basis for the config.txt code in this tutorial.
cat. Overclocking Overclocking Raspberry Pi 5 via Raspberry Pi Let’s put the pedal to the metal!
the cat is probably OS isn’t dangerous, but it isn’t supported either
a bad idea though.
(and not all Raspberry Pi 5 boards respond to
Probably?
overclocking, see “YMMV”).
magpi.cc
Edit config
Overclocking causes Raspberry Pi 5 to use more
power, and the board will consequently run a lot
01 Set up a fresh installation of Raspberry Pi 5
hotter. This isn’t dangerous because Raspberry OS. Be prepared for some experimentation here so
Pi OS will throttle performance to bring the heat don’t use an SD card with anything on it you don’t
levels down. mind losing. If you have an Active Cooler or case

The config.txt file


is edited to adjust
CPU clock and GPU
core speeds

You’ll Need
> R
 aspberry Pi 5
magpi.cc/
raspberrypi5
> R
 aspberry Pi OS
(Bookworm)
magpi.cc/software
>  Active Cooler
or Fan Case
recommended
magpi.cc/
activecooler

42 magpi.cc Overclock Raspberry Pi 5


TUTORIAL

Inside Raspberry Pi 5 sits a Broadcom


BCM2712 quad-core Arm Cortex A76
processor running at 2.4GHz. Which
we’re going to take up to 3.0GHz

Warning!
Crash likely!
Experimenting with
overclocking may crash
Raspberry Pi OS. There
You can overclock Raspberry
with a fan is also a chance of
Pi 5 without cooling, but it corrupting the microSD
now is the time card. Experiment with
will quickly throttle down to
to fix it. Boot into a clean Raspberry Pi
protect the CPU negating OS installation and
Raspberry Pi OS. the effect. The Active Cooler ensure no important
Our instructions to will keep it running fast
data is at risk.

overclock Raspberry Pi 5 live magpi.cc/overclock


in the config.txt file. This itself
lives inside the /boot/ directory. Open
a terminal window and edit this file with
the following command Underclock Top Tip
$ sudo nano /boot/config.txt An interesting aspect of over_voltage_delta is that YMMV
it’s a signed value. This means you can use negative
Scroll down to the end of the file and locate numbers to use less power (and have less speed). Your mileage will
[all]. We’re going to add code beneath here. This could have interesting applications in projects vary and there
that use solar, or battery power. is an overclock
Use this code in config.txt to take the power lottery. The
level down: stock speeds of
2400Mhz and
Increase voltage
02 The first step is to increase the voltage
[all]
# Decrease the voltage
800Mhz are what
all Raspberry
amount. In previous Raspberry Pi models. over_voltage_delta=-10000 Pi 5 models
can operate at.
For previous iterations of Raspberry Pi we
Some units will
recommended using over_voltage, but now # Set Arm core frequency in MHz
overclock better
the Raspberry Pi engineers recommend over_ (default 2400) than others. If
voltage_delta (magpi.cc/ovdelta). This is because arm_freq=2200 Raspberry Pi
Raspberry Pi 4, 400 and now 5 use a feature called OS behaves
DVFS (Dynamic Voltage and Frequency Scaling, You can use this command in a Terminal window erratically or
to view the current power consumption: freezes, reduce
magpi.cc/dvfs). This technique allows Raspberry Pi
the amounts or
4 and 5 devices to run at lower temperatures while $ vcgencmd measure_volts core
stop overclocking
still providing the same performance. altogether.
According to Raspberry Pi’s documentation:

Overclock Raspberry Pi 5 magpi.cc 43


TUTORIAL

but let’s try smaller values first. Add these lines


Recover from crash below the over_voltage_delta line:

# Set Arm core frequency in MHz (default


In this tutorial we are slowly increasing the CPU and GPU speed. On many
Raspberry Pi 5 boards (including ours) this will eventually result in a crash. Typically,
2400)
Raspberry Pi OS will freeze. arm_freq=2600
The challenge here is that you cannot edit config.txt in Raspberry Pi OS to
decrease the CPU speed. The easiest way to fix this is to power off Raspberry Pi 5 Restart Raspberry Pi OS. Click the Raspberry Pi
and remove the microSD card. Next, insert the microSD card into another computer. logo and choose Shutdown, then Reboot. Or enter
Open the microSD card drive in the Files/Finder/Explorer app and locate the
sudo reboot in a terminal window.
config.txt file on the root of the drive. Open the file in a text editor and adjust, or
Now test out Raspberry Pi OS for a few minutes
remove, the overclock values back to the point where Raspberry Pi 5 booted. Place
the microSD card back in Raspberry Pi 5 and boot up again. to ensure that it remains operating properly
without freezing up. Open a web browser and
browse a few sites to check everything is running.
If Raspberry Pi OS freezes you will need to remove
the overclock commands from config.txt (see the
“Recover from crash” boxout).

Speed test
04 If Raspberry Pi OS runs without crashing
take a look at the increased speed in action. To
check the new maximum clock speed open a
terminal window and enter:

$ sudo cat /sys/devices/system/cpu/cpu0/


cpufreq/cpuinfo_max_freq

In use, the core frequency will adjust between


The config.txt file is “Various clocks (e.g. ARM, Core, V3D, ISP, the maximum speed and a slower frequency (to
being edited on a
PC laptop running H264, HEVC) inside the SoC are monitored reduce energy consumption). To view the actual
Ubuntu to restore by the firmware, and whenever they are not speed enter this command:
the values to a point
where Raspberry running at full speed, the voltage supplied to
Pi 5 will boot and the particular part of the chip driven by the $ vcgencmd measure_clock arm
run correctly
clock is reduced relative to the reduction from
full speed. In effect, only enough voltage is This will return the value that the Arm CPU is
supplied to keep the block running correctly at running at × 1,000. To monitor the clock in real
the specific speed at which it is running. This time enter this command:
can result in significant reductions in power
used by the SoC, and therefore in the overall heat $ watch -n 1 vcgencmd measure_clock arm
being produced.”
Add the following code to the config.txt file Fire up the web browser and visit youtube.com.
underneath [all]: Open up a video and you will see the clock speed
spin up. After a while it may reduce back down as
# Increase the voltage the Arm chip manages its speed efficiently. Open
over_voltage_delta=50000 another window and run another video to spin up
the speed.

Increase frequency
03 Take it further
Now we are going to increase the frequency
of the CPU from its core speed of 2400MHz.
05 Now we’re going to take the Arm clock
Eventually we plan to take this up to 3000MHz, up to the maximum we have found reliable on

44 magpi.cc Overclock Raspberry Pi 5


TUTORIAL

our test devices, 3MHz. Open a Terminal window have maxed out at 3000 and 900 for our CPU and Using a Terminal
command to
and enter nano /boot/config.txt to edit the GPU, respectively. monitor clock
configuration files: Overclocking does use more power than speeds while running
YouTube videos
running at the standard speed. And, we can’t
# Set Arm core frequency in MHz (default stress enough that the regular 2.4GHz and
2400) 800MHz clock speeds for the CPU and GPU are
arm_freq=3000 more than sufficient for all the tasks we’ve used
Raspberry Pi for. So this is more of a novelty
Again, reboot Raspberry Pi OS and check that to play around with for us. Perhaps of more
everything is running correctly. Repeat Step 4 to use would be underclocking Raspberry Pi 5 for
test the speed. If your Raspberry Pi crashes follow projects that demand less power, and need to
the “Recover from crash” boxout and reduce the make the most use of battery power (see our
speed to 2800. Some Raspberry Pi boards are more “Underclocking” boxout).
amenable to overclocking than others (see the
“YMMV” boxout).

config.txt DOWNLOAD
THE FULL CODE:
GPU frequency
06 Our next step is to increase the GPU
> Language: Bash magpi.cc/github
frequency. By default, this is 800Mhz, and we have
successfully increased this to 900MHz on our test 001. # Increase the voltage
Raspberry Pi boards. Edit config.txt and add: 002. over_voltage_delta=50000
003.
# Set GPU frequency in MHz (default 800) 004. # Set Arm core frequency in MHz (default 2400)
gpu_freq=900 005. arm_freq=3000
006
Reboot and test Raspberry Pi OS by launching 007. # Set GPI frequency in MHz (default 800)
a web browser and testing YouTube. Some users 008. gpu_freq=900
have reported that gpu_freq=1000 also works on
their devices, so feel free to test that out. But we

Overclock Raspberry Pi 5 magpi.cc 45


TUTORIAL

Cloud Gaming with


Raspberry Pi 5
Play the latest AAA console games with only a Raspberry Pi 5 and
a good internet connection. No downloads, no updates. Here’s how

D
id you know your Raspberry Pi can also included. We’ll also cover other options such as
double as an Xbox or a high-end gaming Nvidia GeForce Now. Sadly, Sony’s PlayStation
PC? You can now play the latest games in equivalent is PC-only, and we encountered issues
PJ Evans
MAKER

full HD using just your humble credit-card-sized using Amazon’s Luna. Xbox and Nvidia can work
PJ is a writer, computer. Your inputs (controller, keyboard) are with Raspberry Pi as they both support streaming
software engineer sent to the remote ‘rig’ and a video stream of the to the browser, including Chromium.
and tinkerer. He game is sent back. Recent improvements mean
really enjoyed
the testing phase lag is barely perceivable and the video quality is
of this article. excellent. It’s not quite as easy as powering up
Choose your hardware
mastodon.
social/@mrpjevans
and jumping into Baldur’s Gate III, however, and
you’ll need to make a few decisions along the
02 A good controller is essential for any
way. This tutorial will walk you through it all. gaming, cloud or otherwise. We’ve chosen the
8BitDo Pro 2. Not only is it a great Bluetooth
controller, but it’s also proven with Raspberry Pi
hardware and approved by Xbox. You can also use
Choose your platform
01 There are a handful of cloud gaming
an official Xbox controller if you prefer. You’ll also
need to interact with a keyboard and mouse. Of
services available. Out of all of them we’ve chosen course, you can use a regular wired keyboard and
Xbox Game Pass Ultimate as a great service for mouse connected to the USB ports, but if you’re
our Raspberry Pi 5. For a monthly subscription, setting up a gaming environment you may want to
you can access hundreds of games that are consider a wireless keyboard such as the Logitech
instantly playable, and many top games are K400 series which combines a keyboard and
trackpad in one.

Initial setup
03 We’re going to need the ‘full’ version
of Raspberry Pi OS, complete with desktop, as
You’ll Need we need the Chromium web browser. Using the
Raspberry Pi Imager (magpi.cc/imager) select
> F
 ast internet
Raspberry Pi OS (64-bit) and write the image
connection
(ideally fibre)
to your SD card to get the latest evolution of
the operating system. We strongly recommend
> 8
 BitDo Pro
using a wired internet connection to your Raspberry
2 controller
magpi.cc/pro2 Pi if possible, for best results, but if you’re using
Wi-Fi, set it up now (and SSH too if you need
> W
 ireless
remote access). Once booted and ready to go, check
keyboard/mouse
magpi.cc/k400 and install any software updates (or run sudo apt
The 8BitDo Pro 2 controller is a perfect choice for this
project, and is endorsed by Microsoft for Xbox Games Pass update && sudo apt upgrade in the Terminal).

46 magpi.cc Cloud Gaming with Raspberry Pi 5


TUTORIAL

You’ll need to use the keyboard and mouse as well as a Thanks to HDMI, you
game controller, so choose a wireless option like these can do your gaming
on the big screen
Set up your controllers With cloud gaming our
04 The keyboard (with built-in trackpad)
favourite diminutive
computer can hold its own
we have chosen is very simple to set up because
against bigger machines
it uses a dedicated USB dongle. Just plug in the
receiver, and make sure the keyboard has some
batteries and is switched on. Both it and the
trackpad should work immediately. Bluetooth
devices, such as our controller, need to be paired
first. Click on the Bluetooth icon at the top-right
of the screen and select ‘Add Device’. When the
scanning window appears, put your controller
into pairing mode (on the Pro 2, press Start + X
then press the sync button for a few seconds). The
Sign up for Game Pass Ultimate
device should appear in the window. Now click
‘Pair’ to connect. You only have to do this once.
06 Xbox’s Game Pass service comes with Top Tip
different tiers of access. Cloud gaming is only
provided with the Ultimate package, which at Choose the
 ecent improvements
R time of writing is £12.99 per month with a £1 right mode
offer for the first month. For your money you get
mean lag is barely full access to over 300 games, from classics like Using the 8BitDo
Pro 2? Always
perceivable and Fortnite and GTA, indie greats like A Short Hike
and newer top titles such as Starfield and Football
begin by pressing
the X + Start
the video quality Manager 2024. Sign up will require credit card
details which will be debited monthly. You can
buttons to ensure
maximum Xbox
is excellent cancel your subscription at any time. Get yourself compatibility.
signed up and then you’re ready to start gaming.

Get an account
05 Try it out
It is a necessity of cloud gaming that you
have an account with the provider. In Xbox’s case,
07 Open up Chromium on your Desktop and
this is Microsoft. So if you haven’t got one, now is go to xbox.com. If you haven’t already, log in
a good time to get yourself set up with a Microsoft now. When you are returned to the front page,
ID. Go to xbox.com, click ‘Sign in’ then ‘Create click ‘Games’ then ‘Cloud games’. You’ll have
account’. Go through the steps to get set up, and a selection of games chosen for you, or you can
don’t forget to choose a strong password and scroll to the bottom and click ‘See all games’.
multi-factor authentication. Now you can log into Choose a game and then click ‘Play’. You may get
xbox.com and get ready to start gaming. a warning that a controller has not been detected.

Cloud Gaming with Raspberry Pi 5 magpi.cc 47


TUTORIAL

You’ll
 need to sign up
for Xbox Games Pass
Ultimate. It comes
with access to over
300 games

Troubleshooting
If so, click A on your controller and it should clear.
If that doesn’t work, check your pairing. You’ll
09 Now you will find out whether your setup
now be put in a queue for the first available rig. has a good enough connection. The service will
try to adjust video quality, prioritising speed
over resolution. If you find it inadequate, try
moving from Wi-Fi to a wired connection. Check
Playtime!
08 Your wait time will depend on the game’s
whether your sibling is streaming HD video while
uploading 5,000 selfies. If nothing works, contact
requirements and popularity. In our testing, most your internet provider to see if there are any faster
games kept you waiting no more than a couple options available to you. We’ve found that fibre-
of minutes, but popular and resource-hungry based services are the only way to get close to a
games can see waits of 30 minutes or more at real console experience. If you’re finding response
peak times. If this happens, try choosing another times laggy, nearby radio interference may be the
game. The wait screen will keep you informed of cause, and using an Ethernet cable to connect to
progress. When the game starts, it will be as if your router can fix this too.
you were in front of a real console and you play
Our experience
streaming games accordingly. Pressing the 8BitDo controller’s
with Luna wasn’t
‘heart’ button will bring up an overlay so you can
good, but it might
Boot straight in
work for you end the game or adjust settings.
10 To finesse your Xbox experience, we can
configure Raspberry Pi OS so you can boot straight
into a full-screen browser. Open up a Terminal
window or SSH into your tiny gaming rig. Now
issue this command:

nano ~/.config/wayfire.ini

Go to the bottom of the file and add this as a


single line:

[autostart]
chromium = chromium-browser https://www.
xbox.com/en-GB/play?xr=shellnav/ --kiosk

48 magpi.cc Cloud Gaming with Raspberry Pi 5


TUTORIAL

Nvidia’s GeForce
--noerrdialogs --disable-infobars --no-first-
run --ozone-platform=wayland
T he service will try to Now platform comes
with some great
demos for free, such

Save the file and quit Nano (CTRL+X). Reboot,


adjust video quality, as Lego Bricktales

and Chromium will start in fullscreen mode prioritising speed


automatically, and go straight to the Xbox
home page. over resolution
Other platforms
12 We also tried Amazon Luna, which is a
Nvidia GeForce Now
11 If you want to try cloud gaming completely
similar offering to Nvidia’s. However, although
streaming worked well, we found it struggled
for free, check out Nvidia GeForce Now, a similar with controller input, with seemingly random
service to Xbox Game Pass. It has a free tier that keypresses ruining the gaming experience. We Top Tip
allows you to access a small subset of games, were unable to establish whether this was a
including an excellent demo of Lego Bricktales. It temporary glitch, however, so do try Luna if Steam Link
runs in the browser just like Xbox’s service, but you have Prime membership. If you’re looking at
can link in with popular game libraries such as a permanent gaming setup, don’t forget that If you want to
Epic and Steam to allow access to your purchased cloud-based streaming is not your only option. play your PC
games (if supported). You can also choose a Raspberry Pi is a brilliant platform for retro games in another
room, check out
paid tier to get access to the games libraries and gaming (check out RetroPie) or even having a go at
Steam Link for
better hardware. Visit magpi.cc/geforcenow to making your own with Python PyGame. Whichever Raspberry Pi.
check it out. way you go, have fun!

Cloud Gaming with Raspberry Pi 5 magpi.cc 49


TUTORIAL

Python on
Raspberry Pi
There’s been a major change to Python. Now is a great time
to learn about virtual environments. By Alasdair Allan

R
aspberry Pi OS Bookworm brings a big From Bookworm onwards, packages installed
change for Python users, as we implement via pip must be installed into a Python Virtual
Alasdair a change introduced by the Python Environment using venv (magpi.cc/venv). This
MAKER

Allan community in upstream Debian: from Bookworm has been introduced by the Python community,
onwards, packages installed via pip must be not Raspberry Pi, see PEP 668 for more details
Alasdair Allan installed into a Python Virtual Environment. This (magpi.cc/pep668).
is a scientist,
will affect a lot of people, and we understand it will Installing packages using apt is the preferred
author, hacker
and journalist. In be disruptive for many as we all get used to the new method for installing Python libraries on Raspberry
the past he has way of doing things. Pi OS Bookworm. Packages installed via apt are
mesh networked In this tutorial, we take a look at what has tested, usually pre-compiled so they install faster,
the Moscone
Center, caused a
changed and how to effectively use Python on and are designed for Raspberry Pi OS. They won’t
US Senate hearing, Raspberry Pi OS Bookworm. break your system. Additionally, installing via this
and contributed Python 3 is installed by default on Raspberry route means that all required dependencies are also
to the detection of
Pi OS and is used for many important functions. installed, and a log of installation is maintained by
what was – at the
time – the most Interfering with the system Python installation the OS so the installation can be easily rolled back
distant object can therefore cause problems for your operating (uninstalled) if needed.
yet discovered in system, so it’s important that if you install third- For instance, to install the Python 3 library to
the Universe.
party Python libraries you use the correct package support our Build HAT:
magpi.cc/docs management tools.
There are two routes to installing libraries into $ sudo apt install python3-build-hat
the default python distribution. Firstly you can use
apt and install pre-configured system packages, or …to install the pre-built library.
alternatively, you can use pip to install packages that Using apt makes installing larger packages,
are not distributed as part of Raspberry Pi OS. like numpy which has many native dependencies
including a Fortran compiler, much simpler than
installing individual packages using Python’s own
package management system.
If you want to install a Python library called
“numpy” you can use apt search foobar to search
for the exact package name. In most cases, you’ll
find that the required package is going to be called
python-foobar or python3-foobar.

Virtual environments
In previous versions of the operating system you
used to be able to directly install libraries, system-
wide, using the package installer for Python,
commonly known as pip. You’ll find the following
Once in a virtual environment you can install
Python packages in Thonny using the Package sort of command in many tutorials online:

50 magpi.cc Python on Raspberry Pi


TUTORIAL

Click New virtual environment Packages must now be


in Thonny to switch the Python installed into a Python
executable to a virtual space virtual environment

$ pip install buildhat

However, in newer versions of Raspberry Pi OS,


and other operating systems, this is disallowed. If
you try and install a Python package system-wide
you’ll receive an error similar to this:

$ pip install buildhat


error: externally-managed-environment

× This environment is externally managed


─> To install Python packages system-wide,
try apt install
python3-xyz, where xyz is the package you
are trying to risk of breaking your Python installation or OS, by Installing the
buildhat package
install. passing --break-system-packages. See PEP 668 for inside a Python
the detailed specification. virtual environment
allows the package
If you wish to install a non-Debian- This error is generated because you’re trying and its dependencies
to be added
packaged Python package, to install a third-party package into the system
create a virtual environment using python3 Python. A long-standing practical problem for
-m venv path/to/venv. Python users has been conflicts between OS package
Then use path/to/venv/bin/python and path/ managers like apt, and Python-specific package
to/venv/bin/pip. Make management tools like pip. These conflicts include
sure you have python3-full installed. both Python-level API incompatibilities and conflicts
over file ownership.
For more information visit http://rptl.io/ Therefore from Bookworm onwards, packages You’ll Need
venv installed via pip must be installed into a Python
Virtual Environment using venv. A virtual > Raspberry Pi
Note that if you believe this is a mistake, you environment is a container where you can safely
> Raspberry Pi OS
should contact your Python installation or OS install third-party modules so they won’t interfere (Bookworm)
distribution provider. You can override this, at the with, or break, your system Python.

Python on Raspberry Pi magpi.cc 51


TUTORIAL

version of Python the one you’re currently using you


should type:

$ source env/bin/activate
(env) $

… and you’ll see that your prompt is now


prepended with (env) to indicate that you’re no
longer using the system Python. Instead, you’re
using the version of Python contained inside your
virtual environment. Any changes you make here, or
Creating a virtual
environment in the
Using pip with venv modules you install into your environment, won’t
command line To use a virtual environment, the first thing you cause problems for your system Python.
need to do is to create a container to store the
environment. There are several ways you can do this, (env) $ which python
depending on how you want to work with Python. /home/pi/my_project/env/bin/python
Top Tip One way you can proceed is to create a new
virtual environment (also known as “venv”) for If we go ahead and install a third-party package,
System Python each Python project you make. Here you’ll create it’ll now install into the Python distribution in our
a directory to hold your code along with a virtual virtual environment,
If you want environment directory:
to inherit the
(env) $ pip install buildhat
currently installed
$ mkdir my_project Looking in indexes: https://pypi.org/simple,
packages from
the system $ cd my_project https://www.piwheels.org/simple
Python you should $ python -m venv env Collecting buildhat
create your virtual Downloading https://www.piwheels.org/
environment if you now look inside the my_project directory simple/buildhat/buildhat-0.5.12-py3-none-any.
using python you’ll see a directory called env. whl (57 kB)
-m venv –––––––––––––––––––––––––––––––––––––
--system-site- $ ls -la 57.8/57.8 kB 2.8 MB/s eta 0:00:00
packages env. total 12 Collecting gpiozero
drwxr-xr-x 3 pi pi 4096 Oct 3 14:34 . Downloading https://www.piwheels.org/
drwx------ 20 pi pi 4096 Oct 3 14:34 .. simple/gpiozero/gpiozero-2.0-py3-none-any.whl
drwxr-xr-x 5 pi pi 4096 Oct 3 14:34 env (150 kB)
Trying to use pip to $ –––––––––––––––––––––––––––––––––––––
install buildhat in
the default Python 150.5/150.5 kB 6.9 MB/s eta 0:00:00
environment now
Inside this directory is a full Python distribution. Collecting pyserial
causes an error
message to show To activate your virtual environment and make that Downloading https://www.piwheels.org/
simple/pyserial/pyserial-3.5-py2.py3-none-any.
whl (90 kB)
–––––––––––––––––––––––––––––––––––––
90.6/90.6 kB 7.5 MB/s eta 0:00:00
Collecting colorzero
Downloading https://www.piwheels.org/
simple/colorzero/colorzero-2.0-py2.py3-none-
any.whl (26 kB)
Requirement already satisfied: setuptools
in ./env/lib/python3.11/site-packages (from
colorzero->gpiozero->buildhat) (66.1.1)
Installing collected packages: pyserial,
colorzero, gpiozero, buildhat
Successfully installed buildhat-0.5.12
colorzero-2.0 gpiozero-2.0 pyserial-3.5
(env) $

52 magpi.cc Python on Raspberry Pi


TUTORIAL

…and if you pip list you’ll see that your current


version of Python has your new modules: Using Thonny editor
(env) $ pip list Thonny is our recommended IDE (integrated
Package Version development environment) when working with
---------- ------- Python on Raspberry Pi. By default, Thonny uses
buildhat 0.5.12 the system Python.
colorzero 2.0 However, you can switch to using a Python
virtual environment by clicking on the interpreter
gpiozero 2.0
menu located at the bottom right of the Thonny
pip 23.0.1
window. Clicking on this will offer you a menu to
pyserial 3.5 select a configured interpreter or to Configure
setuptools 66.1.1 an interpreter.
Choose Configure interpreter and click ‘New
After writing your code, you can run it from the virtual environment’. An alert window will appear
command line inside the virtual environment as that says “After clicking ‘OK’ you need to choose an
empty directory, which will be the root of your new
you’d expect, by invoking Python as normal.
virtual environment”.
Click OK and choose ‘Documents’ in the sidebar
(env) $ ls -la or the Files app. Click ‘Create Folder’ and enter
total 12 “my_project” as the folder name and click OK.
drwxr-xr-x 3 pi pi 4096 Oct 3 14:34 . Wait for the ‘Creating virtual environment’ window
drwx------ 20 pi pi 4096 Oct 3 14:34 .. to appear, and close. Check that the Python
executable selection contains “my_project/bin/
drwxr-xr-x 5 pi pi 4096 Oct 3 14:34 env
python3” and click OK.
-rw-r--r-- 1 pi pi 0 Oct 3 14:45 my_ You can now install packages into your virtual
code.py machine using Tools > Manage packages. If you
(env) $ python my_code.py cannot see Tools then first click on ‘Switch to
Hello World! regular mode’ and restart Thonny.
(env) $ Search for ‘buildhat’ in the Manage packages
window and click ‘buildhat’ in the search results
window. Click ‘install’ to add the package to your
You can leave your virtual environment and return
virtual environment.
to using the system Python by typing:

(env) $ deactivate
$

… and prove to yourself you’ve done so by


checking the installed packages using pip list.
You’ll see there is a considerable difference!

User environments
An alternative method to creating a virtual
environment for each of your Python projects is to We can again check we’re in a separate
create a single virtual environment for your user environment by using pip list:
account and then activate that environment before
running any of your Python code. This approach (.env) $ pip list
may be preferred if you commonly install the Package Version
same set of modules for each project, and don’t ---------- -------
want to have to bother creating individual Python pip 23.0.1
environments for each project, essentially just setuptools 66.1.1
duplicating your environment.
… and leave it using deactivate.
$ python -m venv ~/.env
$ source ~/.env/bin/activate (.env) $ deactivate
(.env) $ $

Python on Raspberry Pi magpi.cc 53


TUTORIAL

Remote control
Raspberry Pi with VNC
Use TigerVNC to remotely access the latest and
greatest version of Raspberry Pi OS desktop

A
s is so often the case in computing, a
new version of an operating system
brings advancements but also some
PJ Evans
MAKER

compatibility headaches. The old X11 window


PJ is a writer, system that is the underlying engine of the
software engineer Raspberry Pi desktop has grown too restrictive, so
and tinkerer. He Raspberry Pi OS Bookworm has moved to the new
once pranked a
colleague by using whizzy Wayland engine. Wayland is a great and
VNC to randomly necessary step forward, but If you want to remote
change his desktop control your desktop using VNC, you need to
image. You should
move to a service that understands Wayland and a
not do this.
client that’s compatible. And that’s TigerVNC. So,
mastodon.
social/@mrpjevans here’s how it’s done. Here we enable VNC using the Desktop app. Just slide the
switch to the right and click OK

window, click the Interfaces tab and select VNC.


Let’s get ready to remote!
01 The latest Raspberry Pi OS uses the newer
Now click OK and within a couple of seconds,
your VNC server will be running. You won’t see
Wayland subsystem to manage the desktop (as anything different on the screen, it’s all in the
opposed to the old-guard X11), compatibility background.
with many VNC servers has (for now) been lost.
Luckily, Raspberry Pi OS Bookworm ships with
a working service, WayVNC, installed and ready
Help! I’ve got no head!
to go. So, start by using Raspberry Pi Imager to
install Raspberry Pi OS and make sure you’ve
03 If you are setting up a headless Raspberry
got all the usual networking up and running. Pi (one that has no display attached), you can still
Finally, update everything by checking the System enable VNC remotely. Using a terminal app on your
Updates app or using apt update && sudo apt local computer, SSH into the Raspberry Pi (you’ll
upgrade in the terminal. need to know its IP address or hostname) then run
sudo raspi-config to start the Configuration Tool.
Use the cursor key to select Interface Options, select
You’ll Need VNC and press ENTER. On the next screen use TAB
Enable VNC
> R
 aspberry Pi
02 There are two ways to enable your WayVNC
to select Yes, press ENTER again and the server will
be enabled. You then can go back to the main menu
server, which will allow you to connect to the and select Finish. There’s no need to reboot.
> R
 aspberry Pi OS
Bookworm Raspberry Pi remotely. The first, and easiest,
method is to use the desktop. Log in locally and
> C
 omputer with
click on the Raspberry Pi logo to bring up the
TigerVNC Viewer
A local app for local people
tigervnc.org menu. Now go down to Preferences and select
Raspberry Pi Configuration. On the resulting
04 Just as much as we need something to VNC

54 magpi.cc Remote control Raspberry Pi with VNC


TUTORIAL

The TigerVNC Viewer is


freely available for Raspberry
Pi OS, macOS, Windows and
many Linux distributions

Control your Raspberry Pi


from anywhere, as if you
were sitting right in front of it

to, we need something to VNC from. We now turn The TigerVNC UI is


easy to use. Enter
our attention to the remote computer. WayVNC, the IP address or
Raspberry Pi’s VNC server, has some particular hostname (normally
followed by ‘.local’)
security requirements that reduce the number of and click Connect
clients with which it is compatible. We’ve seen the
best results with TigerVNC, which is based on the
popular TightVNC. You can get the TigerVNC client
for free from tigervnc.org although on a Raspberry
Pi you can install it by searching for tigervnc-
viewer in Add/Remove Software, in Terminal by accepting a key. These are nothing to worry about,
running sudo apt install tigervnc-viewer. just some of the advanced security we discussed.
Go ahead and say OK to both prompts. Finally,
enter your username and password (the same
Y ou should now see as you use for login). You should now see your

your Raspberry Pi’s Raspberry Pi’s desktop in all its glory.

desktop in all its glory Top Tip


Remote access
Get yourself connected 06 What’s in a
05 Time to try it out! Start up TigerVNC. A
You will now be able to control your
Raspberry Pi as if you were sitting in front of name
small connection box will appear. Enter the IP it. You can even cut and paste across the two
Here we are
address or hostname of the Raspberry Pi followed machines. Don’t expect a perfect frame rate, as the using TigerVNC
by “.local” (you can find the hostname using networking will introduce lag. If you’re interested as the client,
hostname in the Terminal). Or enter hostname in accessing the desktop outside of your network, not the popular
-I to get the IP address. Unlike many VNC remember security should be firmly at the front of TightVNC. Tiger
clients, you do not put “:1” or similar after the your mind. You’ll need to use your router to assign is an evolution of
TightVNC, which
address. That will cause an error. Click Connect. your Raspberry Pi a static IP address and some
does not yet work
You may be alarmed to see a warning about a method of VPN access (such as PiVPN Wireguard) with Bookworm.
server certificate or a large dialogue asking about for security access to your network.

Remote control Raspberry Pi with VNC magpi.cc 55


TUTORIAL

Using Ubuntu
Part 02

on Raspberry Pi
Exploring more features of the Ubuntu
Desktop Linux OS on Raspberry Pi

I
n the first part of this tutorial series (magpi. and get under the hood of the operating system.
cc/135), we showed how to install and set up We’ll be using it to perform various tasks.
Phil the Ubuntu desktop operating system on a To open a Terminal window in Ubuntu, click the
MAKER

King Raspberry Pi, and took you through some of its Activities button at the top of the left sidebar and
key features. search for ‘Terminal’, then double-click the icon to
A long-time This time we’ll look at how to access the launch it. Alternatively, use the keyboard shortcut:
contributor to The command line, set up remote connections via SSH CTRL+ALT+T.
MagPi, Phil is a
freelance writer and and RDP, install media codecs, use Raspberry Pi’s The terminal window will show the usual
editor with a focus GPIO pins, change the desktop environment, and command-line prompt where you can enter a
on technology. use alternative ways of installing software. host of commands. To see the path for the current
@philkingeditor working directory (i.e. the folder you’re in), enter
pwd. To list its contents, enter ls. You can use the
cd command to change directory; for example,
Access the command line
01 As well as navigating Ubuntu’s desktop
cd Downloads.
For lots more useful commands, check out the
GUI, you can open a CLI (command-line interface) command-line tutorial in The MagPi issue 125
Terminal to use powerful text-based commands (magpi.cc/125).

You’ll Need
> R
 aspberry Pi 4,
400, or 5

>  16GB (or greater)


microSD card with
Ubuntu Desktop
23.10 installed

After installing
Ubuntu-restricted-
extras, you can
play MP4 videos
in a media player
such as VLC

56 magpi.cc Using Ubuntu on Raspberry Pi


TUTORIAL

The CLI terminal is


used to enter text-
based commands

The Dock shows favourite This sliding tile


apps and any others that game was installed
are running from a DEB package

02 Install media codecs  ince Ubuntu (like Raspberry Pi


S
As a pure FOSS (free open-source software)
operating system, Ubuntu doesn’t come with OS) is based on Debian Linux,
common non-free codecs pre-installed. So, if you
attempt to play a media file such as an MP3 music you can also install software
track or MP4 video, you may see a message to
that effect.
from DEB files
Luckily, there’s an easy fix, as you can install
Install DEB files
a single package – called ubuntu-restricted-
extras – to install all the essential media codecs.
03 Since Ubuntu (like Raspberry Pi OS) is based
To do so, open a Terminal window and enter the on Debian Linux, you can also install software from
following command: DEB files. To find packages suitable for Raspberry
Pi, head to packages.debian.org/stable and look for
$ sudo apt install ubuntu-restricted-extras any labelled ‘arm64’ or ‘all’.
To install a downloaded DEB file, there are two
You’ll be prompted to enter your Ubuntu user main ways. You can use the Terminal command
password. A list of packages to be installed will sudo dpkg -i followed by the filename (and path if
then be shown; press ENTER to confirm. You’ll
then need to confirm the EULA (press TAB to
not in the same directory). For instance, to install
the 2048 Qt game:
Top Tip
highlight ‘OK’, then press ENTER). Press TAB to
Desktop icons
highlight the options, then ENTER on ‘Yes’ to $ sudo dpkg -i 2048-qt_0.1.6+b1_arm64.deb
accept the terms. You should now be able to play When switching
files with those restricted codecs. If you get messages about missing dependencies, back to the
If you also want to play DVDs via a USB-attached follow this up with: default desktop
environment, it
drive, you’ll need to install libdvdread4. Enter this
may retain the
Terminal command: $ sudo apt -f install.
icon settings etc.
from the previous
$ sudo /usr/share/doc/libdvdread4/install- …to install them. Alternatively, to open DEB one. Revert them
css.sh files straight from the desktop, you can install the in the Tweaks app.
Gdebi tool using this command:

Using Ubuntu on Raspberry Pi magpi.cc 57


TUTORIAL

Connect via SSH


05 Sometimes you may need to operate your
Raspberry Pi from another computer or device,
such as when it isn’t plugged into a monitor. SSH
(Secure Shell) is a tried and tested method for
gaining secure remote access to the command line.
Unlike in Raspberry Pi OS, there’s no all-in-
one Raspberry Pi configuration tool for enabling
interfaces and protocols in Ubuntu. Nor can you
enable SSH in advance using Raspberry Pi Imager’s
advanced settings. So you’ll need to do it manually.
It’s best to run a sudo apt update first. Then, to
Once the OpenSSH
server is installed, $ sudo apt install gdebi install the required OpenSSH server, use:
a Remote Login
option will appear in
Settings > Sharing Then, when you double-click a DEB file, you can $ sudo apt install openssh-server
then select Gdebi to open it and install the package.
Enter your password. Once it’s installed, open the
Settings app (search for it in the Show Apps tool or
Activities) and select Sharing > Remote Login. Turn
Other ways to install
04 Instead of browsing the (newly renamed in
on the switch to enable SSH connections.
You should be able to connect remotely from
Ubuntu 23.10) Ubuntu App Center, you can use the another computer, using:
snap install command followed by a package name
if you prefer. $ ssh [username]@[computer_name.local]
As on Raspberry Pi OS, the Apt package manager
can be used to install certain packages. To search Or with its IP address:
for available ones, use apt-cache search followed
by the search term (or just ‘.’ to list all packages). $ ssh [username]@[IP address]
Then install one with sudo apt install followed by
the package name. For instance, ssh [email protected] or
There’s also the option of using the Flatpak ssh [email protected]. Enter your password
utility to install an app and run it in a virtual and you should be taken to Raspberry Pi’s
The GNOME Tweaks environment. Refer to magpi.cc/flatpakrpi for command line.
tool lets you further
customise the instructions for how to install Flatpak and the
appearance and
Flathub repository, then download and install apps
behaviour of your
Ubuntu system from the latter (flathub.org).
Remote desktop
06 Since SSH is limited to entering text-based
Terminal commands remotely, if you want to access
the desktop you’ll need to use a different method.
Normally we’d use VNC, but this can be a little
tricky to get working for Ubuntu on Raspberry Pi.
Luckily, Ubuntu has a built-in remote desktop
sharing facility using RDP (Remote Desktop
Protocol). Open the Settings app and select Sharing
> Remote Desktop. Then turn both switches on,
for Remote Desktop and Remote Control (so you
can navigate remotely, not merely view). In the
Authentication section, you can view the current
password and change it if you want.
To connect from another computer, you’ll
need a suitable client such as Microsoft Remote
Desktop, Thincast, or Remmina. Use the ‘Device
Name’ shown in Ubuntu’s Remote Desktop window

58 magpi.cc Using Ubuntu on Raspberry Pi


TUTORIAL

appended with ‘.local’, or use its IP address. Then


enter your username and the Remote Desktop
password. Ignore any warnings that the certificate
couldn’t be verified and continue.
You should then be able to view Raspberry Pi’s
Ubuntu desktop on the remote machine. Note the
sharing icon that appears in the top taskbar; click it
when you want to close the remote connection.

Change the look


07 In Settings > Appearance, you can switch to
dark mode and change the background image, while
Settings > Ubuntu Desktop has options for desktop
icon size/position, the Dock (left sidebar), and
tiling. You can do more customisation by installing Log Out. Click your username, then the gear icon at You can switch to
a different desktop
the gnome-tweaks tool: the bottom right of the login screen to select a DE environment, such
from the menu. as KDE Plasma

$ sudo apt install gnome-tweaks By default, there’s only a choice of two DEs:
Ubuntu (the default) and Ubuntu on Xorg (which
Opening the Tweaks app will enable you to alter switches the display manager from Wayland to
the appearance of the cursor, icons, fonts and other X11). You can install extra environments from the
settings. You can add more options from custom command line, however. For example:
themes by installing the Extension Manager:
$ sudo apt install kde-plasma-desktop
$ sudo apt gnome-shell-extension-manager
You should then be able to select it – Plasma
Open the Extension Manager app, click the (X11) in this case – from the login screen DE
Browse tab, then User Themes and Install. In the selection menu.
web browser, download a theme or icons from
gnome-look.org, such as Orchis. Extract the file
(double-click in the file browser).
Coding with Python
In Terminal, create two new directories (for
GTK/GNOME Shell and icon/cursor-based themes
09 You can still use Raspberry Pi’s GPIO
respectively) in your home folder: pins in Ubuntu, but you’ll need to install a new
Python module:
$ mkdir ~/.themes
$ mkdir ~/.icons $ sudo apt install python3-lgpio

In the Files browser, press CTRL+H to show You can then import it like any other Python Top Tip
hidden files/folders. Now move the extracted theme module at the top of your code, with import
folder(s) into the relevant folder, such as .themes lgpio. You can write programs in Ubuntu with a IP address
for Orchis. Reopen the Tweaks app, and you should text editor such as nano, or a Python IDE such as
now see new options in the Shell and Legacy Apps Spyder: sudo apt install spyder. To obtain
drop-downs. You may get a system prompt to For details of the lgpio module’s functionality, Raspberry Pi’s
install missing snaps; click ‘Yes’. see magpi.cc/lgpio. For some code examples, visit IP address, to
magpi.cc/lgpioexamples. The ‘basic GPIO example’ connect from
will blink an LED connected to GPIO 23 and a GND another device via
pin. Paste it into a new document, named blink. SSH or Remote
Switch desktop environments
08 You can even switch to a different desktop
py, using Nano (or another text editor), then run it
with the command python3 blink.py. Alternatively,
Desktop, enter
the command
environment (DE) from the user login screen – to you can install a Python IDE such as Spyder – sudo hostname -I.
get back there, click the top-right power icon and apt install spyder – and run it from there.

Using Ubuntu on Raspberry Pi magpi.cc 59


TUTORIAL

Raspberry Pi:
Part 02

Mecanum robot
with sensors
Expanding on our mecanum robot project, add a distance
sensor to avoid crashing into obstacles. Learn how
collision avoidance is used to make driving safer

T
he mecanum robot in the earlier tutorial taken between the signal being transmitted and
Stewart
MAKER

(MagPi issue #135, magpi.cc/135) could be the response received can be used to work out
Watkiss
controlled with a gamepad. If you didn’t the distance to an object.
Also known as react fast enough, then it was quite easy to crash Figure 1 shows the HC-SR04 sensor used for
Penguin Tutor. A the robot. Adding an ultrasonic distance sensor this project. There are different models of the
Maker and YouTuber
means that the robot can automatically stop HC-SR04, some of which can work down to 3.3V.
who loves all things
Raspberry Pi. Author before colliding with a wall or other object. This circuit is based around the 5V version for
of Learn Electronics The sensor used is similar to those found in car maximum compatibility.
with Raspberry Pi. parking sensors. The robot senses the distance to
penguintutor. objects in front and automatically stops forward
com movement when an object is too close. With
Sensor signals
@stewartwatkiss additional code, this could be used as the basis of
a robot that could navigate a maze.
02 In addition to the power supply, the
HC-SR04 semsor module has two pins for an
input and output signal. The trigger needs to be
You’ll Need sent a short 10µS pulse to start the measurement.
Ultrasonic distance sensors
> HC-SR04 Ultrasonic 01 There are various different sensors that
The transmitter then sends eight sonic bursts and
the reciever listens for an echo.
distance sensor
can be used to detect distance. The one used here After determining how long it took to receive
magpi.cc/hcsr04
is based on ultrasonic distance measurement, a response at the receiver, the echo pin is then
> 330 ohm resistor and works by emitting an ultrasound signal and raised high for a length of time proportional
magpi.cc/330r
then listening for an echo response. The time to the distance. This is shown in Figure 2.
> 470 ohm resistor The output from the echo pin is 5V, which is
magpi.cc/470r too high for the GPIO pins. Therefore a resistor
voltage divider can be used to drop the signal to
approximately 3.3V.

Wiring the distance sensor


Figure 1. The HC-
SR04 module has 03 The distance sensor needs a 5V power
a transmitter and
receiver. It sends out supply. As the robot can have up to 6V, this is
ultrasonic pulses connected after the diode used to connect to the
and detects an
echo response 5V pin on your Raspberry Pi.

60 magpi.cc Raspberry Pi: Mecanum robot with sensors


TUTORIAL

An ultrasonic distance
sensor is used to detect
the distance of objects
in front of the robot

A resistor voltage divider


is used to protect the GPIO
pins from the 5V signal

The distance sensor needs to be connected V x (R2 / (R1+R2))


to two GPIO ports. The chosen pins are GPIO
5 (physical pin 29) for the trigger, and GPIO 6 … which is approximately 3V. This is the signal
(physical pin 31) for the echo. that is passed to GPIO 6.
The trigger pin works with a 3.3V input signal
so is connected directly to the GPIO pin. To drop
the echo signal from 5V to 3.3V you need two
Using PiGPIO
resistors. If using USB for power then there is not
much space for these, but they can be squeezed
05 GPIO Zero is used to control the motor
into the gap between the USB connector and the driver and can also be used for the ultrasonic
motor drivers as shown in Figure 3. sensor. Using its default native pin configuration
GPIO Zero can communicate with most sensors
Figure 2. Waveforms
with acceptable performance. For the ultrasonic showing signals
used to trigger the
ultrasonic sensor
Resistor voltage divider
04 The breadboard diagram shows the
and the received
distance signal

resistors with long leads, which are needed to


get them to fit into such a tight space. This
makes it difficult to see how it is wired, so the
schematic diagram of the voltage diagram is
also shown in Figure 4.
The output is from pin 3 of the HC-SR04, which
goes through a voltage divider created by R1 and
R2. The voltage is shared across these resistors
proportional to their resistance. The voltage
across R2 will be:

Raspberry Pi: Mecanum robot with sensors magpi.cc 61


TUTORIAL

dist_sensor.distance

The returned value is in meters. The maximum


distance set in the code is 0.09, which works out
as 9cm.

Using Pygame Zero


08 The earlier version of the robot software
was written as a command-line Python program.
One issue with that is that the code would stop
Figure 3. Wiring running whilst waiting for the next key press.
diagram with the This means it is not possible to check for a
resistor voltage
divider squeezed in potential collision whilst the robot is moving.
between the motor
An alternative is to use Pygame Zero, which
driver and the USB
power connector can create a GUI application which can respond
to keyboard presses as well as regularly checking
sensor the timing is critical, and using the native the value from the distance sensor. It also
library can give incorrect results. Instead, you provides a way to create a graphical screen
can use PiGPIO. This allows direct memory access which can be controlled using a mouse or
(DMA), which reduces the requirement on the touchscreen. A screenshot is included in
processor. To use PiGPIO the PiGPIO daemon first Figure 5.
needs to be run as root, and then the appropriate
pin_factory needs to be set in your Python
program. The daemon is started using
How to code for Pygame Zero
sudo pigpiod
09 The main difference with Pygame Zero is
that instead of running the program in sequence
the code is event-driven. The main way that
code is run is through two functions draw() and
update() which are each called approximately
Using Python Pin Factory
06 With the pigpiod daemon running, then
60 times per second (depending upon computer
performance). The draw() function is used for
the device factory can be set within the Python displaying the interface on the screen and the
code. First, you need to import the PiGPIOFactory update() function normally handles any other
library from gpiozero.pins.pigpio import code that needs to be run.
PiGPIOFactory. Then set the pin_factory using: It is also possible to set code that runs when an
event occurs which in this example is the on_key_
Device.pin_factory = PiGPIOFactory()
Figure 4. Schematic diagram showing the wiring between the
GPIO pins and the ultrasonic sensor. The two resistors form a
This will then use PiGPIO for all devices that voltage divider reducing the voltage
use the GPIO pins from GPIO Zero.

Measuring the distance


07 To measure the distance first create a
DistanceSensor object:

dist_sensor = DistanceSensor(echo=6,
trigger=5)

The distance can then be queried by looking at


the distance property:

62 magpi.cc Raspberry Pi: Mecanum robot with sensors


TUTORIAL

down(key) function which is called each time that


a key is pressed on the keyboard.

The update function


10 The collision avoidance code is included
in the update function. The code detects if the
distance is less than the minimum distance. If
it is then it also checks that the robot is going
forward, otherwise you would end up with a robot
that couldn’t reverse either. included on the module PCB to allow mounting, Figure 5. A very
basic GUI display
The code includes error handling by placing but due to their small size compared to the has been created
checks for the sensor inside a try block. If the resolution of the 3D printer these were not used, using Pygame Zero.
This allows the
code in the try block has an exception, then and the board can be held with a small amount of sensor code to run
regularly to check for
instead of crashing the program it will ignore tape or adhesive putty. The bracket is shown in a possible collision
the rest of that block and call the except block Figure 6. Download the bracket design file from
instead. In this case, if the sensor isn’t detected, magpi.cc/robotmecanum.
then it prints out an error message. For a different chassis, it may be possible
to drill holes for the sensor or make your own
bracket using thick cardboard.

Running the code


11 To run the code then it needs to be run
using pgzrun. This can be done using Pygame
Zero mode in the Thonny editor, or by running on
the command line using:

pgzrun mecanum-pgz.py

The program can still be used with


AntiMicroX to allow the robot to be controlled
using a gamepad.
If you get an error, then make sure you started
pigpiod first, as mentioned earlier.

Mounting the sensor


12 Finally, you will need somewhere to mount
the sensor. If you are using the 3D-printed
chassis then there are mounting holes included
for a printable bracket. There are small holes

Figure 6. The bracket is designed to screw to the front of the


chassis to mount the ultrasonic sensor

Raspberry Pi: Mecacum robot with sensors magpi.cc 63


TUTORIAL

DOWNLOAD
mecanum-pgz.py THE FULL CODE:
magpi.cc/mecanumrobotgit
> Language: Python Pygame Zero

001. # Minimal version of mecanum-pgz 049. keys.K_6 : (1, -1, -1, 1), # Right
002. from gpiozero.pins.pigpio import PiGPIOFactory 050. keys.KP6 : (1, -1, -1, 1), # Right
003. from gpiozero import Device, PWMOutputDevice, 051. keys.K_8 : (1, 1, 1, 1), # Forwards
004. Motor, DistanceSensor 052. keys.KP8 : (1, 1, 1, 1), # Forwards
005. 053. }
006. WIDTH=800 054.
007. HEIGHT=600 055. # Track direction
008. 056. current_direction = (0, 0, 0, 0)
009. Device.pin_factory = PiGPIOFactory() 057.
010. 058. # speed is as a percentage (ie. 100 = top speed)
011. pwm_pin = 18 059. speed = 50
012. m_f_l = (2,3) 060. pwm_out.value = speed/100
013. m_f_r = (22,23) 061.
014. m_r_l = (14,15) 062. def draw():
015. m_r_r = (24,25) 063. screen.fill((192,192,192))
016. 064. for arrow in arrows:
017. motors = [ 065. arrow.draw()
018. Motor(m_f_l[0], m_f_l[1], pwm=False), 066.
019. Motor(m_f_r[0], m_f_r[1], pwm=False), 067. def update():
020. Motor(m_r_l[0], m_r_l[1], pwm=False), 068. global current_direction
021. Motor(m_r_r[0], m_r_r[1], pwm=False) 069. try:
022. ] 070. if (dist_sensor.distance <= min_distance):
023. 071. # Is robot going forward (or diagonal)
024. pwm_out = PWMOutputDevice (pwm_pin) 072. if (current_direction[0] == 1 and
025. dist_sensor = DistanceSensor(echo=6, trigger=5) current_direction[1] == 1):
026. 073. print (“Warning - crash imminent”)
027. arrows = [ 074. # Force stop using stop key number
028. Actor(“arrow.png”, center=(500,300)), # Right (5)
029. Actor(“arrow.png”, center=(400,200)), # Up 075. set_direction (direction[keys.K_5])
030. Actor(“arrow.png”, center=(300,300)), # Left 076. except:
031. Actor(“arrow.png”, center=(400,400)) # Down 077. print (“No distance sensor detected”)
032. ] 078.
033. arrows[1].angle = 90 079. def on_key_down(key):
034. arrows[2].angle = 180 080. global speed, current_direction
035. arrows[3].angle = 270 081. # Get next key pressed
036. 082. if (key in direction.keys()) :
037. # distance in meters - a value between 0 and 1 083. set_direction(direction[key])
038. min_distance = 0.09 084.
039. 085. def set_direction(direction):
040. # list to convert key into motor on/off values to 086. global current_direction
correspond with direction 087. current_direction = direction
041. # direction based on number keypad 088. for i in range (0, 4):
042. direction = { 089. if direction[i] == -1:
043. keys.K_2 : (-1, -1, -1, -1), # Backwards 090. motors[i].backward()
044. keys.KP2 : (-1, -1, -1, -1), # Backwards 091. elif direction[i] == 1:
045. keys.K_4 : (-1, 1, 1, -1), # Left 092. motors[i].forward()
046. keys.KP4 : (-1, 1, 1, -1), # Left 093. else:
047. keys.K_5 : (0, 0, 0, 0), # Stop 094. motors[i].stop()
048. keys.KP5 : (0, 0, 0, 0), # Stop 095.

64 magpi.cc Raspberry Pi: Mecanum robot with sensors


Design

Code

Configure

Analyze

PR O FES S I O N A L CO N T R O L SYS T E M D E V E LO PM E N T TOO L

Home projects made easy.


CDP Studio, a great software development tool for your home projects. Build
systems for Raspberry Pi, use C++ or NoCode programming, open source libraries,
out of the box support for GPIO, I2C, MQTT, OPC UA and more. Create beautiful user
interfaces. Built for industrial control system development, FREE for home projects.

cdpstudio.com
Tel: +47 990 80 900 • [email protected]
CDP Technologies AS // Hundsværgata 8, 6008 Ålesund, Norway
HEATING
& With the release of Raspberry Pi 5,
we’re introducing two new official
hardware solutions for cooling.

COOLING
By Alasdair Allan

E
very time a new Raspberry Pi is released,
there are questions about thermal control
of the new board. People want to know
whether it’s necessary, and if so, what you’ll need
to do to make it happen.
For normal usage of your Raspberry Pi, adding
cooling is entirely optional. The idle performance of
a Raspberry Pi 4 and a Raspberry Pi 5 is about the
same, and under typical loads, Raspberry Pi 5 will
run cooler than a similarly loaded Raspberry Pi 4.
However, a heavy continuous load will mean that the
board could potentially go into thermal throttling.
Throttling happens as there are software controls to
limit CPU speeds if things get start to get too toasty.
Although, even when fully throttled, a Raspberry Pi 5
is still going to run faster than a Raspberry Pi 4.
But data makes everything better, so I decided to
grab some early production hardware and run some
tests to help you make up your mind about whether
 ben showing off a prototype of the Active
E
Cooler for Raspberry Pi 5 you’re going to need to cool your Raspberry Pi 5.

66 magpi.cc Heating & Cooling Raspberry Pi 5


 rocessor
P
temperature in
°C against time
in seconds. At
time T=T₀ stress
testing was started

No cooling
The first thing to do is to measure what happens
when your Raspberry Pi 5 is not cooled. Without

How we measure any cooling in place, Raspberry Pi 5’s CPU idle


temperature is around 65 °C when sitting out in

CPU temperature
The vcgencmd command is an amazingly useful
the open air on the lab bench.
For normal use adding cooling is optional. If
you’re watching a YouTube video, or working on
source of information about the things that are the desktop, you aren’t going to be stressing the
happening on your Raspberry Pi, and the Python CPU like we did in this test. But, unsurprisingly,
bindings (magpi.cc/vcgencmd) surface all of with the heavy sustained load we’re imposing
that and let you programmatically monitor pretty on the CPU with no cooling the maximum
much everything that needs monitoring. Here temperature climbs to and then remains stable
 he clock speed
T
we’re going to use the vcgencmd Python bindings just above the 85 °C thermal limit during extended intermittently throttled
to monitor and log the temperature, along with testing. This leads to sustained thermal throttling on an uncooled
Raspberry Pi
the current CPU clock speed and throttling state, after the temperature reported by the processor undergoing a stress
test to maintain a
to a file (see measure_temp.py, p69). rises above the throttling limits.
constant maximum
Once we have the script up and running in a thermal temperature
Terminal window, we can open up another and
kick off a stress test on all four cores to load
the CPU. To do that, I’m going to use the stress
(magpi.cc/stress) command line tool to impose a
heavy workload on all four of the CPU cores.

$ sudo apt install stress


$ stress --cpu 4

To prevent overheating, all Raspberry Pi


boards begin to throttle the processor when the
temperature reaches 80 °C, and throttle even
further when it reaches the max temp of 85 °C.

Heating & Cooling Raspberry Pi 5 magpi.cc 67


Raspberry Pi 5 with an Active Cooler fitted

Fitting the will be turned on, at 67.5 °C fan speed will be


increased, and finally at 75 °C the fan will increase

Active Cooler
I then ran the same test with managed active cooling
to full speed. When the temperature drops back
below these limits, the blower’s fan will spin
down automatically.
using the new Active Cooler, and then with the Thanks to the passive heatsink, with the
Active Cooler still fitted but with the blower’s fan Active Cooler fitted we see a much lower idle
disconnected. Both these tests were done with the temperature, around 45 °C. During extended
Raspberry Pi sitting in the open air on the lab bench. testing under load, the fan of the Cooler spins up
The Active Cooler is a single-piece anodized at low speed to stabilise the CPU temperature at
aluminium heatsink with an integrated blower. It 60 °C, with a maximum temperatures of 62 to 63 °C
 rocessor
P has pre-applied thermal pads for heat transfer, and being seen during the tests.
temperature in
°C against time in is mounted to the Raspberry Pi 5 board directly using Noise levels of between 35 to 40 dB were
seconds. At time
T=T₀ stress testing
spring-loaded push pins. It is actively managed by measured during the load test while the fan
was started Raspberry Pi’s firmware. At 60 °C the blower’s fan was in operation – that’s about as much noise
as you’ll make turning the page of a book.
During the extended stress testing the fan never
actually needed to run at full speed to maintain
temperature control of the Raspberry Pi.
Unplugging the fan and relying solely on
the passive cooling provided by the aluminium
heatsink, the idle temperatures were similar,
but under extended load the CPU temperature
eventually reaches the point at around T₀ + 200
seconds where thermal throttling occurs.
Reattaching the cable causes the fan to spin
up to full speed immediately, and with the
load removed, the CPU is cooled back to an idle
temperature of around 45 °C within a further 300
seconds, with the fan spinning back down to lower
speeds as the temperature falls back to normal.

68 magpi.cc Heating & Cooling Raspberry Pi 5


For normal
usage of your
Raspberry Pi,
adding cooling
is entirely
optional
Thermal image of an Raspberry Pi 5 under load (left), and with Active Cooler (right)

But what about


a HAT?
The big question a lot of folks will have at this
point is, what happens when you add a HAT?
Well, you can mount a HAT above the Active
Cooler using a set of 16mm GPIO extenders.
Inevitably there is some disruption to the air
flow which will cause the Raspberry Pi to run
hotter, but the Active Cooler is still able to
handle extended stress tests without significant
temperature rises.
Testing was done with a prototype of the new
M.2 HAT, booting Raspberry Pi from the NVMe
drive – both because I happened to have one on
my desk, and also because this is going to be a
pretty common use case for the Raspberry Pi 5
– and just a reminder: the only thing you really
need to remember about the prototype M.2 HAT is
that the production version will almost inevitably
look nothing like the one in this picture!
With the M.2 HAT fitted above the Active Cooler,
The new Raspberry Pi 5 with the Active Cooler and a prototype of the upcoming M.2 HAT
the idle temperature of the Raspberry Pi was
slightly higher than without the HAT present, at
around 49 °C.
Under sustained load the CPU temperature
initially rose to the second 67.5 °C trigger point,
spinning the blower’s fan up from low to its
middle speed. However, this quickly dropped
the CPU temperature below the trigger point,  rocessor
P
temperature in
which in turn dropped the fan speed back to °C against time in
seconds. At time
its lower setting. The CPU temperature then
T=T₀ stress testing
stabilised at around 64 °C for the remainder of was started
the sustained testing.

Heating & Cooling Raspberry Pi 5 magpi.cc 69



Raspberry Pi 5’s Using
the new case
clip-together
case comes with
a built-in fan

Next on the test bench was the new fan case.


I removed the Active Cooler from my board,
and went ahead and fitted the Raspberry Pi 5
inside the new case. The new case comes as four
components; the base which the Raspberry Pi clips
into, then a frame and fan assembly, and finally a
lid that clips on top.
Like the Active Cooler, the fan assembly is
actively managed by Raspberry Pi’s firmware: at
60 °C the blower’s fan will be turned on, at 67.5 °C
fan speed will be increased, and finally at 75 °C the
fan increases to full speed. When the temperature
drops back below these limits the fan will spin
down automatically.
Testing was carried out in the same fashion
as before, first with the fan assembly in place,
but with the lid removed. Then again with both

Like the active


cooler, the fan is
actively managed
by raspberry pi’s
firmware

fan assembly in place, and this time with the lid


clipped on top.
Using the fan case we see idle temperatures
a couple of degrees hotter than with the Active
Cooler on its own, at around 48 °C. With the
lid removed we see maximum temperature of
approximately 72 °C under sustained load, and
with the lid in place we see a marginally higher
maximum of around 74 °C under load.
We can see that while temperature under load is
higher than with the Active Cooler, the maximum
temperature under load is still well below the 80
and 85 °C throttling temperatures.

 rocessor temperature in °C against time in seconds.


P
At time T=T₀ stress testing was started

70 magpi.cc Heating & Cooling Raspberry Pi 5


Conclusions
For normal use adding cooling is optional,
although performance may be improved with
the addition of active cooling. However a heavy
continuous load, such as rebuilding the Linux
kernel, will force the new Raspberry Pi 5 into
thermal throttling. For heavy loads thermal
throttling can extend processing times, and
passive cooling is probably going to be insufficient
thermal management for heavy loads that extend
beyond 200 or 300 seconds of duration, with active
cooling necessary to prevent thermal throttling
from occurring.  rocessor
P
temperature in
When deciding on a cooling solution you should Cooling of any type isn’t mandatory, °C against time in
consider what sort of use you’re going to put your no harm will come to your Raspberry Pi seconds. At time
T=T₀ stress testing
Raspberry Pi 5 to, and make a decision on cooling if it’s left uncooled — and even while was started
based on that, rather than just arbitrarily adding throttling under heavy load, a Raspberry
cooling. Because for a lot of day-to-day use cases, Pi 5 is still faster than an unthrottled
it’s not going to be needed. Raspberry Pi 4.

measure_temp.py DOWNLOAD
THE FULL CODE:
> Language: Python magpi.cc/github

001. import sys


002. import os
003. import time
004.
005. from vcgencmd import Vcgencmd  he Active Cooler
T
makes sure
006. Raspberry Pi 5 runs
007. def main(): smoothly while
working its hardest
008. start_time = time.time()
009. fb = open(“/home/pi/readings.txt”,”a+”)
010. fb.write(“Elapsed Time (s),Temperature (°C),Clock Speed (MHz),Throttled\n”)
011. vcgm = Vcgencmd()
012. while True:
013. temp = vcgm.measure_temp()
014. clock = int(vcgm.measure_clock(‘arm’)/1000000)
015. throttled = vcgm.get_throttled()[‘breakdown’][‘2’]
016.
017. string = ‘%.0f,%s,%s,%s\n’ % ((time.time() - start_time),temp,clock,throttled)
018. print(string, end=’’)
019. fb.write(string)
020. time.sleep(1)
021.
022. if __name__ == ‘__main__’:
023. main()

Heating & Cooling Raspberry Pi 5 magpi.cc 71


BENCHMARKING
Raspberry Pi 5 benchmarks reveal
a significant performance boost.

By A lasdair
Allan

T
here is nothing so important to an engineer
who gets their hands on a new bit of
hardware as to immediately try and figure
out how fast it can go. On the other hand, there
is nothing more hotly debated between engineers
as to how to measure how fast things go. But like
many things, what you should measure really
depends on how and why you will be using the
hardware in the first place.
As our American friends might say, your
mileage may vary (magpi.cc/ymmv).

72 magpi.cc Benchmarking Raspberry Pi 5


Benchmarking with Geekbench
There are many benchmarking frameworks, but If you’re running the 64-bit distribution of
Geekbench is mine (geekbench.com), and why Raspberry Pi OS, it ships with 16KB page size
it’s mine comes back to the question of how and enabled, which gives slightly improved performance
why. Instead of just straight-up crunching some at the expense of compatibility with older ARMv7
pointless numbers, Geekbench takes a stab at 32-bit binaries.
running tests that attempt to reflect how people So we’ve also gone ahead and tested a Raspberry
normally use their computers: loading a website, Pi 5 computer using both 16KB and 4KB page
rendering a PDF, and adding filters to an image. size. To do that we’ve used an internal build of
Like a lot of other benchmarks, Geekbench Geekbench 6.2 which is patched to support 16KB
headline scores are split into single-core and page sizes (the off-the-rack release won’t work
multi-core scores. However, just due to the nature with 16KB page size, and needs you to reboot and
of the benchmark, Geekbench scores can vary a lot use a 4KB page size).
from run to run. Setting force_turbo=1 in config. For Geekbench benchmarks, bigger numbers
txt and avoiding things like software updates are better!
somewhat reduces the noise between runs, but the
best strategy is to average multiple runs. Which is
what we’ve done.
Multi core
Multi-core scores attempt to measure the more

Single core
Single-core scores measure the processing
realistic case where jobs are being distributed
across all the cores of the board’s CPU. These
sorts of scores are more relevant for heavily
power of one CPU core and are more relevant threaded applications such as web browsers,
for applications that are lightly threaded, which generally try to offload individual tabs
meaning they rely mostly on a single core to into separate process threads.
process instructions. Over one hundred runs of Geekbench 6 we
Over one hundred runs of Geekbench 6 saw saw an average score of 1,604±22 for Raspberry
an average score of 764±6 for Raspberry Pi 5 Pi 5 using a 4KB page size, and 1588±63 using a
using a 4KB page size, and 774±6 using a 16KB 16KB page size. That’s a ×2.2 speed increase over
page size. That’s a ×2.4 speed increase over Raspberry Pi 4.
Raspberry Pi 4.

MULTI CORE SCORE


SINGLE CORE SCORE Raspberry Pi 5
1588
(16KB page size)
Raspberry Pi 5
774
(16KB page size)
Raspberry Pi 5
1604
(4KB page size)
Raspberry Pi 5
764
(4KB page size)
Raspberry Pi 4 723

Raspberry Pi 4 340

Benchmarking Raspberry Pi 5 magpi.cc 73


Overclocking to 3.0GHz
Overclocking Raspberry Pi 5 is something you do at and the GPU from 800MHz to 1GHz, we see a
your own risk, and Raspberry Pi doesn’t necessarily corresponding increase in performance with a
recommend it. But, that said, we have a tutorial on ×1.2 increase in score on the single-core tests.
Overclocking this issue for folks that want to live Interestingly, we don’t see a similar increase
dangerously (see page 40). in performance in the multi-core tests. This
So if you want to take Rasbperry Pi 5 up in speed, discrepancy is probably down to constraints on
here is what kind of performance increase you can memory bandwidth, but it’s hard to tell for sure.
look forward to.
Overclocking the CPU from 2.4GHz to 3.0GHz,

2.4GHZ 3.0GHZ

Single-core score 774 906

Multi-core score 1604 1634

Other people, other benchmarks


While that was my benchmark, you shouldn’t just numbers (magpi.cc/jeff5benchmarks) for
take my word for it. You should definitely go look at everything from Ethernet and wireless throughput,
what other people have done around benchmarking to memory throughput, to cryptographic
and performance testing on our new hardware. performance – where Raspberry Pi 5 is 45 times
Because, as you’d expect, after perhaps looking faster than Raspberry Pi 4 thanks to the BCM2712
at thermals (see page 30), the first thing most processor bringing Arm’s Cryptographic Extension
people did when they got their hands on a preview to Raspberry Pi (magpi.cc/a76cryptographic).
Raspberry Pi 5 was to run some benchmarks, which The benchmarks I found the most interesting
gives us lots of numbers and graphs. are the ones are from Seeed Studio, who have gone
As always, Jeff Geerling has performance out and benchmarked Raspberry Pi 5 (magpi.cc/

Cryptographic
benchmarks for
Raspberry Pi 4 and
5 by Jeff Geerling

74 magpi.cc Benchmarking Raspberry Pi 5


seeed5benchmarks) using the ncnn framework
(magpi.cc/ncnn).
The ncnn benchmark (magpi.cc/
ncnnframework) is a deep-learning inference
framework that supports various neural network
models – such as PyTorch and TensorFlow –
and a range of hardware. Designed with mobile
deployment in mind, it offers GPU acceleration via
the Vulkan API, and it’s been really interesting to
see the sort of performance increases we’re seeing
between Raspberry Pi 4 and 5.
Remember though, unlike my own Geekbench
benchmarks, here smaller numbers are better, and
they were getting some really nice numbers from
Raspberry Pi 5. Testing the YOLOv8n (yolov8.com)
model on Raspberry Pi 5 with a 640×640 pixel video
stream, gave an inference rate of around 12fps.

We’re pretty proud of the


Wrapping up performance improvements
When we launched Raspberry Pi 4 back in 2019,
with its quad-core Arm Cortex-A72 processor
we’ve been able to make
clocked at 1.5GHz, it was around 40 times faster
than the original Raspberry Pi model from 2012.
But Raspberry Pi 5, with its quad-core Arm
Benchmarks results
Cortex-A76 processor clocked at 2.4GHz, means showing the
we now have between two and three times We’re pretty proud of the performance performance
improvements from
the CPU and GPU performance again; roughly improvements we’ve been able to make. But Core Electronics
(magpi.cc/
twice the memory and I/O bandwidth; and for best of all, is seeing folks out in the wild core5benchmarks)
the first time we have Raspberry Pi silicon on a finding out exactly how far we’ve come in the
flagship Raspberry Pi device. last few years.

Some ncnn
framework
benchmarks from
Seeed Studio

Benchmarking Raspberry Pi 5 magpi.cc 75


REVIEW

PicoVision
(Pico W Aboard)
Pimoroni magpi.cc/picovision £35 / $37

SPECS This pocket-sized digital video stick brings Pico


games and more to the big screen. By Phil King
FEATURES:
Pico W, separate

A
RP2040 (GPU),
imed mainly at fans of retro gaming and for programming in MicroPython or C/C++, or
2 × 8MB PSRAM,
PCM5100A DAC old-school programming, PicoVision is flashing Pico W with new firmware.
for audio, 3 × user a surprisingly capable digital video stick Alternatively, PicoVision can be powered via two
buttons, status with a pre-soldered Raspberry Pi Pico W on board. unpopulated pins. There’s also a breakout header
LED, reset button, Using Pico W’s RP2040 microcontroller chip as for CPU and GPU debugging, plus a few other GPIO
microSD card slot
the CPU, it adds a second RP2040 to act as a GPU to pins. A single Qwiic/STEMMA QT port can be used
CONNECTIONS: help handle the big-screen visuals. Two extra 8MB to connect I2C breakouts or sensors.
HDMI video out, RAM chips are used to swap frame buffers between On the front of the board are three user buttons,
3.5mm audio line the two RP2040s, enabling PicoVision to output an activity LED, and a handy reset button. At the
out, breakout
reasonably high-res graphics (for a microcontroller) rear is the bonus of a microSD card slot to provide
header, Qw/ST
port, micro USB to a monitor via a standard HDMI output. extra storage for assets such as graphics.
(on Pico W) The only slight drawback is that it’s not able to

DIMENSIONS:
output audio via HDMI. For this, there’s a 3.5mm Instant menu
87 × 38 × 9mm stereo line out jack to connect a pair of PC speakers Getting started is as easy as connecting PicoVision
or headphones. to an HDMI monitor or TV and powering it up. It
Power is connected using Pico W’s micro USB comes pre-flashed with MicroPython firmware
port – as usual, you can hook this up to a computer that auto-runs a menu of example programs. The

The front of the


PicoVision board
features a pre-
soldered Pico W
and user buttons.
The holes are
an unpopulated
breakout header

76 magpi.cc PicoVision (Pico W Aboard)


REVIEW

On the rear are a


microSD card slot,
Qw/ST connector,
audio line out and
HDMI, plus the extra
RP2040 ‘GPU’ chip

A and X user buttons are used to move up and version of the firmware), with up to ten per any
down through the menu options; and a press of single scanline.
the Y button will select one.
Among the example programs are a fun Start coding
Flappy Bird-style game, magic mirror dashboard, When it comes to programming PicoVision
and Teletext-style headlines – the last two yourself, a comprehensive GitHub repo (magpi.cc/
require connection to a Wi-Fi network. picovisiongh) provides lots of useful info, along
with MicroPython and C/C++ libraries and code
Verdict
 mong the example
A examples from which to learn. The most basic are
Hello World programs to print text to the screen.
With a second
RP2040 and extra

programs are a fun Flappy Graphics are handled using Pimoroni’s standard
PicoGraphics module, while a PicoSynth sound
RAM to boost Pico
W’s capabilities,

Bird-style game, magic module is used to play simple tunes and noises
PicoVision
offers plenty of
using I2S audio from the board’s DAC chip. possibilities for
mirror dashboard, and You’ll also want to try playing classic Doom on retro gaming and
PicoVision – which works really well. Just flash coding projects.
Teletext-style headlines

9
the Doom firmware UF2 to PicoVision and add the
game’s WHX file to a microSD card. For control,

/10
Several graphical demos showcase PicoVision’s you’ll need to connect a USB keyboard via a splitter
capabilities. These include a classic 3D starfield cable (as supplied in the optional accessory kit).
effect (remember Windows 3.1’s screensaver?), a
screen modes menu with numerous resolutions
(some require GPU overclocking), and a parallax
scrolling animation that makes use of PicoVision’s
scroll modes – up to seven groups of scanlines can
be scrolled separately.
Up to 80 sprites can be shown on screen
simultaneously (or 32 with the special widescreen

A scroll groups code example demonstrates the ability


to scroll several areas of the screen independently Yes, you can play Doom on PicoVision! Use a splitter cable to plug a USB keyboard into Pico W

PicoVision (Pico W Aboard) magpi.cc 77


Electronics housings…
as a complete kit.
Available exclusively from our global distribution
and wholesale partners you will find the right
housing for every application.

With wall, desk & DIN rail mounting options our


kits make it easier for you to select the next housing
solution for your electronics design.

For additional information call 01952 681700 or visit


https://phoe.co/housings-kits-uk
RESOURCES

10 Amazing:
3D prints simplyRetro Z5
Comfy and large
Print your own custom project
Some 3D printed handheld consoles are very small and portable, but
pieces for Raspberry Pi sometimes a bigger screen is more comfy. The Z5 offers this.

magpi.cc/retroz5

3
D printing and making go hand-in-hand, and these amazing
prints and projects involving Raspberry Pi are fantastic
ways to upgrade, or even realise your dream project. After
many years, there’s a huge range to choose from – here’s just ten Rapiro
we like.
Bipedal robot friend
Rapiro was a very cool kit
from several years ago
which always had open
source STL files so you
could print your own.

magpi.cc/rapirostl

RaspBMO ZeroBot
Friendly console Practical and small
While this BMO will be able to emulate games, it’s also just a nice This cool looking robot for Raspberry Pi Zero is great for remote
thing to have sitting on your desk. controlling and looking where you’re going with computer vision.

magpi.cc/raspbmo magpi.cc/zerobot

3D prints magpi.cc 79
RESOURCES

Pipboy 3000 MKIV


NinTastic
Perfect cosplay prop
We’ve seen many iterations of a Fallout-inspired Raspberry Pi-powered Retro gaming case
Pipboy over the years, and this is one of the best. If you want to give your retro gaming Raspberry Pi a more suitable
home, check out this great case.
magpi.cc/piboy3000
magpi.cc/nintastic

Gameboy
NANO
Small and portable
This very tiny handheld console
fits Raspberry Pi Zero – upgrade
to Zero 2 and watch it really fly.

magpi.cc/gameboynano

C
 ase with
Tank Bot camera mount
Treads for grip Goose neck mount
There are many robots on Thingiverse – we quite like this one as it can be
Watching your 3D printer with a
used for rough terrain better than normal wheels
3D-printed Raspberry Pi stand may be
a little meta, but it’s fun and useful.
magpi.cc/tankbot
magpi.cc/casewithcam

R
 etro
desktop tower
FreeCAD for Makers
Nostalgic protection
Fancy making your own 3D
More powerful than a ’90s PC, and a prints? Our colleagues at
neat way to present Raspberry Pi. HackSpace magazine put
together a great resource for
magpi.cc/retrotower designing 3D models in FreeCAD

80 magpi.cc 3D prints
Your FREE guide to
making a smart TV

BUILD A RASPBERRY PI
MEDIA PLAYER
Power up your TV and music system

raspberrypi.com
FROM THE MAKERS OF THE OFFICIAL RASPBERRY PI MAGAZINE

magpi.cc/mediaplayer
RESOURCES

Learn Scratch
with Raspberry Pi
Resources to help you start coding with
the block-based language. By Phil King

Code Club Scratch Modules


Raspberry Pi Part of the Raspberry Pi categories) and stack them
AUTHOR

Foundation Foundation, Code Club is all together to build programs


about getting young people to to control interactive sprites
Price: learn to program, whether by on a ‘stage’. So it’s ideal for
Free
taking part in free coding clubs complete beginners to learn
magpi.cc/ around the globe or from home the key concepts of coding.
codeclubscratch
using a host of online resources Code Club’s three
– including a set of modules Scratch modules progress
based on Scratch. in difficulty and take you
Created by the MIT Media Lab, through aspects such into sections: Explore (get new
this block-based programming as sprites, loops, variables, skills), Design (make design
language enables users to conditionals, and Boolean decisions), and Invent (create
drag and drop various blocks logic. Each module comprises a new solution). It’s a fun and
(arranged into colour-coded six projects to create, arranged effective way to learn.

Reading material
Books to help CODING WITH SCRATCH sturdy cards covering various projects
Part of the QuestKids series aimed at – such as Pong Game and Virtual Pet
you learn youngsters, this colourful 80-page – with instructions to make them.
Scratch coding guidebook sees the cartoon gang nostarch.com/scratchcards3
show you how to create platform
games. There’s also a second Scratch CODING FOR BEGINNERS
book that covers driving games. USING SCRATCH
magpi.cc/qkscratch This appealing spiral-bound Usborne
book helps you to get started with
OFFICIAL SCRATCH Scratch and create a range of projects
CODING CARDS including animations and simple
This set of 76 flash cards breaks games. There are also handy tips and
simple projects down into easy-to- links to working projects.
follow steps. There are ten sets of magpi.cc/usbornescratch

82 magpi.cc Learn circuits with Raspberry Pi


RESOURCES

Scratch Ideas
MIT Media Lab A popular section of the official with an educator guide if you’re
Online
AUTHOR

Scratch site, Scratch Ideas helping someone to learn. Upon


Price:
Free
is where you’ll find a bunch
of helpful activity guides,
clicking ‘Try the tutorial’, you’re
presented with the usual online
courses
scratch.mit.edu/ideas including a Getting Started Scratch interface with a floating
one for newbies. window. The latter plays a Free Scratch
Each guide offers a set of short introductory video before courses to join
coding cards to download, along proceeding to a multi-step guide
that shows you everything you
need to complete the project.
It’s an effective way to learn
how to use the numerous blocks
and features in Scratch.
There’s also a set of starter
projects to remix, in five
categories – animation, games, EDX CS50 SCRATCH
interactive art, music and dance, Created by Harvard, this self-
stories – that showcase the paced three-week introduction
versatility of Scratch. to Scratch forms part of the
university’s renowned CS50
computer science course.
Concepts covered include
functions, events, conditions

Scratch Team
loops, and variables.
magpi.cc/cs50scratch

YouTube Channel TOWER DEFENCE GAME


Aimed at beginners and
Scratch Team If you like to learn by watching There are also guides to making intermediate coders, this
AUTHOR

videos, the official Scratch Team different types of projects, video series shows how to
Price: channel on YouTube is an ideal including a Pong game and set up a basic tower defence
Free
destination. Tutorials include virtual town. game, add game logic and
youtube.com/
how to remix the built-in The Tips & Tricks selection rules, design UI elements,
@ScratchTeam
Scratch sprites, create new ones, covers useful pointers in two incorporate sound and music,
import your own drawings, categories. ‘Unlock the Block’ then test and debug it.
plus add and record sounds. videos help you to ‘unlock magpi.cc/scratchtdgame
the magic’ behind some of
the key Scratch blocks, while
‘Scratching the Surface’ is a 5 PROJECTS IN 5 DAYS
series of one-minute videos Subtitled ‘Scratch Game
that explain intermediate-level Programming for Kids’, this
coding concepts. beginner-level course by the
You’ll also find some Create- Little Apple Academy shows
Along videos of livestreams in how to create five simple
which the Scratch Team create interactive animations and
a project in an hour, along with games. Video-based, it’s fun
Scratcher Stories and video to follow.
updates from the team. magpi.cc/5projects

Learn circuits with Raspberry Pi magpi.cc 83


INTERVIEW

Jorvon
Moss
A maker and roboticist known commonly as
Odd Jayy, Jorvon creates cool stuff for Digi-Key

> Name Jorvon Moss > Occupation Technical Content Creator


> Community role Maker > URL magpi.cc/oddjay

I
f you’ve been to major
Maker Faires in the US
recently you’ve likely see
Jorvon, aka Odd Jayy, and his
amazing steampunk creations.
Sometimes robots, sometimes
wearables, and always very
cool. He describes himself as
an oddity, hence the name
Odd Jayy.
“I have an art background,
BFA in Illustration, and self-

 e describes himself
H
as an oddity, hence
the name Odd Jayy
taught electronics. but mainly
focus on character based
robotics,” Jorvon tells us. “I
just decided to start [making]
one day in college as a hobby
but then realized it was a
passion of mine. I started
learning back in 2014, but it has
only been my full time job for
the last two years.”

When did you learn about


Raspberry Pi?
I learned about Raspberry Pi
back in 2014, and to be honest Binary 2.0 is a cute robot that Jorvon hopes to bring to events

84 magpi.cc Jorvon Moss


INTERVIEW

Meet M3RVN, the


AI-powered, shoulder-
perched robot

Jorvon is always
working on
new robots

I broke my first Raspberry Pi What’s your favourite


by trying to solder directly onto creation you’ve made with
the board, but I have learned Raspberry Pi?
since then and Raspberry Pi My favourite thing made with
is now one of my personal Raspberry Pi so far has been
favourite boards. my AI robot M3RVN and my
bubble-blowing robot Binary.
How do you like to
use Raspberry Pi stuff What inspires your creations?
(including Pico)? Sci-fi inspires my work, movies,
I like to use Raspberry and books. I love making fun
Pi in a lot of my projects robotic designs and imagining a
and I love Pico. I use Pico world they live in.
a lot now, being a very
strong and easily accessible Where can we see your stuff?
microcontroller. But when You can find most if not all my
I want a robot with a lot of work on instagram.com/odd_
computing power I grab a Jayy and my documentation on
Raspberry Pi 4 and now 5. magpi.cc/oddjay Jorvon loves to use Pico in his builds

Jorvon Moss magpi.cc 85


THIS MONTH IN RASPBERRY PI

MagPi
Monday
Amazing projects direct from social media!

E
very Monday we ask the question: have you
made something with a Raspberry Pi over
the weekend? Every Monday, our followers 01
send us amazing photos and videos of the things
they’ve made.
Here’s a selection of some of the awesome
things we got sent this month – and remember to
follow along at the hashtag #MagPiMonday!!

01. 
We like a nice custom home sensor suite
02. 
3D printing cases is a great way to keep
your Raspberry Pi safe
03. 
A nice live light is useful whether you’re
working from home or streaming on Twitch
04. This is cool and we love how low-tech and
cheap this solution is
05. The Digital Maker badge is something we
wish we had when we were kids
06. Wonder what the scale of this is compared
to the original
07. This is a cool little project – check out
HackSpace 55 and Andy’s Hackaday
for more info 02
08. Kev’s robots invaded Italy recently, with
some Raspberry Pi 5 power ups
09. Sound catcher or sound shooter? Do
you need a sight for sounds? We have
many questions…

86 magpi.cc MagPi Monday


THIS MONTH IN RASPBERRY PI

03

04

05

06

07

08

09

MagPi Monday magpi.cc 87


THIS MONTH IN RASPBERRY PI

Events in pictures:
Raspberry Pi 5 launch
at the Raspberry Pi Store
Raspberry Pi 5 is here! We caught up
with folks buying their boards on day one

I
n the Grand Arcade at Cambridge, the
01
Raspberry Pi Store usually opens at
a reasonable 10am but on Monday 23
October we were there at a pre-dawn 7:30
am to witness the release of Raspberry Pi 5
at 8am. While there weren’t the huge lines
you’d see at a pop up, a handful of die-hard
Raspberry Pi fans were ready to get their new
everything computer.

01. 
People were able to reserve their
Raspberry Pi before hand or just buy
one if they fancied on the day
02. 
Boards, PSUs, cases, and coolers
were available to grab
03. 
Experience Raspberry Pi 5 at the
store before buying one
04. 
The calm before the storm with
Features Editor Rob
03
02
04

88 magpi.cc Mondays
Coolest
Events inProjects
pictures
are for Pico
online!
THIS MONTH IN RASPBERRY PI

Crowdfund this!
Crowdfunding projects for Raspberry Pi accessories

MULTI-IO HAT CrowVision


“The MULTI-IO HAT combines two of each of the most We reviewed CrowVision a few issues ago and thought it was
needed interfaces used in industrial automation: digital a great display for many kinds of Raspberry Pi projects. It’s now
and analogue inputs up for crowdfunding and already passed its goal. The Crow line
and outputs, RTD has always been good, so we’re looking forward to seeing more
measurement and displays in this vein too.
relays. Expandable
to eight layers, it
can perform from
the simplest to
the most complex
industrial and home
automation tasks.”

kck.st/3QcioER magpi.cc/crowfund
YOUR LETTERS

Your
Letters
Priority boarding period
I have been on holiday and found out about the priority
boarding codes long after the magazine came out – is
it too late for me to get one of these codes?

Susan via email

Priority Boarding is something we’ll be honouring for


new print subscribers for the near future – go and check
magpi.cc/priorityboarding for info on this. Codes can
take up to two working days to be sent out.
If you’re an existing subscriber and still don’t
have your code, please make sure to email us at
[email protected] and we can get it to you.
Head to Victoria Gate in Leeds to see
the Raspberry Pi seasonal pop-up

Leeds pop-up store


I was surprised to see that there was a Raspberry Pi Pi pop-
up store in Leeds the other day – I don’t remember this being
announced? Did I miss a blog or email about it?
We’ve reserved Raspberry Pi 5 boards
for The MagPi subscribers Harry via email
The Leeds Raspberry Pi Store was supposed to be a big surprise and
GET YOUR RASPBERRY PI 5 FIRST! it’s not a weekend pop-up like the rest of the pop-up shops this
year – this one will be open until the end of December. It’s a nice
magpi.cc/priorityboarding big store as well, with many of the features of the one in Cambridge!
Check out raspberrypi.com for more info on the shop, and make
sure to drop by and buy several copies of The MagPi and our books
 ou still have a while yet to get your own Priority
Y
Boarding code to obtain Raspberry Pi 5 faster while you’re there.

90 magpi.cc Your Letters


USA SPECIAL!
6 ISSUES
Back issues
Do you have any copies of issue 123 that I can
order, or are you planning to print any more?
I regrettably missed it and am now looking to
FOR $43
complete my collection.

Az via Facebook

Unfortunately we don’t reprint magazine issues so


when they’re gone, they’re gone. However, after
three weeks each issue becomes freely available as
a PDF on our website (magpi.cc/issues) and you’re
welcome to print it for yourself if the PDF is not
enough for you.

FREE
RASPBERRY PI
PICO W
All our issues are available as PDFs from magpi.cc/issues

Contact us!
> Mastodon magpi.cc/mastodon
>
>
Threads
Facebook
@themagpimag
magpi.cc/facebook
Subscribe online:
>
>
Email
Online
[email protected]
forums.raspberrypi.com
magpi.cc/subscribe
Email: [email protected]

Continuous credit card orders will auto-renew at the same price unless cancelled. A free Pico W is
included with all subscriptions. This is a limited offer. Not included with renewals. 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. Melbourne Raspberry Pi Meetup 03. Cornwall Tech Jam


Sunday 3 December Saturday 9 December
Docklands Makerspace and Library, Fraddon Village Hall, Saint Columb, UK
Melbourne, Australia magpi.cc/ctj136
magpi.cc/mrpm136 Cornwall Tech Jams are run by volunteers working in IT
This meet-up is open to everyone with an interest in and education throughout Cornwall. They are supported
electronics, robotics, home automation, 3D printing, laser by Software Cornwall, its members and other local
cutting, amateur radio, high-altitude balloons, space tech, businesses. Our volunteers give their own time and
etc. Makers are invited to bring along their projects and expertise to plan each Cornwall Tech Jam and to the
project ideas, and come connect with other makers. Get regular maintenance of all our equipment.
your questions answered, show off the work you are doing,
and get support to resolve nagging issues. 04. Mombasa Raspberry Pi Jam Experience
Raspberry Pi 5!
Monday 11 December FULL CALENDAR
Tech Kidz Africa, Mombasa, Kenya Get a full list of upcoming
magpi.cc/rpjm136 community events here:

Raspberry Pi Jam Mombasa is a one-day event for magpi.cc/events


students, teachers, and enthusiasts of robotics and AI.
The Jam will feature workshops, demonstrations, and
hands-on activities.
02. Coventry Raspberry Jam: Show and tell
Thursday 7 December
Blue Coat C of E School, Coventry, UK
magpi.cc/crj136
Blue Coat C of E School is hosting a Raspberry Jam
show-and-tell event in the school theatre. The aim for
this event is for people to bring along the Raspberry Pi-
based projects that they have created and share them
with others. There is plenty of seating available, and also
a projector connected to a desktop computer.

92 magpi.cc Community Events Calendar


EVENTS

04

RASPBERRY PI 01
STORE POP-UP

Raspberry Pi pop-up
Leeds – Experience
Raspberry Pi 5
> Where Victoria Gate, Leeds, UK
> When Saturday 4 November to Saturday 30 December

G
et hands-on with the all-new
Raspberry Pi 5 in our holiday pop-up
02 store on the ground floor of Victoria
Gate in Leeds, England. Experience Raspberry
Pi 5’s blazing performance and check out the
newest accessories. The store will have the full
line of Raspberry Pi products for purchase.
03
magpi.cc/popupleeds

Community Events Calendar magpi.cc 93


Learn coding
Discover how computers work
Build amazing things!

magpi.cc/beginnersguide
COMPETITION

WIN ONE OF TEN


RASPBERRY PI 5
ACCESSORY PACKS!
Enjoying your new Raspberry Pi
5? Make it even better with this
accessory pack, including the
new 27W USB-C PSU, a display
and camera module adapter cable,
and an Active Cooler as well! We
have ten packs to give away.

Head here to enter: magpi.cc/win Learn more: raspberrypi.com/products

Terms & Conditions


Competition opens on 22 November 2023 and closes on 14 December 2023. Prize is offered to participants worldwide aged 13 or over, except employees of Raspberry Pi Ltd, the
prize supplier, their families, or friends. Winners will be notified by email no more than 30 days after the competition closes. By entering the competition, the winner consents to any
publicity generated from the competition, in print and online. Participants agree to receive occasional newsletters from The MagPi magazine. We don’t like spam: participants’ details
will remain strictly confidential and won’t be shared with third parties. Prizes are non-negotiable and no cash alternative will be offered. Winners will be contacted by email to arrange
delivery. Any winners who have not responded 60 days after the initial email is sent will have their prize revoked. This promotion is in no way sponsored, endorsed or administered by,
or associated with, Instagram, Facebook, Twitter or any other companies used to promote the service.

Competition magpi.cc 95
SUBSCRIBE AND

SAVE UP
TO

35% on the cover price

ISSUE #73

hsmag.cc
NEXT MONTH

Start your Raspberry Pi


EDITORIAL
Editor
Lucy Hattersley

ENTU
[email protected]

DV R
Features Editor

E
Rob Zwetsloot

A
[email protected]
Sub Editor
Ian Evenden

ADVERTISING
A beginner’s guide Charlotte Milligan
[email protected]
to mastering +44 (0)7725 368887

single-board computing DESIGN


criticalmedia.co.uk

Head of Design
Lee Allen
Designer
Sam Ribbits
Illustrator
Sam Alder

CONTRIBUTORS
Alasdair Allan, David Crookes, Pj
Evans, Rosie Hattersley, Phil King,
Stewart Watkiss, Ashley Whittaker

PUBLISHING
Publishing Director
Brian Jepson
[email protected]
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,
THE MAGPI #137 Crawley, West Sussex, RH10 9PE
+44 (0)1293 312193
ON SALE 14 DECEMBER magpi.cc/subscribe
[email protected]

DON’T MISS OUT! magpi.cc/subscribe This magazine is printed on paper sourced


from sustainable forests and the printer
operates an environmental management

Build a Beepy MASTODON magpi.cc/mastodon


system which has been assessed as
conforming to ISO 14001.

handheld PC The MagPi magazine is published by


Raspberry Pi Ltd, Maurice Wilkes Building,
THREADS @themagpimag
MyCobot 280
St. John’s Innovation Park, Cowley Road,
Cambridge, CB4 0DS. The publisher,

professional
editor, and contributors accept no
responsibility in respect of any omissions
FACEBOOK magpi.cc/facebook
robotic arm
or errors relating to goods, products, or
services referred to or advertised in the
magazine. Except where otherwise noted,

Recreate the EMAIL content in this magazine is licensed under


[email protected] a Creative Commons Attribution-

Amiga with
NonCommercial-ShareAlike
3.0 Unported
ONLINE forums.raspberrypi.com
floppy drive
(CC BY-NC-SA 3.0).
ISSN: 2051-9982.
THE FINAL WORD

Christmas with
Raspberry Pi 5
Writing about Christmas in early
November is weird, even for Rob Zwetsloot

T
hese Final Word columns tend about turkey dinners and stockings had trouble balancing it on my fake
to be one of the last things on a rainy October evening. tree. I should also get them all
we write for the magazine, automated with voice commands.
meaning that even with print lead Raspberry Pi-powered Anyway, keep an eye on the MagPi
times the context of these columns Christmas socials for anything I decide is
is still fairly fresh. As I’m writing Many of the Christmas tutorials that worth posting.
this, I realise we don’t have one of have appeared in the magazine over
my seasonal features in this issue the years are based on projects I’ve Under the tree
for Christmas – my favourite winter Hopefully you’ll have made use of
holiday! I’m Mr Mince Pie according
to my friends, after all.
Many of the our Priority Boarding offer to get a
Raspberry Pi 5 for yourself or
(Don’t tell anyone, but I might Christmas tutorials someone else who will be opening it
enjoy writing the annual Halloween on Christmas morning. If you’re
feature a little more as I get to that have appeared looking for stocking stuffers, the
embrace my inner crypt keeper and Official Handbook 2024 is a great gift,
alliterate more than is advisable.) in the magazine along with the newly updated
Lucy, MagPi Editor, firmly believes
that Christmas can’t start until after
over the years are Beginners Guide. We work hard on
those to make them extra special, and
Bonfire Night [i’m right –Ed], and
while I understand and respect that,
based on projects they’re a great way for new users to
pick up Raspberry Pi.
I’m full on Christmas mode the I’ve built myself Anyway, have a great holiday and a
moment the clocks turn midnight on happy new year. And yes, we do have
Halloween. Which, if we were to write built myself as Christmas another issue out between now and
a Christmas projects feature, would decorations, although I unfortunately then. The print industry is odd.
have been roughly the deadline for it. broke the 3D-printed star I made
That’s weird, right? I know TV shows many years ago. I’m trying to figure
Rob Zwetsloot
AUTHOR

tend to film their Christmas specials out what to do this year, and I think
in July and It’s a Wonderful Life was I’m long overdue a Pico overhaul of
By the end of October, Rob has consumed
shot during an unusually hot summer some of my lights around my home. more mince pies than most people eat in
with everyone in big coats being Maybe it’s time to make a new star a year. He’s currently considering making
pelted by newly-invented fake snow, ornament? I do need to go back and a Christmas cake.

but it’s still a little odd to be writing make the star itself a lot lighter, as I magpi.cc

98 magpi.cc Christmas with Raspberry Pi 5


HIGHPI PRO
The new case from the HiPi.io team

Rapid tool-free assembly and disassembly Secure microSD card cover


Large internal volume for HATs VESA mount support
Compatible with Pi 2/3/4 Molding-configurable output ports
Multiple lid options customizable for volume orders
Passive & Active Cooling options Printed logo for your branding

Available at these great Pi stores:

Contact your favorite Pi store if it’s not listed here


PiKVM Manage your servers or
workstations remotely

A cost-effective solution for data-centers,


IT departments or remote machines!

PiKVM HAT
for DIY and custom projects Pre-Assembled version

Real-time clock with rechargeable super capacitor OLED Display Bootable virtual CD-ROM
& flash drive Serial console Open-source API & integration Open-source software

Available at the main Raspberry Pi resellers

Reseller suggestions and inquiries:


[email protected]

You might also like