100% found this document useful (1 vote)
133 views100 pages

Mag Pi 144

pdf

Uploaded by

kursad
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
100% found this document useful (1 vote)
133 views100 pages

Mag Pi 144

pdf

Uploaded by

kursad
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 144 August 2024 magpi.cc The official Raspberry Pi magazine

Private Cloud Server


Learn to use AI Kit
Twirly Shirley turntable

£5.99
08

9 772051 998001

IN C R E DI BLE V ISIO N A ND PHOTO P RO JECTS


Industrial Raspberry Pi
ComfilePi
WELCOME

WELCOME
to The MagPi 144

A
ttaching a camera to Raspberry Pi opens up a world
of vision-based possibilities. I can take photographs,
but now thanks to AI Kit my Raspberry Pi can make
smart decisions based on what it sees.
I’ve been having a lot of fun this month with Raspberry Pi’s Lucy

EDITOR
Camera Module and AI Kit. Toby, our maker-in-residence, Hattersley
glued a GorillaPod to the bottom of an official Raspberry Pi Lucy is editor of The
MagPi and is training
case and made a portable smart camera to take out for testing. her camera to detect
a puppy to adopt.
My three-legged camera and AI Kit creation has yet to get a Don’t tell her pet
tripod project.
name (PiTriPod, maybe?)
magpi.cc
Read all about how to set up AI Kit on Page 46, Camera on
Page 56, and amazing camera projects to try out on Page 62.
Of course, what makes Raspberry Pi special isn’t just the
board but what you can make with it (just about anything,
really!) Our Essential Electronics guide on Page 32 has
everything you need to start making your own circuit
GET A
creations with Raspberry Pi.
RASPBERRY PI
Nothing beats building a
PICO W
good project.
PAGE 30
Lucy Hattersley Editor

magpi.cc 03
CONTENTS

Contents
> Issue 144 > August 2024

Cover Feature

32 Essential Electronics 32
ESSENTIAL
ELECTRONICS
Regulars
08 World of Raspberry Pi
26 Case Study: Revolution Pi
90 Your letters
92 Community events calendar
97 Next month
98 The Final Word

Project Showcases
14 LinAmp
18 Andotrope 22
22 Twirly Shirley
24 Video magnifier

18

Andotrope Twirly Shirley

The MagPi is published monthly by Raspberry Pi Ltd, 194 Cambridge Science Park, Milton Road, Cambridge, England, CB4 0AB. 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 46 52
40 Search PDFs wth Python
46 Adding the AI Kit to Raspberry Pi
52 Build a private cloud server
56 Photos and video with rpicam
Meet the AI Kit Build a private
Xxxxxxxxxxxx
cloud server
The Big Feature
70
62

Photography projects
ArmPi FPV AI vision

Reviews 84
70 ArmPi FPV AI vision
72 TouchBerry Pi Panel PC 10.1”
74 LoRaWAN HAT + Gateway Module
78 Ten amazing big builds
81 Learn databasing

Community
84 John Sheehan interview
86 This Month in Raspberry Pi John Sheehan and Raspberry Jam

WIN HOME ASSISTANT YELLOW 94

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
Raspberry Pi finds a new home
Versatile enclosure for Raspberry Pi B+
The new UCS Universal Case System is now available with ready made cut-outs for
the 7” touch display and standard connections of the Raspberry Pi B+ single board
computers. The 237 x 195 x 47mm housings are available in black or grey and are
suitable for wall or desktop mounting

For additional information call 01952 681700 or visit


https://phoe.co/ucs-series
THE WORLD OF RASPBERRY PI

Raspberry Pi at
Open Sauce 2024
We had quite the weekend with makers in San Francisco.
By Ashley Whittaker

S Kevin McAleer had many creations to demonstrate

W e’re just back from Open Sauce 2024


(opensauce.com) and I don’t think
we’ve ever seen so many makers,
tech enthusiasts, and YouTubers all together
in one place before. This year’s Open Sauce
expanded into the Cow Palace venue in San
Francisco and definitely felt more gigantic than
last year’s inaugural event. Our poor feet; please
send help for our feet.
The event combines the best of makers and
creators, featuring interactive exhibits, an up-
S Open Sauce took place at Cow Palace, Daly City,
close look at maker technology, talks, panels,
here being destroyed by a model robot and small workshops with top YouTubers.

08 magpi.cc Raspberry Pi at Open Sauce 2024


THE WORLD OF RASPBERRY PI

Thanks again to everyone


who stopped to talk to us
about your creations
X Kev’s Voltara Fortune Teller prints fortunes of
varying accuracy at the push of a button

Pi-powered creations everywhere


It was excellent to meet so many makers who had
brought their Raspberry Pi-powered creations
to Open Sauce. Over the coming weeks, we’ll be
blogging about as many of them as we can: there’s
a penny press, an ocular impairment assessment
tool, a Connect 4 clock, and a photo booth inside a
vintage camera.
We were too busy perusing the maker booths to
get to the panels, but we did set eyes on a handful
of YouTubers as they popped out to meet people
in the main halls. It’s an incomplete list, but we
spotted Mark Rober, Adam Savage, The Hacksmith,
Ruth Amos, Estefannie, and Becky Stern, whose pet
cat and mermaid hair we enthused about recently.
Special shout-out to Tex Kang’s (not Pi-powered PIZ dispensers and fortune tellers
but still cool) AI tote bag printing station. We Jeff Geerling gave away 480 Raspberry Pi Picos at
asked it to print us a raspberry pie PCB, and it did the end (that’s an entire reel!) and he didn’t just
a pretty good job. hand them out like a civilian. He (of course) over-
engineered an eye-catching alternative.
W This PCB decorated
Jeff went for a little nostalgia hit, copying the like a raspberry pie
iconic PEZ dispenser design but blowing up the size (or possibly a tart)
was printed by an
so it was big enough to hold loads of Picos rather AI-powered system
than those impossibly tiny candy capsules. We
didn’t actually manage to cross paths with Jeff this
year, so vast was the venue, but we did see his PIZ
dispenser taking a rest at Kevin McAleer‘s (magpi.
cc/kevinmcaleer) booth. There we also had our
fortune read by a robot named Voltara, inspired by
the Zoltar machine from the movie Big.
Kev made Voltara (magpi.cc/kevfortune)
especially for Open Sauce. It’s powered by a
Raspberry Pi 4 and features a thermal printer and
arcade-style buttons.
Thanks again to everyone who stopped to talk to
us about your creations. We were overwhelmed by
the number of Pis in the wild we spotted. We can’t
wait to see you again next year.

Raspberry Pi at Open Sauce 2024 magpi.cc 09


THE WORLD OF RASPBERRY PI

Raspberry Pi
Connect updated
Remote shell access and support for older devices.
By Chris Lowder

A month and a half ago, we launched Remote shell access


S Raspberry Pi Connect
enables you to
remotely access
Raspberry Pi Connect (magpi.cc/connect), The new remote shell feature in Raspberry Pi
Raspberry Pi OS, giving you simple, remote access to Connect enables you to launch a shell on your
and now works
with all Raspberry
your Raspberry Pi straight out of the box, from Raspberry Pi device from a web browser, over
Pi computers anywhere in the world. Since then we’ve been a secure connection.
listening to your thoughts on what you’d most This provides access to your Raspberry Pi
like to see from the service: today we’re excited without a desktop environment, extending
to announce the latest beta release, bringing support to older devices as well as devices
Raspberry Pi Connect to even more devices. running Raspberry Pi OS Lite. Remote shell
Today’s release includes remote shell access and access also works much better over low-
support for all Raspberry Pi computers, whether bandwidth connections than screen sharing,
they’re running Raspberry Pi OS 32-bit or 64-bit, making it a handy option to have.
going all the way back to the 2012 Raspberry Pi To get started with remote shell on
1. This includes Raspberry Pi OS Lite, as well as Raspberry Pi OS Lite, run the following
versions of Raspberry Pi OS with the desktop. commands:

10 magpi.cc Raspberry Pi Connect


THE WORLD OF RASPBERRY PI

W Login to Raspberry
Pi Connect with your
Raspberry Pi ID

sudo apt update use these new features in their projects. If you
sudo apt install rpi-connect-lite haven’t dipped your toe into the water yet, our
Raspberry Pi Connect documentation (magpi.
Then, sign in using the rpi-connect command cc/connectdocs) has everything you need to
line interface: get started.

rpi-connect-signin

Visit the verification URL on any device and


 e hope this will make it a little
W
sign in to link your Raspberry Pi with your
Raspberry Pi ID.
bit easier for people to keep older
You also get expanded support for Raspberry Pi Raspberry Pi computers in service
devices. Starting with this latest release, version
1.2, Raspberry Pi Connect now supports all 32-
bit Raspberry Pi computers, as well as 64-bit
W Connect now
computers. All devices get remote shell out-of- features remote
the-box, and if you use a Wayland compositor, shell access

such as Wayfire, you can also share your screen.


In practice, this means you can use screen
sharing with Raspberry Pi 4 and later models,
and remote shell with all models of Raspberry
Pi, even the oldest.
We hope this will make it a little bit easier
for people to keep older Raspberry Pi computers
in service doing useful stuff. Plenty of remote
headless applications, for example, don’t need
the performance of Raspberry Pi 4 and 5, but still
benefit from straightforward remote access.
We’re looking forward to seeing how people

Raspberry Pi Connect magpi.cc 11


THE WORLD OF RASPBERRY PI

New edition of
Code the Classics
An updated edition of the game programming guide
with new chapters is on sale now. By Brian Jepson

W Code the Classics Volume 1, Second Edition is now available

Retrogamers of certain generations will


remember the days of type-in computer game
listings. Nearly every computer magazine, from
ANALOG Computing (magpi.cc/analogcomp) to The
Micro User (magpi.cc/microuser) featured code
listings that you’d have to type into your computer.
There were books, too, like the ubiquitous Usborne
books (magpi.cc/usborne). You’d trade an hour or
two of your time for an experience that was just as
good as games from your local computer store.
This new edition of Code the Classics Volume I
features retro arcade games written by Raspberry
Pi co-founder and CEO Eben Upton, ably assisted
by Andrew Gillett and Sean Tracey. Dan Malone
(famous for his work with The Bitmap Brothers,
magpi.cc/danmalone) created the game graphics,
and long-time game audio pro Allister Brimble
(allisterbrimble.com) provided the music and
sound effects. David Crookes and Liz Upton wrote
the stories that take you behind the scenes of the
creation of the five classic arcade games featured

O
in this book.
ur retro-gaming classic went on sale You won’t have to type in these games, though.
back in 2019, and this year we’re We’ve set up a GitHub repo with all the source
releasing the new edition of Code the code (magpi.cc/codeclassicsgit). However,
Classics Volume I. The biggest update is the we’ve printed abridged listings in the book to
addition of three new tutorials covering Python, approximate the type-in experience.
Pygame Zero, and Git for version control. These The simple act of typing in a game helped to
new tutorials will make working with the code familiarise you with a programming language
examples easier for beginners. (such as BASIC). By making mistakes, you could

12 magpi.cc New edition of Code the Classics


THE WORLD OF RASPBERRY PI

T he simple act of typing


in a game helped to
familiarise you with a
programming language
S There’s no finer way
to learn to code than
start to understand what other, more intentional • Boing!: all it took was a couple of lines and a typing out a program
changes might accomplish. Some of Eben’s earliest dot, and gamers would be queuing up to play. from a book
games started off as heavily modified versions • Cavern: Enduringly popular, the platform game
of type-in listings. In fact, one of these made a genre is still packed with creative possibilities.
sneaky reappearance (magpi.cc/ebenbbc) on this • Infinite Bunner: Play around with the benefits
blog back in 2018. that a top-down perspective can lend to the
In this new edition, you’ll meet these vintage- classic platform genre.
inspired games, and learn from their code in • Myriapod: Some shooters confine the gameplay
between rounds of play: to a single screen while limiting the player’s
movement. Restrictions can build challenge and
difficulty, making for truly addictive gaming.
• Substitute Soccer: Top-down games of pinball-
style soccer kicked off a sports genre that’s
still going strong.

Stay tuned, because we’ve been hard at work on


the second volume of Code the Classics. Volume II will
feature all-new games and interviews. Get your
copy today: magpi.cc/codetheclassics!

S Recreate classic arcade and video games in Python code

X Can you believe they did Machine Code for Beginners?

New edition of Code the Classics magpi.cc 13


PROJECT SHOWCASE

Linamp
Adore music from the 1980s and 1990s? Then wind back
time and play your tracks on this Winamp/hi-fi-inspired
set-up. David Crookes gets into the groove

W hen looking to play MP3 music files


for a good while from the late-’90s
onwards, Microsoft Windows users
would tend to migrate towards the Winamp
media player. Originally released in 1997 and
the new manufacturing services we have now,
It wouldn’t be too hard to replicate some of the
construction techniques of my old Aiwa system,
so I set out to learn how to design sheet metal
parts, which was in itself a fun exercise to do.”
developed by Justin Frankel and Dmitry Boldyrev,
Winamp’s skeuomorphic user interface soon Physical
Rodrigo resembled a compact stereo system. It was Rodrigo based his build around a Raspberry Pi
MAKER

Méndez instantly accessible and it certainly caught the 4B with a 32GB microSD card. “I decided to
attention of a young Rodrigo Méndez – so much use the Raspberry Pi because of the software
Rodrigo is a so, he’s based a cool Raspberry Pi project on it. support and extensive documentation and online
software engineer,
hardware hobbyist “I remember when I first got my own PC – an resources,” he said. “In the past, I’ve completed
and industrial 800Mhz Athlon with Windows 98,” he recalls. projects with other single board computers and
design aficionado “My cousin installed Winamp in it and gave me I’ve always found small details that made their
from Mexico. He’s
some MP3s to play. At that time, seeing music usage much more complex, for example, limited
been tinkering with
hardware since 2010. coming from a PC, and having the visualisations documentation on how to do lower level things
move in real time to the music was unbelievable like interfacing with special displays, controlling
magpi.cc/linamp
to me because my previous experience with the boot process, or even just supporting recent
computers had been an old MS-DOS PC that Linux kernels.
my dad had at work.” “Since this was a hobby project, I didn’t want
For his project, Rodrigo wanted to bring to spend too much time figuring out those details
Winamp’s early days back to life in a more on other SBCs. Also I chose Raspberry Pi 4 because
physical form so he decided to produce a music it was the latest model at the time I started the
player that could easily be part of a hi-fi mini project. Raspberry Pi 5 was announced after I’d
system. Specifically, he took inspiration from a begun and I figured I didn’t really need that
Aiwa mini setup from around 1983, figuring he device’s performance anyway.”
could create a case and have all of the functions At first, Rodrigo toyed with the idea of making
available on a front touchscreen display. the front face physical. “I wanted to add real-life
One thing he noticed was the simplicity of buttons using a 3D printer and I was going to
design of the old devices. “Old electronics, design a custom PCB for the interface,” he says.
especially audio devices, managed to look high- But he couldn’t find screens with the correct
tech and yet elegant,” he explains. “They managed size and dimensions for the spectrum analyser
to fit in well with people’s home décor while using and song information displays that needed to be
relatively simple construction techniques such included to remain faithful to Winamp without
as sheet metal or wood. I thought that, with all making the build too complex.

14 magpi.cc Linamp
PROJECT SHOWCASE

The intention was always to create


a standalone appliance. The casing
was designed with a square hole
so that a custom back panel could
be created to host the connections

Quick FACTS
> It’s a music player
inspired by the
Winamp app
Rodrigo had considered a front
cover 3D printed on Nylon but
> All of the
he opted for a multi-colour 3D The touchscreen display has been
functions are on
print created on his Bambulab based on Winamp 2.0’s Base Skin. This
a touchscreen
P1S 3D printer instead version was released in 1998 – two
years before Rodrigo got his own PC > The software
has been written
from scratch

> The case design


is based on retro
hi-fi systems

> It cost around


$700 to make

W This is the Aiwa


stereo tuner and
amplifier which
inspired Rodrigo
to create his own
retro hi-fi device

Linamp magpi.cc 15
PROJECT SHOWCASE

“Making it physical would have made it less


flexible as well,” he adds. For example, I would
not be able to have the playlist view in the same
display, which would make the device bigger and
clunkier so I decided to go with a touchscreen.”
This, he figured, would stretch across the entire
front of the device and include all of the buttons
as part of the UI. He reckoned his background as
a software engineer meant this would prove to be
relatively straightforward.

A little more love


Rodrigo opted for a 7.9-inch extra-wide screen
and he created the case using sheet metal, sending
his Onshape designs to PCBWay so they could be
produced using 1mm anodised aluminium. He’d
closely analysed his Aiwa system so he could figure
the correct dimensions and overall look and, for
convenience, he placed a power button, Ethernet
port, USB-A and USB-ports and 3.5mm stereo jack
at the back.
The majority of his time was spent on the
software, however. He created a custom Qt 6 app
which he wrote in C++. “Replicating the layout
itself wasn’t that hard, it was just a matter of
S A Raspberry Pi 4
forms the heart getting rough dimensions at first and drafting
of this build. It is the UI in Qt Creator using the graphical Qt
connected to a
generic 7.9-inch
touchscreen display.
Extension cables
allow for rear ports

X Rodrigo is looking
to create Linamp
devices for sale and
wants the community
to help him figure the
logistics by filling in
survey at magpi.cc/
linampsurvey

16 magpi.cc Linamp
PROJECT SHOWCASE

Pump up the volume

First of all, press the power button on the back


01 of the device to turn it on. The screen will
remain blank while Raspberry Pi boots directly into
the Linamp UI. Once done, it’s ready for the selection
S Linmp can play MP3, M4A,
Widget designer interface, and then fine tuning FLAC files and more. You and playing of music.
dimensions by comparing screenshots in GIMP,” can control the output
volume and balance too
he explains. “The complex part was replicating the
spectrum analyser and getting the raw audio data
to feed it. I did a lot of research and looked into
other open-source projects’ code to get ideas and
code to base my solution on.”
It’s proven to be a very vivid, eye-catching
solution and it doesn’t feel as if any compromises
have been made. Above all, it has the intended
nostalgic flavour thanks in the main to the
spectrum analyser and the way the name of the
song and artist scroll across the top. It also retains
the intuitive UI in full, so songs can be selected
Touch the PL or Eject button in the UI and
and played in no time. “Linamp supports playing 02 you’ll go to the Playlist view. A file browser lets
you navigate the Raspberry Pi filesystem, starting at

I looked into other open-source projects’ the ~/Music folder by default. Songs can be stored
on a home server or USB drive.

code to get ideas and code


music CDs from a CD/DVD drive connected via USB
as well, but you need to use a powered USB hub in
order for the drive to work, otherwise Raspberry
Pi may not have enough power for the external
drive,” Rodrigo adds.
Yet despite being feature packed, Rodrigo wants
more. He’s also been overwhelmed by the positive
reaction from people who have seen the project
and he is working on adding Spotify playback
and Bluetooth. “It had an amazing response,”
Select music files and click a button to add
Rodrigo says. “I never imagined it would have 03 them to the playlist then start playing your
been that popular, especially on YouTube, where I fabulous tracks. The track information is displayed
uploaded a quick video of how the UI works as an along with the bitrate and sample rate and there’s a
afterthought.” With more than 100,000 views, we real-time bar spectrum analyser.
don’t think we’ve heard the last of this project.

Linamp magpi.cc 17
PROJECT SHOWCASE

Gehn Imager
Andotrope
Replicating a beloved display from a favourite
game yielded amazing results for one Raspberry Pi
maker, discovers Rosie Hattersley

M ike Ando loves making things in his


spare time, and uses a Raspberry Pi
“because they’re so easy and save me
time implementing things”. Even so, he’s just
spent eight months designing his own take on
Gehn’s holographic imager from the game Riven,
the sequel to puzzle adventure Myst. As well as
Mike displaying images and playing video clips, it can
MAKER

Ando be used for video calls and games. “Basically, I’ve


brought a 150-year-old children’s toy into the
DeLorean driver 21st century.” Actually, the Australian systems
Mike looks after IT
for a small business administrator has created two such ‘andotropes’.
and says others The second version uses Pico W which is much
describe him as smaller and cheaper and doesn’t use so much
a time-travelling
expensive and heavy brass, but The MagPi was
mad scientist
especially taken with his original, Raspberry Pi
magpi.cc/
andotrope 3 model which requires no CGI or other visual
trickery and uses two back to back 10in tablets:
magpi.cc/andotropeyt.
who successfully pulled this off before, I’m calling
New tricks any display you could build that’s similar to this by
If ‘andotrope’ sounds unfamiliar, that’s because the generic term ‘andotrope’”.
it is a word Mike coined, having almost by chance The whole imager is actually 60% scale of the
ended up creating a new form of display. His original in-game one. “The original was just
hologram-like display sits inside a spherical cage impractically large and everyone who has seen it
X Mike managed constructed from around 12m (40ft) of 6mm brass in-person (including the game’s creators) thinks
to display his
own image in the
tube. “It doesn’t quite meet the definition of a my one is the right size and big enough,” explains
andotrope zoetrope, and because I couldn’t find anyone else Mike. His confident stance is not easily merited:

18 magpi.cc Gehn Imager Andotrope


PROJECT SHOWCASE

Quick FACTS
> The andotrope’s
display looks like
Two 10in Android tablets a normal screen
spin around at 1,200rpm
inside the brass cage. > It’s omnidirectional
Persistence of vision kicks and has no backing
in, creating an illusion of or sides
movement just like video
> Which is ideal for
groups viewing
it at once

> The 60% scale


replica weighs 13kg
and is 71cm tall...

> …and now sits in


the HQ of games
company Cyan,
which made Riven

Screens rapidly rotating behind


brass strips create an incredible
‘holographic’ display similar to
Raspberry Pi 3 controls and Gehn’s Imager in the game Riven
synchronises everything, including
the motor, DAC audio HAT, tablets
and MQTT connections

Gehn Imager Andotrope magpi.cc 19


PROJECT SHOWCASE

 t 1,200rpm, persistence
A
of vision kicks in, creating
an illusion of movement
just like video

S Construction was a X A still from Riven


lengthy process showing the Gehn’s
Imager Mike has replicated

20 magpi.cc Gehn Imager Andotrope


PROJECT SHOWCASE

Mike is a self-taught maker and IT specialist Use your illusion


who drives a DeLorean to maker events where
his take on Myst’s linking book has gone down a
storm: magpi.cc/mystbook.
Mike had not made anything with Raspberry
Pi before, but it seemed ideal for the andotrope
because he “needed a small, powerful computer
with a lot of capabilities. Something that can blink
lights on and off very well wouldn’t cut it for this
project. An Arduino or ESP32 microcontroller just
isn’t powerful enough, and a full desktop x86
computer would be such a hassle”. Raspberry Pi
is used as a central computer to act as the master
control device – the main hub that controls and
synchronises everything. It handles the user input
and the local Wi-Fi network, it communicates The back-to-back Android tablets, motor and
to the tablets via MQTT, it manages the Arduino 01 stepper controller, plus wireless access are
Pro Mini motor controller and DFRobot DRI0042 all Raspberry Pi 3B-controlled.
motor driver, and it plays back the audio. “I’m
quite impressed with how much it can manage
simultaneously!” says Mike.
Mike used ChatGPT as the starting point for
his code, manually editing it, “fixing the edge
cases” and expanding its scope. He then focused
on finessing the displays so the two tablets were
synchronised and phone photos and videos looked
good. There were also tweaks to the andotrope’s
rotational speed and adjustments to the width of the
viewing slit to improve the illusion of movement.

Brassed off Toggles on the outside of the case trigger


“Brass is a beautiful metal but I find it a pain to 02 the content to play, while Raspberry Pi tells
work with,” says Mike. Designing and creating the Arduino motor controller to spin the screens
a means to securely hold all the brass rods in at a rate that ensures only one animation (length
place was “a major headache”, and the andotrope unimportant) is shown at once.
mechanism was also a challenge. “It’s not that
hard to get one of those displays working, but it’s
a lot of effort to get it working well.”
The andotrope project ended up “pretty
expensive thanks to all that brass!” Mike notes that
the brass sphere alone was around $700. The 10in
Android tablets he chose were also pricey, but use
very little power when sitting idle and “happily
last a full nine hours of constant playing at a
convention with battery life to spare,” which he
finds pretty amazing.
There are a lot of different uses for the Andotrope
display – everything from a personal digital assistant
Mike designed a 3D printed case and spent
(Siri/Alexa) display to a teleconferencing system to 03 hours fitting all the components and brass struts
playing board games with friends. Anyone trying to in place. A Python script runs on startup to control
create their own should use a phone or a tablet with everything, with the two screens rotating at 1200rpm to
zero flicker to its video, as any flicker at all will show simulate movement and be viewable from any angle.
up at high rotational speeds.

Gehn Imager Andotrope magpi.cc 21


PROJECT SHOWCASE

Twirly Shirley
This remote-controlled precision turntable has Phil King spinning around

P recision turntables are ideal for rotating


items to photograph, among other uses,
but can cost hundreds of pounds. So VEEB
Projects’ $50 DIY precision turntable – using
Raspberry Pico W, 3D printed parts and a stepper
motor – is all the more remarkable. It’s actually
an upgrade from the duo’s previous turntable that
featured an IR remote.
“We already made a turntable about a year
ago to solve a problem we were having taking
photos of something,” reveals Martin Spendiff. S By taking photos at set intervals, you can create stop-motion
videos of a rotating object, such as a roller-skate
“We wanted a turntable, but one we could control
Martin programmatically, so that we could be flexible in
MAKER

Spendiff generating stop-motion footage.”


It was one of those
and Vanessa That first turntable used a DC motor, which
Bradley lacks precision, resulting in inconsistent things that you keep
movements which vary with the weight of the
VEEB began
as a lockdown
object placed on it. “We wanted something going back to when you
more precise,” recalls Martin, “and we wanted a
photography
project for Vanessa remote that we didn’t keep losing, so we put it as learn something new
Bradley and Martin
a page on a web server.”
Spendiff, but soon
morphed into a In addition, they simplified the original version’s
during another project
site documenting 3D-printed gearing system, which included a worm
their builds. gear, to use two gears instead of three. MicroPython code that tells the turntable’s stepper
veeb.ch motor to turn, then 3D printed gears translate the
Web-based spinning movement from the motor to the bearing, which in
Raspberry Pico W has a web server running on turn moves the turntable.” The ‘lazy Susan’-style
it, based on Simon Prickett’s Phewap project bearing, as used in turntables for the dining table,
(magpi.cc/phewap). On that server sits a page that features multiple metal balls between two circular
shows a virtual remote. “The buttons trigger some metal plates for low-friction movement.
Since the stepper motor they used requires a
fairly hefty voltage, a 20V Power Delivery trigger
board is used to step up the voltage supplied via
Warning!
USB-C. “Using PD triggers was one of the good
Moving parts
bits: it makes for a much smaller build than having
Be careful when handling to try to cram a power brick in there too. They’re
this project because it has
really cheap too, so it’s a rare win-win.”
moving parts. Children
should be supervised. VEEB chose Raspberry Pi Pico W for the project
due to “a flat refusal to use C, due to lack of skill,
and the knowledge that the documentation for
X With the outer gear
Raspberry Pi stuff is less sparse than for other
and bearing removed, microcontrollers,” says Martin. “When we get
you can see the
stepper motor and
stuck, there’s usually someone that has run into a
Raspberry Pi Pico W similar problem and documented it somewhere.”

22 magpi.cc Twirly Shirley


PROJECT SHOWCASE

Quick FACTS
> The Twirly Shirley
name is a play on
‘lazy Susan’

> The stepper motor


divides a full rotation
into 6400 steps

> It’s driven by


The lazy Susan metal bearing enables
a DRV8825
smooth rotation of the turntable
breakout board

> VEEB may consider


adding physical
control buttons
and a display

> They’d also like a


more elaborate
web page remote

The web server running on Raspberry Pi A high-precision stepper motor


Pico W shows a page with a virtual remote has a 3D printed cog mounted
on it to spin the outer gear

Learning process
Martin reckons the project took around a year to
complete, working on and off. “There were a few
mini projects in there: learning enough OpenSCAD
for the gears, learning enough CSS for the remote
page, getting the stepper motor to work. It was one
of those things that you keep going back to when you
learn something new during another project.”
An impressive stop-motion video of a roller-
skate and disco ball for the Twirly Shirley
YouTube video (magpi.cc/twirlyshirleyyt)
was shot using a camera taking photos at set
intervals, but a possible upgrade would be to use a
Raspberry Pi single-board computer to automate
the process. “An SBC could take photos and send
requests for the turntable to move,” notes Martin.
“The last thing we made used web sockets to
make a Pico listen for signals being broadcast
S The components for the project include a motor driver board and 20V Power Delivery trigger
from a [Raspberry] Pi with a camera attached.” to supply the power for the stepper motor

Twirly Shirley magpi.cc 23


PROJECT SHOWCASE

Video magnifier
Don’t hunch over your books again thanks to this marvellous,
camera-powered magnifier using Raspberry Pi. Rob Zwetsloot zooms in

W e know plenty of folks who love to


whack up the font size on their ebook
reader of choice, and we’ve definitely
on occasion tried to pinch zoom printed media
(do not judge us), so the idea of being able
to zoom in on a book without hauling out a
magnifying glass is very attractive. This is what
Markus maker Markus Gräser has achieved.
MAKER

Gräser “[It’s a] technical version of a magnifying glass


to help people with low vision,” Markus tells us.
A German software “It’s basically a camera that can be connected to
developer who has
recently returned to any HDMI screen, with a simple interface to scale
Berlin after a two- and modify images. There are lots of professional
year stint in London. devices out there, and a few DIY takes on the
magpi.cc/magni category as well. My goal was to make it simple, S Testing out the concept using a wooden board and a bottle of soda
portable and affordable. There’s also experimental
support for reading out text.” but my latest version is 3D-printed and I’m quite
Markus came up with the idea when proud of its simple and portable design.”
his grandmother was prescribed one There are three main functions for the magnifier:
of these professional devices after a button cycles through different magnification
suffering from macular degeneration. levels, while another can change colour modes.
“Even though she generally shunned This includes inverting the colours or tinting it
away from most technology beyond yellow or blue.
a telephone or TV, this improved her “There’s also an experimental readout feature,”
life a lot and she enjoyed reading and says Markus. “[It takes] a picture and then uses
writing again, be it letters, books Tesseract OCR to get the text which is later read
or the newspaper,” Markus says. out via the pico TTS library, all on-device without
“However, it’s a bulky device that was the need for an internet connection.”
placed in the living room, so when
she needed it for cooking recipes she Book smarts
had to frequently go back and forth “This has been an interesting project where I’ve
S The case has easy
access to power and between the kitchen and the living room.” learned a lot over the years,” Markus mentions.
AV output, and it According to him, a DIY solution is at least a Everytime he revisits it he thinks about little
even has USB access
if you need more tenth of the price of professional versions. tweaks he can make but is happy that the code is
input options up on his GitHub (magpi.cc/magni) so others can
Rapid prototyping modify it to their needs.
While a tablet or laptop would have done the job, Unfortunately Markus’ grandmother had a
the constant updates and unlock codes felt like a stroke before getting to test it, and is now unable
barrier. Raspberry Pi with a Camera Module and a to use it. However, other folks have been able
screen seemed like the best solution to Markus. to give feedback, much of it positive. He’s gone
“The software was relatively easy,” Markus on to use Raspberry Pi and Camera Modules for
explains. “But I experimented a lot with the form other projects, such as a portable photo booth for
factor. I started out with a wooden setup as I weddings – sounds like something we need to
wanted to make it look nice and non-technical, cover in a future issue.

24 magpi.cc Video magnifier


PROJECT SHOWCASE

Any monitor will do for this,


as long as it has HDMI input

The camera is easy to position


and is fairly unobtrusive

I started with a wooden


setup but my latest
version is 3D-printed

Quick FACTS
> Extra controls via
a keyboard are
The magnifier is useful for also built in...
both reading and writing
> … this includes
contrast controls and
focus adjustment

> Digital zoom is


good up to a
factor of 10-20
Markus says

> The simplest version


can be mounted to
a desk lamp

> A television can be


the monitor for the
device quite easily

W Markus went
through several
3D-printed designs
for the device

Video magnifier magpi.cc 25


SUCCESS STORY

SUCCESS STORY magpi.cc/success

Revolution Pi
industrial
computers
Powerful, flexible computing for industrial IoT and automation.
By Rosie Hattersley

K unbus GMbH spotted a need for devices


that marry reliable performance fit for
industry with the flexibility and ease of
consumer computing. They matched Raspberry Pi
with custom software, enclosures, expansions, and
this time – early 2016 – Raspberry Pi had sold
nearly seven million units, and was the darling
of single board computing. The product was
known and embraced by software engineers and
developers, and it had the huge advantage of a
peripherals to stunning effect. strong community of enthusiasts keen to support
Kunbus began in 2008 as a company that made others’ development endeavours.
discrete communications components for industry. Kunbus saw the potential for an industrial
Business Developer and founder Boris Crismancich Raspberry Pi controller model that offered the
characterises the pre-Internet-of-Things era more robust specifications that OEMs needed,
as one in which there was a distinct separation including an open source modular design, support
between PCs — personal computers used by for 24V power supply, DIN rail mounting, I/O
consumers and end users in office settings — and expansion modules, and optional Ethernet,
T The RevPi Connect 4 hardware used by industrial makers, who saw the alongside a custom operating system. Raspberry Pi
expansion module unreliability of largely Windows-based devices and had not yet released its own industrial Raspberry
steered well clear. Pi Compute Module at this stage, but the concept
Industrial controllers, made sense and, with an established product line
on the other hand, of communications devices, the team at Kunbus
were prized for their decided to forge ahead with designing what was
reliability but avoided to become Revolution Pi (revolutionpi.com) and
the name tag of a brand-new product line.
computers. “There was
a culture clash. The The challenge
Internet of Things made Conversations at trade fairs led Crismancich to
PCs and controllers realise there was a real appetite for an open source
need to get along device that was agnostic of any particular industry
and Raspberry Pi was sector, and could instead be used almost universally
common ground.” and in ways that only the purchaser might have
Kunbus soon realised envisaged. In this respect, the device Kunbus
that alongside the need imagined had much in common with Raspberry Pi
for industrial networks, itself. Rather than a challenge to overcome, Kunbus
there was demand for saw developing an industrial Raspberry Pi product
an industrial version as an opportunity. They were well placed to do so
of Raspberry Pi. By and had the experience and skills to take the project

26 magpi.cc Revolution Pi industrial computers


SUCCESS STORY

forward, as well as a forum with which to engage


with their customers and glean feature requests
and feedback.
Head of marketing Ekkehard Krebs described with the adaptability of the platform — pretty
the unheard-of ten-month development process, much anything open source was compatible with
in 2016, of what became Revolution Pi – the first Raspberry Pi by design — made it unique. Different
industrial controller based on Raspberry Pi. His architecture would not have worked, believes
colleague Nicolai Buchwitz, himself a former Crismancich, because the IT world didn’t know
Revolution Pi customer in his previous role at about other hardware and was accustomed to
a motorway freight weighing station, regards it operating with user input, whereas the IP (industrial
as a direct response to the call for an industrial process) world was all about automation. “They
Raspberry Pi. needed to find common ground.”
Two months after Kunbus launched Revolution
Why Raspberry Pi? Pi, Raspberry Pi announced its first Compute
That Raspberry Pi would be the basis of Revolution Module – its own industrial Raspberry Pi – and
Pi was never in question: there was no other device Kunbus knew they were on to something. They
that had the market penetration, availability, quickly switched over to using Compute Module 1,
and uptake within the open source community. then a single-core computer running at 500MHz,
Alongside this was an ever-expanding number recalls Ekkehard Krebs, and have been a major
of engineers and developers who, either for their customer of CM1 ever since. Since CM3 had the
own interests or through their studies, had used same form factor and pinout (detailed on the
and created projects based on Raspberry Pi. This Raspberry Pi website, of course), upgrading to
provided a familiarity with the base product, and this model and adding a Kunbus carrier board
furnished a potential market for Kunbus’ new and custom OS was straightforward. After a
business model. change in form factor between CM3 and CM4, S RevPi Connect 4
sitting alongside
Crismancich says that other controller companies the upcoming CM5 again retains the CM4 form Raspberry Pi
were still totally focused on closed, proprietary factor, and large industrial customers like Kunbus Compute Module 4
devices, much as consumer brands were at this have been involved and kept abreast of the
time. Although Raspberry Pi is not fully open development process so they can launch their own
hardware, the company’s commitment to sharing new products, extension boards, and software
code and schematics wherever possible, together concurrently.

Revolution Pi industrial computers magpi.cc 27


SUCCESS STORY

The results
Creating an industrial product line around Raspberry
Pi couldn’t have gone much better for Kunbus. The
company has sold somewhere between 150,000 and
160,000 units and seen its Revolution Pi used in
everything from solar power units and electric race
cars to hydrogen filling stations, and in settings
from Nintendo to micro breweries. Crismancich
learned of the latter at the Hanover industrial trade
show when the owner saw Kunbus on his name
tag and showed him what was at the heart of the
beer rig. In fact, it turned out that nearly half of
the exhibitors had RevPi in their products.
Cloud certification for the likes of Microsoft Azure
and Amazon Web Services by Kunbus’ engineers
for their customers works like a dream, says
Krebs, because of the ready-to-use examples that
work with Raspberry Pi. Kunbus now has ten such
The solution engineers, some of whom are actively involved in
The three main Revolution Pi options are powered developing the Linux kernel on which Raspberry Pi
by Raspberry Pi Compute Module 4, with options OS and Revolution Pi’s custom OS are based, and 150
for 2GB, 4GB or 8GB RAM and either 8GB or 32GB employees. Krebs notes that the young engineers who
SD storage, together with two Gigabit Ethernet are now coming through learned about Raspberry
ports and USB 3.2, micro USB, and micro HDMI Pi at school, used it during their studies, and are
ports. A PiBridge allows for the addition of two confident choosing it as the basis of their own
companies’ products.
Crismancich also
 unbus saw the potential for an
K points to the millions of
software engineers and
industrial Raspberry Pi controller developers using Raspberry
Pi worldwide and the 50
model that offered the more robust million plus Pis sold.

specifications that OEMs needed The might of Raspberry


Pi as an organisation, its
rock-solid community
I/O and comms-focused expansion boards as well and support network, and the guarantee that the
as fieldbus gateways. Each RevPi comes in a slim products customers use now will still be available
DIN-rail housing, with the option to customise this and supported a decade from now all build trust.
enclosure with logos and other branding. Kunbus was “almost first, if not first, to
The hardware is certified for use with all major market” with an industrial Raspberry Pi, and of
cloud services, and engineered to work seamlessly course has imitators. Rather than considering them
with sensors and securely process their data. All rivals, having such a solid customer base means
models have Kunbus’ custom version of Raspberry Kunbus is able to regard these other hardware
S An industrial Pi OS plus the popular IoT tool Node-RED, a click- companies as ‘marktbegleidet’ – companions or
control panel
using Revolution
to-assemble tool known as PiCtory that supports fellow travellers on a mission to make everything
Pi hardware communication between RevPi and connected open source. The market is large enough, and
devices, and the RevPiModIO Python library. Kunbus can afford to be generous.
Kunbus Product Owner Nicolai Buchwitz
X Inside the RevPi
Connect 4 you’ll calls RevPi “the Swiss Army knife of automation
find a Raspberry Pi and IoT”. He explains that because of the
Compute Module 4
retained similarity with the Raspberry Pi
hardware on which it is based, there is an
almost endless number of software components
that can be used with RevPi. Customers can
choose or assemble applications from many
packages. Fieldbus gateways connect with other
industrial components in a network and allow
them to communicate.

28 magpi.cc Revolution Pi industrial computers


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
£10 (UK only)

Subscribe for 6 Months


Free Pico W
6 issues of The MagPi

+ £30 (UK)
€43 (EU)
$43 (USA)
£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 six-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 W
$6
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

Buy now: magpi.cc/subscribe

SUBSCRIBE
on app stores

magpi.cc 31
FEATURE

ESSENTIAL
ELECTRONICS
Build your first simple circuits with
a handful of cheap components
Sean McManus

T
he magic of Raspberry Pi is that it can interact with the world.
You can gather input from buttons and sensors that detect light,
movement or distance. Send output through lights, buzzers or
motors that drive robots around the room.
It’s easy to get started. Using a breadboard, you press components and
wires into holes to build a circuit, with no need for soldering. Jumper wires
make it easy to connect your circuit to Raspberry Pi’s general-purpose
input/output (GPIO) pins.
The GPIO Zero library makes it easy to accept input and control your
circuits from Python.

32 magpi.cc Essential Electronics


FEATURE

SHOPPING LIST
Discover basic components you can
combine to make a variety of projects

Breadboard Jumper wires Button


Ideal for prototypes and experiments, Use socket-to-pin jumper wires to Pressing a button can complete a circuit
breadboards enable you to connect connect a Raspberry Pi GPIO pin to the to, for example, turn a light on. Buttons
components without soldering. Simply breadboard. Pin-to-pin wires connect are great input devices for Raspberry Pi
press them into the holes on the board. between points on the breadboard. and a vital part of your collection.

Capacitor Passive infrared (PIR) sensor Ultrasonic distance sensor


Capacitors can be charged up to store Motion sensors like this are often used in Essential for robots detecting walls or
small amounts of electricity, which burglar alarms or automatic lights. These obstacles, this distance sensor by Kitronik
they can later discharge into the circuit. are great for triggering spooky Halloween measures distances of between 2cm and
They’re often used to make timers. projects when someone approaches. 400cm, with accuracy as good as 3mm.

Essential Electronics magpi.cc 33


FEATURE

 assive buzzers give you more flexible


P
pitch control, so you can program tunes

Resistors Buzzer Motor board


Resistors reduce current flow in a circuit. Active buzzers are easiest to wire up but A motor controller board, such as this one
Coloured stripes indicate the resistor’s usually just produce one tone. Passive from the CamJam Robotics EduKit, sits
value. Find decoders online (see buzzers (also known as tonal buzzers) between your Raspberry Pi’s GPIO pins
magpi.cc/resistorcalc) or see the table give you more flexible pitch control, so and your project’s motors. It allows you to
in the Raspberry Pi Beginner’s Guide. you can program tunes. control things like robot wheels.

Light emitting diodes (LEDs) Line-following sensor Motor


Lights! They come in a range of colours This sensor has both a light emitter and Essential for mobile robots, DC motors
and sizes, and they add sparkle and joy a light detector. Using it, you can create like this connect to your Raspberry Pi
to any project. Place them carefully: a robot that can follow a black line drawn through a motor controller board. To save
they only work one way around. on a white surface. time, get one with pre-soldered wires.

34 magpi.cc Essential Electronics


FEATURE

CREATE A MORSE CODE


TRANSMITTER
Wire up an LED to Raspberry Pi, and
flash the bulb to send messages
   Understanding the breadboard    Connecting the LED
01 Inside the breadboard are electrical connections between 03 The LED’s long leg is the anode (positive end), and its
the holes, as shown in this picture. In the middle of the breadboard, short leg is the cathode (negative end). Connect the anode to
there are numbered rows. The holes in a row that form a group are the same group of breadboard holes as one end of the resistor.
connected to each other. Groups are usually separated by a trench. Connect the cathode to a new group of holes.

   Connecting the resistor    Connecting Raspberry Pi


02 In our circuit, current flows from Raspberry Pi’s GPIO 04 Power off your Raspberry Pi before connecting wires or
pin, through a resistor and LED, and back to Raspberry Pi’s components. The GPIO header has pins that provide 3.3V or 5V of
ground pin. We use a 330 ohm resistor to stop the LED drawing power constantly, general-purpose input/output (GPIO) pins, and
too much current, which might damage the LED or Raspberry ground pins for completing a circuit. To control our circuit, we’ll
Pi. To force the current to go through the resistor, we have to use GPIO pin 14, which is the fourth pin on the top row. Connect
connect each end of it to a different group of breadboard holes. A a jumper wire between that pin and the resistor, at the opposite
resistor can go either way around. end to the LED. Connect a ground pin to the LED’s negative leg.

W We use BCM pin


numbers, which
aren’t the same
as the physical
pin locations

Essential Electronics magpi.cc 35


FEATURE

MORSE CODE
TRANSMITTER PROGRAM
For if you always wanted to learn Morse code,
but never did it. Da-dit, da-dit, etc…

240625 magpi morse code.py DOWNLOAD


THE FULL CODE:
> Language: Python magpi.cc/seancode

001. from gpiozero import LED


002. from time import sleep
003.
004. led1 = LED(14)
005.
006. def blink(flash_duration):
007. led1.on()
008. sleep(flash_duration)
009. led1.off()
010. sleep(0.5)
011.
012. def flash_message(message):
013. for symbol in message:
014. if symbol == “.”:
015. blink(0.5)
016. if symbol == “-”:
017. blink(1.5)
018. if symbol == “ “:
019. sleep(1.5)
020.
021. flash_message(“.... . .-.. .-.. ---”)

 end our Morse message to


S
the flash_message function

36 magpi.cc Essential Electronics


FEATURE

Line 1: Set up GPIO Zero so we can use the LED code

Line 2: Import the time library to control the length of


light flashes

Line 4: Set up led1 as an LED on GPIO pin 14

Line 6: The blink function receives the flash duration


in seconds

Line 7: Turn the LED on!

Line 8: Pause for as long as we want the light lit

Line 9: Turn the LED off

Line 10: A short pause stops the flashes merging

Line 12: This function receives a Morse code message

Line 13: The loop looks at each character in the


message

Line 14 and 15: If the character is a dot, we blink for


half a second

Line 16 and 17: If it’s a dash, we blink for 1.5 seconds

Line 18 and 19: If it’s a space, we add a 1.5 second


pause

Line 21: Send our Morse message to the flash_


message function

Run this program in Thonny by clicking the


Run button. Get the code at magpi.cc/seancode.

S Find Thonny in the Programming folder of the Raspberry Pi OS menu

Essential Electronics magpi.cc 37


FEATURE

ELECTRONICS
PROJECTS TO TRY
Discover how to use buttons, sensors
and motors with these starter projects

GPIO Music Box


Components: breadboard, buttons, pin-to-socket and pin-to-pin
jumper wires, speakers
magpi.cc/gpiomusicbox

Buttons are the simplest way to control circuits and collect input. In this
project, you see how to connect four of them to Raspberry Pi. They’re used to
trigger sound effects played with Python’s Pygame library, which you could
customise with your own recordings. You see how to connect all your buttons
to the same GPIO ground pin, by using the ground rail along the long side of
the breadboard. With this approach, you don’t need as many jumper wires to
Raspberry Pi, so your circuit is easier to build and understand.

Quick Reaction Game


Components: breadboard, buttons, LED, resistor, jumper wires
magpi.cc/pythonqrgame

Who can push their button quickest when the light goes off? This two-
player game uses a breadboard to connect two buttons and an LED to
Raspberry Pi. With the music box, it doesn’t matter in what order the
buttons are pressed, but in this game you see how to detect which button
was pressed first, and announce the winner on-screen. The program also
shows how a single Python function can be used with GPIO Zero to provide
different outputs for different buttons. You can extend the project by
adding a timer or keeping track of scores.

Laser Tripwire
Components: breadboard, capacitor, light-dependent resistor (LDR),
jumper wires
magpi.cc/lasertripwire

When intruders break the invisible beam, the alarm sounds. This project
works by shining a laser pointer at a photoresistor, and sensing when the
light changes because somebody has walked between them. GPIO Zero
enables you to wait until light or dark is detected, and to run a particular
function when it is. You can raise the alarm by playing a sound file through
speakers, or by connecting a buzzer to Raspberry Pi.

38 magpi.cc Essential Electronics


FEATURE

Parent Detector
Components: PIR motion sensor, Raspberry Pi Camera Module, jumper wires
magpi.cc/parentdetector

The parent detector project is a great way to experiment with a PIR motion
sensor. The sensor has pins that you can connect directly to your GPIO
pins using socket-to-socket jumper wires, with no need for a breadboard.
This project uses the sensor to trigger video recording, and only stops
when no motion is detected. The PIR sensor has dials you can use to adjust
the sensitivity and detection time of the sensor. Perhaps you could turn
down the sensitivity and make a game where players must sneak up on the
Raspberry Pi undetected?

Ultrasonic Theremin
Components: breadboard, ultrasonic distance sensor, tonal buzzer,
jumper wires
magpi.cc/theremin

The theremin, patented by Leon Theremin in 1928, is an instrument


that you play by moving your hands near it. It’s famous for creating the
woo-ooo sound effects in sci-fi films. You can make something similar
by connecting an ultrasonic distance sensor and a buzzer to Raspberry Pi.
The sensor sends out sound pulses, and measures how long they take to
bounce back, so it can measure the distance to the nearest object. GPIO
Zero includes simple code to measure the distance in metres, and to make a
tonal buzzer play musical notes using the MIDI standard.

Robot Buggy
Components: Motor controller board, motors, wheels, jumper wires,
AA battery holder and batteries for the motors, USB battery pack for
Raspberry Pi, ball caster
magpi.cc/robobuggy

This is the droid you are looking for! Build your first robot by connecting
a motor controller board, two motors and wheels to Raspberry Pi. A ball
caster keeps everything balanced, acting as a central third wheel. The
motors are powered by AA batteries. Log in to Raspberry Pi remotely using
VNC or SSH and use a USB battery pack for power, so there’s no need
for monitor or power cables and your robot can roam freely. Thanks to
GPIO Zero, you can use simple functions to move your robot forwards,
backwards, left and right. You can extend this project by adding a line-
following sensor (magpi.cc/linefollower). For motor boards and other
components, see CamJam EduKit 3 and Monk Makes Servo Kit.

Essential Electronics magpi.cc 39


TUTORIAL

Productive Python:
Part 02

Fun with files


Automate tiresome tasks with simple Python programs. Discover
how to search PDFs, download web pages, and save the output.

L ast month, we experimented with clocks


to improve productivity. This month, we’ll
see how you can delegate some common
tasks to Python. First, we’ll create a program
that searches through your archive of The MagPi
02    Create your virtual environment
We’ll use Thonny to build and run our
Python programs. It comes with Raspberry Pi
OS, and it has tools for installing and managing
libraries (if you prefer to use the command line,
PDFs. It works for any PDFs, in fact – we’ve used see our tutorial in issue 136, magpi.cc/136). Open
it for bank statements and ebooks. The output is Thonny and click the three-line menu icon in
saved to a text file, which you can print, browse the bottom right. Choose ‘Configure interpreter’.
Sean
MAKER

or keyword search. Then, we’ll see how you can When the dialog box opens, click ‘New virtual
McManus
download web content and save it as a formatted environment’. Choose the empty folder you just
Author of Scratch file for LibreOffice. Next time you find you’re created. The virtual environment is created and
Programming in missing a tool for file management, perhaps you the ‘Python executable’ part of the dialog box is
Easy Steps, Mission
Python, and Web can use the ideas here to build your own. updated to show it’s being used. Click OK.
Design in Easy Steps.
Get free chapters at
Sean’s website.

01    Create a new folder


03    Install the libraries
sean.co.uk
We’ll need to install some Python libraries If there is no Tools menu, click ‘Switch to
for these programs. Since the release of Raspberry regular mode’ in the top right corner and restart
Pi OS Bookworm (October 2023), you can’t Thonny. From the Tools menu, choose ‘Manage
You’ll Need
install libraries into the
> PDFs to search main version of Python.
magpi.cc/issues Instead, you create a
> Raspberry Pi OS with virtual environment which
desktop contains a separate Python
magpi.cc/imager configuration. There, you
> Libre Office can install all the libraries
libreoffice.org you want. Click the File
Manager icon on the toolbar
in Raspberry Pi desktop.
When the File Manager
opens, click the New Folder
X Your PDF search icon on its toolbar, give
results are in a text your folder a name, and
file. The PDF excerpts
show you the context click OK. This folder is for
for your search term our virtual environment.

40 magpi.cc Productive Python: Fun with files


TUTORIAL

With web pages


downloaded to
LibreOffice, you can
print, search, skim-read
and edit text easily

Jump to any heading in


your downloaded web
pages using the Navigator

packages’. From here, you can search for Python


T he program could search
libraries, install them, and uninstall them. It’s through every file on the T The Thonny
options make it easy
much easier than using pip or apt on the command
line. Use the search box to find ‘requests’, select it Raspberry Pi to create a new
virtual environment
and then click the ‘Install’ button. Do the same for so you can install
Python libraries
the bs4, python-docx and PyPDF2 libraries. Close
the dialog box when you’ve finished.

04    Get your files in order


Listing 1 searches through PDFs, to help
you unearth past tutorials in The MagPi, or comb
through ebook PDFs from sites like Humble
Bundle. The program could search through every
file on the Raspberry Pi, but it would be very slow.
We’ll speed it up by collecting together the PDFs
we want to scour. Let’s make a folder called MagPi
and put our back issues there. Within that folder,
you can organise PDFs into subfolders, for example
by year. Your Python program and the MagPi
folder should be side-by-side, for example in your
pi folder if you have one. Don’t put the listing
inside the MagPi folder with the PDFs.

Productive Python: Fun with files magpi.cc 41


TUTORIAL

W Thonny’s package manager


makes it easy to install
Python libraries with a
visual interface

Top Tip 05    Searching through files


The Python os library uses the word 07    Sending the output to a text file
Programs often have too much output
‘directories’ to refer to what the desktop calls to fit in the Shell pane, so we’ll send ours to a
Speed up ‘folders’. The process_directory() function shows text file. You can read it with the Text Editor,
the search you how to spider through folders, looking for which is in the Accessories folder of the desktop
files of a particular type. We call it from line 34, menu. Lines 32 to 33 show you how to open a
Try only checking
the first few pages giving it the name of the folder our PDFs are in. In text file and write to it. Using with is the best
of each PDF, the function, we use the os library to get a list of way to open a file, because it automatically
where the table all the directories and files in the current folder/ closes the file at the end of the indented lines
of contents is.
directory. For each one, if it’s a directory, we call under it. In line 34 we open the file in write
the process_directory() function again to look mode (w), which starts a new file and overwrites
inside it. If it’s a PDF, we call the search_in_pdf() any existing file of the same name. In line 20,
function and give it the path to the PDF file. Other we open the file in append mode (a), which adds
file types are ignored. The Shell pane is updated to onto the end of it.
show the program’s progress.

   Searching within the PDF 08    Extracting text from the PDF


06 In the search_in_pdf() function, we open
The output is sent to the file using
print(). We’re using f-strings (see line 23) to
the PDF file and use the PyPDF2 library to process add the file path and page number from their
it. Lines 16 to 19 show how to search within each variables. Using string slicing, we specify the
page of the PDF. When the program runs it asks start and end character from the page_text
you for the text you’d like to search for (line 31). that we want to use. We output the first
Before checking whether the search term is on the 200 characters (0:200) and then up to 450
PDF page, both the page text and the search key characters before and after the search term (see
words are converted to lower case (line 19). This lines 27 to 29). This excerpt gives you a good
ensures we don’t miss any matches because of understanding of how the search term is used on
inconsistent capitalisation. the page.

42 magpi.cc Productive Python: Fun with files


TUTORIAL

09    Downloading web pages


We often need to compile online research
document object. Line 20 adds a main heading
to it showing the web address. The 1 at the end
into a single file so we can search it easily and of this line makes this a top-level heading. The
read it offline. That’s what Listing 2 does. It starts page title which appears in the browser’s tab is
by using stdin.readlines() to ask for your list of added in line 22. For each of the discovered tags
links. Press ENTER after typing or pasting in each
web page address. To finish, use CTRL+D.
we want, we check its name to see what type of
tag it is. Headings are added to the docx file as Top Tip
headings, but they’re all set to be a level 2 heading
(line 25). That makes it easier to navigate the file Merging PDFs
in LibreOffice. List bullets are styled as bullets
PyPDF2 can be used

10    Cooking up Beautiful Soup


Beautiful Soup is a library for parsing web
(line 27) and everything else is output as a normal
paragraph. After each web page, we add a page
to combine PDFs, too,
including extracting
files, which are coded in HTML. In HTML, text break (line 30). Finally, line 31 saves the output. specific pages.

has short codes either side of it, called tags. These docx file, overwriting any previous version.
describe the start and end of paragraphs, headings,
and so on. In lines 15 to 16, we download a web
page and create a soup object for it. To help
remove navigation links, lines 17 to 18 strip out
any sections marked with nav and footer tags. Line 12    View with LibreOffice
Open the Preferences folder in your desktop
23 shows how you to find specific HTML tags in menu and choose Recommended Software. Install
the web page. The program finds all the paragraph LibreOffice in the Office category. Double-click
(p) tags, heading (h1 to h6) tags, table tags, your output.docx file to open it in LibreOffice.
blockquote tags and list bullet (li) tags. Use CTRL+F to search in your document. F5
opens the navigator. This enables you to jump
between the documents and headings easily. T Download MagPi
Close the navigator again to edit the file. You can PDFs at magpi.cc/

11    Creating a docx file issues. When the


take the techniques in Listing 2 further to scrape search finds the
The docx file format works in Microsoft information such as a share price from a web page articles you need,
you can read them
Word and LibreOffice and can be created with and feed it to a Python program, or use python- on screen or in your
the python-docx library. Line 10 defines our docx for printer-friendly output from sensors. paper back issues

Productive Python: Fun with files magpi.cc 43


TUTORIAL

listing1.py DOWNLOAD
THE FULL CODE:
> Language: Python magpi.cc/seancode

001. # PDF search, with output sent to text file page_text.lower():


002. import os, PyPDF2 020. with open(“output.txt”, “a”) as
003. output_file:
004. def process_directory(path): 021. print(“\n\n”, file=output_file)
005. for dir_or_file in os.listdir(path): 022. print(“#” * 40, file=output_file)
006. path_plus_dir_or_file = 023. print(f”Text found in {pdf_file}
os.path.join(path, dir_or_file) on page {page_number + 1}”, file=output_file)
007. if os.path.isdir(path_plus_dir_or_file): 024. print(“#” * 40, file=output_file)
008. print( 025. print(
“\nProcessing subfolder:”, dir_or_file) page_text[0:200], “\n...\n”, file=output_file)
009. process_directory( 026. position_in_text =
path_plus_dir_or_file) page_text.lower().rfind(search_string.lower())
010. elif dir_or_file.endswith(‘.pdf’): 027. print(
011. print( page_text[max(0, position_in_text - 450) :
“* Searching PDF:”, dir_or_file) 028. min(
012. search_in_pdf(path_plus_dir_or_file) position_in_text + 450, len(page_text))
013. 029. ], file=output_file)
014. def search_in_pdf(pdf_file): 030.
015. opened_file = open(pdf_file, ‘rb’) 031. search_string = input(f”What term would you like
016. magazine_content = to search for in the PDFs? “)
PyPDF2.PdfReader(opened_file) 032. with open(“output.txt”, “w”) as output_file:
017. for page_number, magazine_page in 033. print(f”Ok! Searching for {search_string}”,
enumerate(magazine_content.pages): file=output_file)
018. page_text = magazine_page.extract_text() 034. process_directory(“MagPi”) # Change to your
019. if search_string.lower() in folder name

listing2.py DOWNLOAD
THE FULL CODE:
> Language: Python magpi.cc/seancode

001. # Download web pages into a docx file 019.


002. import requests, sys 020. doc.add_heading(
003. from bs4 import BeautifulSoup f”{source_number + 1} - {url}”, 1)
004. from docx import Document 021. title = soup.title.string
005. 022. doc.add_heading(
006. print(“Paste in the URLs (Ctrl-D to end input): “) f”{source_number + 1} - {title}”, 0)
007. urls = sys.stdin.readlines() 023. for part in soup.find_all(
008. urls = [url.strip() for url in urls] [“p”, “h1”, “h2”, “h3”, “h4”, “h5”, “h6”,
009. filename = “output.docx” “table”, “li”, “blockquote”]):
010. doc = Document() 024. if part.name in [“h1”, “h2”, “h3”]:
011. 025. doc.add_heading(part.text, 2)
012. for source_number, url in enumerate(urls): 026. elif part.name == “li”:
013. print(f”Fetching {url}”) 027. doc.add_paragraph(
014. response = requests.get(url) part.text, style=”List Bullet”)
015. content = response.content 028. elif part.text:
016. soup = BeautifulSoup(content, “html.parser”) 029. doc.add_paragraph(part.text)
017. for remove_me in 030. doc.add_page_break()
soup.find_all([“nav”, “footer”]): 031. doc.save(filename)
018. remove_me.extract() 032. print(f”Saved as {filename}”)

44 magpi.cc Productive Python: Fun with files


Raspberry Pi Custom DSI Display
CM4 Carryboard, and Industrial Tablet

Custom DSI Displays

Development of Industrial Tablet


CM4-compatible carryboard development capabilities

Looking for cooperation Contact us


Tel: +44 7587611960
partners around the E-mail: [email protected]
world. Website: www.jmolcd.com
TUTORIAL

Get started with


Raspberry Pi AI Kit
Place a Hailo AI module inside the Raspberry Pi M.2 HAT+
to give a Raspberry Pi accelerated high-performance AI

T he Raspberry Pi AI Kit bundles the


Raspberry Pi M.2 HAT+ with a Hailo
AI acceleration module for use with
Raspberry Pi 5. The kit contains the Hailo AI
module containing a neural processing unit (NPU),
software. Run the following command to update:

$ sudo apt update && sudo apt full-upgrade

Next, ensure that your Raspberry Pi firmware


a Raspberry Pi M.2 HAT+, to connect the AI module is up-to-date (magpi.cc/updatebootloader). Run
to your Raspberry Pi 5, a thermal pad pre-fitted the following command to see what firmware
between the module and the M.2 HAT+, a mounting you’re running:
Nate
MAKER

hardware kit, and a 16mm stacking GPIO header


Contino
The AI module features a 13 tera-operations $ sudo rpi-eeprom-update
Nate is a per second (TOPS) neural network inference
retrofuturist and accelerator built around the Hailo-8L chip in an If you see 6 December 2023 or a later
writes documentation
for Raspberry Pi. M.2 2242 form factor.
In this tutorial we will look at how to assemble
magpi.cc/natec
and attach AI Kit to Raspberry Pi, and use it for
high-performance AI tasks.
To use the AI Kit, you will need a Raspberry Pi 5.
Each AI Kit comes with a pre-installed AI module,
ribbon cable, GPIO stacking header, and mounting
hardware. Complete the following instructions to
T An object detection
model running
install your AI Kit:
on AI Kit First, ensure that your Raspberry Pi runs the latest

S A still life in our Image Lab for testing the Camera Module

46 magpi.cc Get started with Raspberry Pi AI Kit


TUTORIAL

You’ll Need
> Raspberry Pi 5
The Hailo AI module
magpi.cc/
fits into the M.2 raspberrypi5
socket on the M.2 HAT
> Raspberry Pi OS (64-
bit) ‘Bookworm’

> AI Kit
magpi.cc/aikit

> Camera Module


(optional)
magpi.cc/
cameramodule

The M.2 HAT+ connects


to Raspberry Pi 5 via the
PCI-express connection for Warning!
super-fast throughput Turn off power
Always disconnect your
Raspberry Pi from power
before connecting or
disconnecting a device
from the M.2 slot.
T Install the Active
Cooler first magpi.cc/power

date, proceed to the next step. If you see a


date earlier than 6 December 2023, run the
following command to open the Raspberry Pi
Configuration CLI:

$ sudo raspi-config

Under Advanced Options > Bootloader Version,


choose Latest. Then, exit raspi-config with Finish
or the ESC key.
Run the following command to update your
firmware to the latest version:

$ sudo rpi-eeprom-update -a

Then, reboot with sudo reboot.

Installing the AI Kit


Disconnect the Raspberry Pi from power before
beginning installation. For the best performance,
we recommend using the AI Kit with the Raspberry
Pi Active Cooler. If you have an Active Cooler,
install it before installing the AI Kit.
Install the spacers using four of the provided

Get started with Raspberry Pi AI Kit magpi.cc 47


TUTORIAL

W Attach the stand-offs


and GPIO Pin header

T The ribbon cable


connects AI Kit to
Raspberry Pi 5

Kit. Lift the ribbon cable holder from both sides,


then insert the cable with the copper contact
points facing up. With the ribbon cable fully and
evenly inserted into the port, push the cable holder
down from both sides to secure the ribbon cable
firmly in place.

screws. Firmly press the GPIO stacking header


on top of the Raspberry Pi GPIO pins; orientation
does not matter as long as all pins fit into place.
Disconnect the ribbon cable from the AI Kit, and
insert the other end into the PCIe port of your
Raspberry Pi. Lift the ribbon cable holder from
both sides, then insert the cable with the copper
contact points facing inward, towards the USB
ports. With the ribbon cable fully and evenly
inserted into the PCIe port, push the cable holder
down from both sides to secure the ribbon cable Congratulations, you have successfully installed
firmly in place. the AI Kit. Connect your Raspberry Pi to power;
Set the AI Kit on top of the spacers, and use Raspberry Pi OS will automatically detect the AI Kit.
the four remaining screws to secure it in place.
Insert the ribbon cable into the slot on the AI

X Use screws to attach


the AI Kit board and
secure it in place

X Make sure everything


is securely
connected

48 magpi.cc Get started with Raspberry Pi AI Kit


TUTORIAL

Getting started $ hailortcli fw-control identify


This section will help you set up the Raspberry Pi
AI Kit with your Raspberry Pi 5. This will enable If you see output similar to the following,
you to run rpicam-apps camera demos using the you’ve successfully installed the AI Kit and its
Hailo AI neural network accelerator. software dependencies:
Attach the camera to your Raspberry Pi 5 board
following the instructions at Install a Raspberry Executing on device: 0000:01:00.0
Pi Camera (magpi.cc/camdocs). You can skip Identifying board
reconnecting your Raspberry Pi to power, because Control Protocol Version: 2
you’ll need to disconnect your Raspberry Pi from Firmware Version: 4.17.0
power for the next step. (release,app,extended context switch buffer)
Logger Version: 0
Board Name: Hailo-8
 nce everything is installed
O Device Architecture: HAILO8L
Serial Number: HLDDLBB234500054
correctly, it’s time to run Part Number: HM21LB1C2LAE

some demos Product Name: HAILO-8L AI ACC M.2 B+M KEY


MODULE EXT TMP

Follow the instructions to enable PCIe Gen Additionally, you can run dmesg | grep -i hailo
3.0 (magpi.cc/pcigen3). This step is optional, to check the kernel logs, which should yield output
but highly recommended to achieve the best similar to the following:
performance with your AI Kit.
[ 3.049657] hailo: Init module. driver
$ sudo raspi-config version 4.17.0
...
Complete the following steps to enable PCIe Gen [ 3.231845] hailo 0000:01:00.0: Probing:
3.0 speeds: Select Advanced Options. PCIe Speed Added board 1e60-2864, /dev/hailo0
and Choose YES to enable PCIe Gen 3 mode. Select
FINISH to exit and choose YES to “Would you like To ensure the camera is operating correctly, run
to reboot now?”. the following command:
Install the dependencies required to use the AI
Kit. Run the following command from a terminal $ rpicam-hello -t 10s
window:
This starts the camera and shows a preview
$ sudo apt install hailo-all window for ten seconds. Once you have verified
everything is installed correctly, it’s time to run
This installs the following dependencies: some demos.

• Hailo kernel device driver and firmware Run the demos


• HailoRT middleware software The rpicam-apps suite of camera applications
• Hailo Tappas core post-processing libraries implements a post-processing framework (magpi.
• The rpicam-apps Hailo post-processing cc/postproc). This section contains a few demo
software demo stages post-processing stages that highlight some of the
capabilities of the AI Kit.
Finally, reboot your Raspberry Pi with sudo The following demos use rpicam-hello, which
reboot for these settings to take effect. To by default displays a preview window. However,
ensure everything is running correctly, run the you can use other rpicam-apps instead, including
following command: rpicam-vid and rpicam-still. You may need

Get started with Raspberry Pi AI Kit magpi.cc 49


TUTORIAL

Top Tip
rpicam-apps
The commands
to add or modify some command line options
provided use the
JSON files in this to make the demo commands compatible with  ailo’s extensive model zoo
H
repository. To make alternative applications.
it easy to reference
these files, this
To begin, download the post-processing JSON contains a large number
command creates
the cloned rpicam-
files required for the demos. These files determine
which post-processing stages to run and configure
of neural networks
apps directory in
the behaviour of each stage. For example, you can
your home folder.
If you modify the enable, disable, strengthen, or weaken the strength
location of this of the temporal filtering in the object detection To run the demo with the Yolov5 Person and Face
directory, you demos. Or you could enable or disable the output model, run the following command:
must also alter the
demo commands mask drawing in the segmentation demo.
to reference the To download the entire collection of post- $ rpicam-hello -t 0 --post-process-file ~/
new location of processing JSON files, clone the rpicam-apps rpicam-apps/assets/hailo_yolov5_personface.
the JSON files.
repo. Run the following command to clone json --lores-width 640 --lores-height 640
only the most recent commit from the repo,
saving space:
Image Segmentation
$ git clone --depth 1 https://github.com/ This demo performs object detection and segments
raspberrypi/rpicam-apps.git ~/rpicam-apps the object by drawing a colour mask on the
viewfinder image. Run the following command to
try the demo on your Raspberry Pi:
Object Detection
This demo displays bounding boxes around $ rpicam-hello -t 0 --post-process-file ~/
objects detected by a neural network. To disable rpicam-apps/assets/hailo_yolov5_segmentation.
the viewfinder, use the -n flag. To return purely json --lores-width 640 --lores-height 640
textual output describing the objects detected, add --framerate 20
the -v 2 option. Run the following command to try
the demo on your Raspberry Pi:
Pose Estimation
$ rpicam-hello -t 0 --post-process-file ~/ This demo performs 17-point human pose
rpicam-apps/assets/hailo_yolov6_inference. estimation, drawing lines connecting the detected
json --lores-width 640 --lores-height 640 points. Run the following command to try the
demo on your Raspberry Pi:
Alternatively, you can try another model with
different trade-offs in performance and efficiency. $ rpicam-hello -t 0 --post-process-file ~/
To run the demo with the Yolov8 model, run the rpicam-apps/assets/hailo_yolov8_pose.json
following command: --lores-width 640 --lores-height 640

$ rpicam-hello -t 0 --post-process-file ~/ Hailo has also created a set of demos that you
rpicam-apps/assets/hailo_yolov8_inference. can run on a Raspberry Pi 5, available in the
json --lores-width 640 --lores-height 640 hailo-ai/hailo-rpi5-examples GitHub repository
(magpi.cc/hailorpi5).
To run the demo with the YoloX model, run the You can find Hailo’s extensive model zoo, which
following command: contains a large number of neural networks, in
the hailo-ai/hailo_model_zoo GitHub repository
$ rpicam-hello -t 0 --post-process-file ~/ (magpi.cc/hailozoo).
rpicam-apps/assets/hailo_yolox_inference.json Check out the Hailo community forums and
--lores-width 640 --lores-height 640 developer zone (community.hailo.ai) for further
discussions on the Hailo hardware and tooling.

50 magpi.cc Get started with Raspberry Pi AI Kit


New in the
Second Edition
Expanded Python and
Pygame Zero tutorials
A GitHub tutorial for working
with example code
Bug fixes and other
improvements

This stunning 240-page hardback book not only tells


the stories of some of the seminal video games of the
1970s and 1980s, but shows you how to create your
own games inspired by them using Python and Pygame
Zero, following examples programmed by Raspberry Pi
founder Eben Upton.

Available now: magpi.cc/store


TUTORIAL

Build a private
Part 01

cloud server
Fed up with service subscriptions? Want to do things yourself
and protect your privacy? This new series shows you how

W e live in a golden age of free open-


source software. We also live in an age
of megacorps offering ‘free’ services
that routinely sell your data via arcane terms and
conditions. Luckily there is a new appetite for
drives as file storage, plus a 250GB SSD SATA drive
for the operating system. We’d happily go SSD all
the way, but the costs are prohibitive. Separating
the OS from the file storage allows us to use a fast
SSD and makes it easier to upgrade in future. You
running your own services and regaining control could also use a microSD card for the OS.
thanks to fast and affordable bandwidth and the
growth of small yet powerful computers to do the
PJ Evans
MAKER

work (sound familiar?). In this new series, we’re


PJ is a writer, software
engineer and home
going to go step-by-step through the process of
building a reliable cloud server that you own and 03    Prepare the operating system
We’ll refer to our choice of hardware from
automation enthusiast.
control. We’ll cover file sharing, email, social now on, so alter the process as needed for your setup.
He is guaranteed
100% AI-free, even if media and other collaboration tools. Let’s start We’re using a small but fast SSD for our operating
his home server isn’t. by choosing and building our base server. system. This means we need to copy the image
@mrpjevans directly onto the SSD. The easiest way to do this is
to use a cheap SATA to USB3 cable on your main
computer or other Raspberry Pi and use Raspberry Pi

01    IsWe’re
this a good idea?
setting out to build a server that
Imager (magpi.cc/imager), selecting ‘Raspberry Pi
Lite (64-bit)’. If you don’t have a cable, install the
can replicate many of the popular ‘SaaS’ (software drive in the NAS and boot off a microSD card and
as a service) solutions out there, from email use that to burn the OS onto the SSD. Either way, use
to collaborative spreadsheeting. This is only the customisation feature to choose a good network
practical if you have the time to devote to keeping name and enable SSH for remote access.
You’ll Need it updated (security especially) and are happy to
deal with the inevitable glitches. You’ll also need
> Argon EON NAS a decent internet connection if you want to run

04    Assemble your NAS


enclosure (or similar) things like an email server or a Mastodon instance.
magpi.cc/eonnas
There are many reasons to undertake this project, This will vary depending on what type of
> At least two HDD drives some political, some practical, but we’re mainly disk setup and enclosure you are using, but either
> Additional OS drive doing it because it’s a fun learning experience. way now is the time to install your disks. The
(ideally SSD) Argon EON requires some initial disassembly to
> Fast internet in access the space for a 4GB Raspberry Pi 4. For our
both directions setup we have 4 SATA slots available. The first (left
> SATA to USB3
cable (optional)
02    Choose your storage
We’re making file storage an integral part
from the front-on view) will host our SSD drive (a
quirk of the EON, due to its shape, is that slots 1
of the server. As such, we want lots of space and and 4 must be smaller drives). Next we install our
some form of backup strategy. Although you can main file storage drives in slots 2 and 3. All drives
always upgrade your storage as you go, it’s best must be secured to the backplate with the supplied
to think ahead and get as large a solution as you screws. Finally the EON has a USB 3 coupler to
can afford. Our project is using 2 × 4TB SATA hard connect the disks to the Raspberry Pi.

52 magpi.cc Build a private cloud server


TUTORIAL

With the panels off we


can see the SSD and two
larger disk drives. These
dedicated NAS drives run
slower and quieter than
their desktop equivalents.

The Argon EON is a NAS


enclosure that manages
to be both practical and
good to look at

Top Tip
Choosing
disks
If using hard disk
drives, consider
buying dedicated
NAS drives. These
tend to be slower

F ile sharing, email, social than desktop drives


but much more
efficient and quieter.
media and other tools

Build a private cloud server magpi.cc 53


TUTORIAL

W When you first log in to


OpenMediaVault you’ll see
your disks listed as devices

also need to check in on the server from time


to time, so make sure you can use SSH to log in
remotely. You should be able to reach the NAS
using your choice of name plus ‘.local’. So, if you
set the hostname to ‘nas’ in Raspberry Pi Imager,
you can SSH in using ‘nas.local’ (note: not all
routers support this feature). Once logged in make
sure everything is up-to-date by running the
following from the command-line:

sudo apt -y update && sudo apt -y upgrade

If you’re using the Argon EON, you should also


install its config scripts at this point. See the
manual for details.

07   Install OpenMediaVault
OpenMediaVault (or OMV) is a robust,
well-featured framework for creating our own
home storage. It’s excellent for avoiding some of
the more scary command line utilities for handling
disk storage and setting up sharing. OMV’s
job is to help you prepare your disks and share
them securely with the other computers on your
network. The OMV team have provided a custom
setup script at and you can run it directly by
entering:

wget -O - https://raw.githubusercontent.
com/OpenMediaVault-Plugin-Developers/
installScript/master/install | sudo bash
S You can create, view
and manage file
systems on this page 05   Test booting
Time to fire up the server for the first There will be a lot of text and the process will go
time and check everything is in order. It’s worth on for several minutes. At the end the server will
connecting a monitor and keyboard just in case reboot. Once complete you should be able to access
something is out of place. If you find the SSD OMV in a web browser at http://nas.local/ (or your
doesn’t boot, it may be because the Raspberry equivalent). You can login with username ‘admin’
Pi isn’t checking for it and you need to change and password ‘openmediavault’. Remember to
the bootloader. Open Raspberry Pi Imager. Under change that password!
operating systems choose ’Misc utility images’
> ‘Bootloader’ > ‘SD Card Boot’, burn that to a
microSD card and boot your NAS from it. When a
green screen appears, power off and remove the
card. Your SSD should now boot normally. 08    Configure your storage
You can now see the OMV web interface
for the first time. Feel free to have an exploration.
Assuming you’re starting with new disks, you
need to partition and format them. Luckily OMV

06    Wire up and update


We strongly recommend using a wired
makes this a much easier process than using the
command line. Click on ‘Storage’ then ‘Disks’.
connection for this project as it may become You’ll see your disks, including the OS disk, listed.
essential for reliable performance, especially if If not starting afresh you can wipe them here. To
you’re using email or social media services. You’ll actually use the disks, click on ‘File Systems’ and

54 magpi.cc Build a private cloud server


TUTORIAL

W The final step is to


create share points
on each disk (in reality
each is a root folder
on the disk) and then
share using SMB

11   Nightly backup
So what about the other disk? We’re
going to use that to back up our precious data.
Under ‘Storage’, ‘Shared Folders’ create a share
for the second disk (e.g. ‘nas-backup’). Then
under ‘Services’ select ‘Rsync’ then ‘Tasks’. Top Tip
Select your first share as the source and the
second share as the target. Change ‘minute’ What about
to 0 and ‘hour’ to 0, leaving all other options RAID?
unchanged. Save and apply. Now, every night
We’ve not used
at midnight, the contents of the primary RAID (Redundant
disk will be backed up to the secondary disk. Array of Inexpensive
Although there is a small window where a file Disks) in our setup
as we’re prioritising
does not have an instant backup (we’ll address backup over
the plus sign on the toolbar. Select ‘EXT4’ and this, and off-site backups, in the future) a deleted file availability. RAID
choose your first disk. It may take a few minutes will be instantly recoverable. is not a backup
solution – if you
to complete. Repeat for each disk.
delete a file on
one disk, it’s
immediately gone

12    More with OpenMediaVault from the other!

   Mounting and sharing


09 Once each disk has formatted you are
We have barely scraped the surface of what
OpenMediaVault can do. Make sure you explore
presented with a screen to mount the drive. Select the menus and look for other features such as
the disk you just formatted and click ‘Mount’. The email alerting, configuring disks to run quieter
file system is now available to OMV. You’ll see a and, importantly, using S.M.A.R.T. to monitor the
yellow ‘Pending’ prompt. This is a feature of OMV. health of your disks. You now have file sharing
Wherever you make changes, they will not take available across your home network that you can
effect until you acknowledge that prompt. Now share with your housemates or family. You can
click ‘Shared Folders’ and the plus button. Give even create individual secured folders for personal
your share a meaningful name (we used ‘nas’) use. Next time we’ll look at accessing that data
and choose your first disk. Click ‘Save’ and apply securely from anywhere on the planet, the first
the changes. Now click ‘Services’, ‘SMB/CIFS’ step in creating a true private cloud server.
then ‘Settings’ and enabled the service. Now go
to ‘Shares’ then the plus button and select your
W To connect your
shared folder. Save and apply.
shared file system
to Windows, use
File Explorer and
enter the path in
\\server-name\

10    Connect to your new share share-name format


T To connect your
In the previous steps you formatted your shared file system to
disks, created a shared folder on one of them macOS, use Finder
and enter the path in
and then allowed access using the popular SMB smb://server-name/
protocol, which is supported by a wide range of share-name format
operating systems. You can now connect to your
new storage! In each case, use your Raspberry
Pi OS username and password as credentials. In
Windows right-click on ‘This PC’ and select ‘Map
network drive’. Enter the details in format \\nas.
local\nas (change for your setup) and select ‘use
different credentials’. In macOS, select Finder then
‘Go’ from the menu and ‘Connect to server’. Enter
the address as ‘smb://nas.local/nas’ and connect.

Build a private cloud server magpi.cc 55


TUTORIAL

Capture images
and video with
Raspberry Pi
Camera Module
Learn how to capture images and video using rpicam,
the new command-line application for Raspberry Pi

T he latest version Raspberry Pi OS (based


on Bookworm) has a new camera system
called rpicam. This replaces the older
libcamera application.
Raspberry Pi has made five different types of
For those less familiar with Raspberry Pi
computers, we would recommend performing your
initial testing with a keyboard and screen attached
directly to your Raspberry Pi. Using the Raspberry
menu, open the Accessories category and click on
cameras, of which all but the original v1 camera the Terminal button. Into the Terminal window it
is currently in production. Some of them come in should be sufficient to type:
two or more different variants.
David
MAKER

The official Raspberry Pi camera modules are: rpicam-hello


Plowman
David is an engineer • Raspberry Pi Camera Module This will open a camera preview window
at Raspberry Pi with • Raspberry Pi Camera Module 2 and display the camera images there for about
a special interest
in camera software • Raspberry Pi High Quality Camera five seconds.
and algorithms, plus • Raspberry Pi Camera Module 3
image processing • Raspberry Pi Global Shutter Camera Capturing your first photo
hardware.
Raspberry Pi OS comes with a number of command
magpi.cc First, you will need to set up your Camera line utilities for capturing images in various
Module by attaching it to your Raspberry Pi. See different ways. We’ve already seen rpicam-
The MagPi #129 (magpi.cc/129) for our guide to hello which we used to test that the camera was
connecting Raspberry Pi Camera Module to your working. The next one is rpicam-still. This opens
Raspberry Pi board. up a camera preview window just like rpicam-hello
Once that’s set up, we can start looking at rpicam. did but once it’s run for five seconds it will capture
To test that your camera is correctly connected a high resolution still photograph as a JPEG file,
and working, you’ll need to install Raspberry Pi and then quit. To use it like this, enter:
OS onto your board. Using Raspberry Pi Imager
(magpi.cc/imager), write the default option, rpicam-still -o picture.jpg
Raspberry Pi OS (64-bit) to a microSD card.
Insert this microSD card into your Raspberry Pi Note how the -o option specifies the name
and power it on. Let it perform all the necessary of the file to which the image is saved. There is
updates when it first boots and then finally reboot also the -t option which specifies how long, in
it again. milliseconds, the preview window runs before the

56 magpi.cc Capture images and video with Raspberry Pi Camera Module


TUTORIAL

By default, each camera will


capture images at the maximum
resolution. It is possible to adjust
the capture resolution in software

You’ll Need
> Raspberry Pi

> Camera Module


magpi.cc/
cameramodule

> Raspberry Pi OS (64-bit)


The High Quality Camera magpi.cc/
raspberrypios
Module is focused manually,
the new Camera Module 3
has autofocus that can be
controlled in software

First, you will need to set


up your Camera Module

W Test your camera is


functioning correctly
with the rpicam-hello
Terminal command

Capture images and video with Raspberry Pi Camera Module magpi.cc 57


TUTORIAL

S Save images to jpeg files using rpicam-still and options

image is captured. So to capture the image after your keyboard and a monitor plugged directly into
ten seconds of preview, use: your Raspberry Pi.

rpicam-still -t 10000 -o picture.jpg Resolutions and formats


By default, rpicam-still will capture images at
You can view your pictures by double-clicking the maximum available resolution supported by
on the files you’ve saved in the File Manager. the camera. For the HQ camera, for example, this
means images that are 4056×3040 pixels in size.
Capturing your first video But it’s easy to change this with the --width and
There’s another command line tool for capturing --height parameters. For example, if you want to
videos, this time it’s called rpicam-vid. You can use capture an image that is 1536×1024 pixels instead,
the -o and -t options as you did before, though this you should use:
time -t specifies how long (again in milliseconds)
the video lasts. To save a ten-second video, use: rpicam-still --width 1536 --height 1024 -o
smaller.jpg
rpicam-vid -t 10000 -o video.h264
Images are normally encoded in some way (often
Note that the file name ends with .h264 they are compressed so that they aren’t so large)
which identifies the format of the video file. and then saved to a standard file format on the disk.
Unfortunately not all video players will play There are several of these formats:
the .h264 format correctly, so we would
recommend using a utility like ffplay. To play JPEG files
your video file with ffplay, type: The default file format used by rpicam-still is
JPEG because of the very wide support that it has,
ffplay video.h264 combined with a useful level of compression.
Usually, JPEG files are given the extension .jpg, or
We’ve already met rpicam-still which allows sometimes .jpeg, as we have already seen.
us to capture still images. But it also has many JPEG is a lossy compression format, meaning
more options controlling how it captures images, that the result of loading your JPEG file is no
and the file formats and available image encoders. longer identical to the image that you started
We’ll discover some of those in this tutorial. For from, though the differences are arranged to be
now, we shall continue to assume that you have ones that you will least notice. In return, you get

58 magpi.cc Capture images and video with Raspberry Pi Camera Module


TUTORIAL

Top Tip
libcamera
to rpicam
Raspberry Pi OS
to specify a quality factor indicating how much the same image. To save a DNG file, use the -r (or Bookworm renamed
compression you want. At very low values your --raw) parameter: the camera capture
image will indeed deteriorate, but at very high applications from
libcamera-* to
values the JPEG process will be visually lossless, rpicam-still -r on test.jpg rpicam-*. Symbolic
that is, it really will look as good as the original links allow users to
camera image. rpicam-still will automatically replace .jpg by use the old names
for now. Adopt the
The quality factor ranges from 1 to 99, and if .dng in the DNG file name, giving both test.dng
new application
you don’t give one it will choose the value 93, and test.jpg in this case. names as soon as
which equates informally to “quite high quality”. Many third-party software programs exist possible. Raspberry
To save a JPEG at a different quality level, use the to ‘develop’ these DNG files interactively – a Pi OS versions prior
to Bookworm still
-q (or equivalently --quality) parameter like this: rather complex procedure beyond the scope of use the libcamera-*
this guide. name.
rpicam-still -q 80 -o test.jpg
Time-lapse captures
Please experiment with quality values like 10 A time-lapse capture is where we capture an
and 50 to see what you get! image at regular intervals, perhaps every minute,
hour or day, and then reassemble them into a
PNG files video where we play them back at a much faster
PNG (or ‘Portable Network Graphic’) is another rate. rpicam-still is all set up to capture the
file and compression format which enjoys wide images we need out of the box.
support. PNG is a lossless compression format, We need to introduce the --timelapse option
meaning that you are guaranteed to be able to and we’ll review a couple that we’ve seen before:
recover exactly the same image that you started
from (unlike JPEG). On the downside, PNG files are • -t or --timeout The length of time in
normally larger than JPEG files, and they are harder milliseconds for which to perform a capture.
work to create, which takes longer. In the case of timelapse, rpicam-still
To save a PNG file you’ll need to tell rpicam- will run capturing images in total for this
still that you want to use a different encoder duration. You can pass the value 0 which
using the -e or --encoder parameter, like this: means “run indefinitely” (you will have to
stop rpicam-still manually, for example
rpicam-still -e png -o test.png by pressing CTRL+C on the keyboard).
• --timelapse The length of time, again
Note that it’s necessary to specify the -e option in milliseconds, between each of the
to get a PNG file - changing the file name on timelapse captures.
its own is not enough. PNG does not support a • -o or --output The name of the output file
quality parameter. or files. For timelapse captures, we can’t
give all the images the same name so we
DNG files use a special syntax that includes an image
DNG, or ‘Digital Negative’, files are quite different counter. For example, -o capture_%04d.jpg
from PNG files despite the similar abbreviation! means that all the files are named capture_,
As the full name suggests, they’re somewhat followed by a counter, and then .jpg. %04d
analogous to the ‘negatives’ we had from film specifies how the counter is formatted,
cameras before developing them into photos. In in this case the 0 means to add leading
our case, the DNG file stores the raw numbers zeroes to the number and the 4 means
received from the image sensor before the “so that every number has at least 4 digits”.
hardware on Raspberry Pi ‘develops’ it into a This is useful so that listing your image
viewable (JPEG or PNG) image. DNG files are saved files will return the list to you in
alongside the ‘developed’ JPEG or PNG version of chronological order.

Capture images and video with Raspberry Pi Camera Module magpi.cc 59


TUTORIAL

 hen using the Camera


W
Module 3, autofocus is
enabled automatically

S Video files can be recorded using rpicam-vid and


played back using the ffmpeg command

Let’s try an example: Capturing when a key is pressed


Rather than doing regular captures, we can also do
rpicam-still -o capture_%04d.jpg --timelapse them in response to an event, or a key press. There
5000 -t 30000 --width 1024 --height 768 are a couple of new option parameters to learn.

This will run for 30 seconds, capturing an • --datetime Use this instead of -o to name the
image every five seconds, and they’ll be called output file after the current date and time. The
capture_0000.jpg through to capture_0004.jpg. format will be MMDDhhmmss.jpg where MM and DD
Note how we’ve reduced the resolution of the are the month and date number, and hh, mm and
images to something that is more appropriate ss are hours, minutes and seconds.
to the final video that we want to create. • -k or --keypress Capture an image when
ENTER is pressed on the keyboard. Press X and
Assembling your images into a video press ENTER to quit.
There’s a handy tool called FFmpeg which is
capable of turning your sequence of still images So the command to use is this:
into a video. We can use it like this:
rpicam-still -t 0 --keypress --datetime
ffmpeg -r 2 -i capture_%04d.jpg video.mp4
Here we’re running the capture indefinitely,
Note how we format the name of the input so we’ll have to type X followed by ENTER to
files with the special % syntax in the same quit (or press CTRL+C). Files would have names
way as we did for libcamera-still. The -r like 0405102742.jpg, meaning ‘10:27am, and 42
parameter gives the framerate of the output seconds, on 5 April’.
video, which is two frames per second in this case.
We’ve chosen the output file to have the MP4 Capturing in response to a signal
format (which is generally well supported), and For those familiar with Linux signals, an
called it video.mp4. alternative to pressing a key is to send a signal
FFmpeg is a highly versatile tool that we instead. To do this, simply use -s or --signal
recommend learning about. instead of -k (or --keypress).

60 magpi.cc Capture images and video with Raspberry Pi Camera Module


TUTORIAL

Top Tip
Compatability
Raspberry Pi
Camera Modules
are compatible with
all Raspberry Pi
computers with CSI
connectors - that is,
all models except
Raspberry Pi 400
and the 2016 launch
version of Zero.
S The -- timelapse option enables ripistill to
capture images on a regular basis

To send a capture signal to libcamera-still, High Dynamic Range imaging


first start it and then type the following into The Camera Module 3 supports High Dynamic
another terminal window: Range (or HDR) imaging. To use it, specify the
--hdr option on the command line, for example:
kill -SIGUSR1 `pidof libcamera-still`
rpicam-still --hdr -o hdr.jpg
And you can force libcamera-still to quit with
Note that non-HDR captures can be performed
kill -SIGUSR2 `pidof libcamera-still` at a maximum resolution of 4608×2592 pixels,
but HDR captures, because of the special nature
of the sensor required to support HDR, are
Autofocus and High Dynamic Range limited to 2304×1296 pixels (exactly half the
Autofocus and High Dynamic Range imaging are width and height of the non-HDR mode).
supported only on Raspberry Pi Camera Module 3
at the time of writing.
When using the Camera Module 3, autofocus is
enabled automatically in continuous mode. This
What, no preview?
means that the camera lens will move whenever If you don’t see the preview window, please check that:
necessary to maintain optimal focus on the centre • You are directly connected to your Raspberry Pi
part of the image, and this is probably what most with a screen and keyboard
users will want most of the time. • You are running the official Raspberry Pi software
and that it is fully up to date. If you have made
It’s also possible to turn off autofocus and
any changes to your Raspberry Pi’s configuration
set the focus position of the lens manually. To
please consider reverting back to the standard
do this, use the --lens-position parameter, unaltered Raspberry Pi OS (by re-writing your
and pass it a value measured in dioptres, micro SD card if necessary) and trying again
meaning the reciprocal of the focus distance. Thus, • All your cables are the right way round and seated
to focus at a very close distance of about 0.1m, correctly
• You are using an official Raspberry Pi camera.
pass in the value 10 (which is 1 / 0.1). To focus
Non-official cameras are supported, but may
at infinity, pass in 0 (informally, the value of 1 /
need some extra configuration which the module
infinity). You can pass in non-integer values too. vendor would have to supply
For example: • You have a good quality power supply. Raspberry
Pi power supplies are recommended because
rpicam-still --lens-position 0 -o infinity.jpg they are known to supply sufficient power to
Raspberry Pi and the camera
Please check out Raspberry Pi’s Camera Forum
…will set the focus position to infinity and not
for more tips and advice if you’re having trouble
move the lens again. (magpi.cc/camforum).

Capture images and video with Raspberry Pi Camera Module magpi.cc 61


FEATURE

Incredible
vision projects with
Raspberry Pi Camera
Raspberry Pi Camera Modules, and the fancy new AI Kit HAT+,
up the ante for vision-based projects, explains Rosie Hattersley

62 magpi.cc Incredible vision projects with Raspberry Pi Camera


FEATURE

 ne of the most appealing aspects of


O
Raspberry Pi is just how adaptable it is

Read these issues!


MagPi 126
We introduced Camera Module 3 in The MagPi issue #126.
magpi.cc/126

W
ho doesn’t love taking photos? Pets,
people, places, events, it’s wonderful
to be able to take a few snaps and
keep the resulting images as a memory you can
draw upon whenever you wish to.
Raspberry Pi has some great options for taking
both still photos and video thanks to the dedicated
Camera Modules that can be attached directly to the
board via the CSI (camera serial interface).
Raspberry Pi Camera Modules (magpi.cc/camera) MagPi 144
cost from just £24/$25 for Camera Module 3, or In this very issue, David Plowman, a Raspberry Pi engineer wrote a guide
£48/$50 for HQ Camera (magpi.cc/hqcamera). on how to take photos and videos with the Camera Module 3.
Of course, Raspberry Pi’s compact size means Page 56
it’s ideal for a whole range of visual projects, from
a static webcam for video chat from the comfort
of your home to outdoor adventures spotting and
recording wildlife or natural phenomena in the night
sky. You could even add a Camera Module to a robot
to act as its eyes and help decide whether to tackle or
avoid approaching obstacles.
One of the most appealing aspects of Raspberry
Pi is just how adaptable it is: you need only fit the
right hardware, often as a HAT to turn it into a
specialist device for monitoring, photographing,
playing or recording something, be it wildlife,
plants, nosy siblings, instruments you want to
master, or places you want to memorialise.
This month we’re going to look at how to attach
a Camera Module to Raspberry Pi and use the
Camera Software to integrate it into your projects.

Incredible vision projects with Raspberry Pi Camera magpi.cc 63


FEATURE

Get to know your cams


R
aspberry Pi launched its first Camera
Module way back in 2013, with only five
megapixels, but an eight-megapixel
Camera Module 2 quickly followed in 2016. The
latest, Camera Module 3 can now capture HD video
at 50fps (frames per second) as well as snagging
impressive 12-megapixel stills with HDR (high
dynamic range) and autofocus.
There’s a Wide version of Camera Module 3, too,
for wide-angle photography at up to 120 degrees
compared to the standard model’s 75 degrees.
Both versions also have a NoIR variant that comes
without the infrared filter, making the sensor
suitable for night-vision use. The NoIR Camera
Module is a popular choice for stealthy wildlife
photography since many creatures are nocturnal
and you don’t want to risk disturbing them with S Camera Module 3 connects to Raspberry Pi
unexpected lights. using a camera cable connection
Images and video are typically saved to the same
micro SD card that runs Raspberry Pi OS, so it’s
a good idea to use a card with a plentiful storage
 amera Module 3 can now capture
C
capacity (say 16GB or more). Or you can add the HD video at 50fps, as well as
new M.2 HAT (magpi.cc/m2hatplus) and add a
fast NVMe SSD to store large files.
12-megapixel stills with HDR
There is also a more specialist camera model,
the £/$50 Raspberry Pi Global Shutter Camera,
(magpi.cc/globalshuttercam) which is designed
for capturing action shots such as sports, as well as
use in machine vision applications. It can capture
rapid motion without the artefacts created by the
rolling shutter effect, where the slow readout of
the sensor means the subject has moved between
the beginning and end of the frame.

X Camera Module 3
features a 12MP sensor
with HDR and an
autofocus lens

64 magpi.cc Incredible vision projects with Raspberry Pi Camera


FEATURE

Added intelligence Module is, say, a person, a vehicle, a particular


Raspberry Pi recently launched a brand-new type of animal and so on. Developed especially for
AI Kit (magpi.cc/aikit) that compliments the Raspberry Pi, the Hailo-8L M.2 AI acceleration
camera. It that takes advantage of the faster module provides 13 TOPS of inferencing
processing speeds of Raspberry Pi 5 and sports performance (13 trillion operations per second)
a dedicated acceleration processor made by and the impressive throughput figures needed
specialists Hailo (hailo.ai). for solid neural processing abilities, all for the
While you’ve no doubt seen the acronym AI princely sum of £65/$70.
(artificial intelligence) bandied about rather Wondering what machine learning is all about?
a lot recently, it’s more accurate to state that Raspberry Pi Foundation has a quick primer
it uses machine learning to work out whether (magpi.cc/machinevision).
something fits into a particular category or The AI Kit is ideal for fun projects such as
adheres to specific rules. wildlife detection, recording perhaps a garden visit
In the case of Raspberry Pi’s AI camera kit, from a nocturnal badger but ignoring any cats
this enables rapid object detection and discerning or foxes that saunter by. And we’re sure it’ll fit
whether or not an item detected by the Camera professional applications as well.

 he AI kit is ideal for fun projects


T
such as wildlife detection

W Adding AI Kit to
your camera projects
can introduce fast
object recognition

Incredible vision projects with Raspberry Pi Camera magpi.cc 65


FEATURE

Get started with


Camera Module
Y
ou can use most Raspberry Pi models Capture images from the
for photography since all feature a CSI command line
(camera serial interface) for connecting With Camera Module You are now ready to
the Camera Module (see ‘Compatibility’, left). start controlling the Camera Module using the
Power off your Raspberry Pi and use the ribbon command line.
cable supplied with Camera Module (magpi.cc/ If you are using Raspberry Pi OS Bookworm
camcable) to connect it to the CSI connection (the latest version of Raspberry Pi OS) you will
on the board. Raspberry Pi Zero and the new use the new rpicam commands. See ‘The rpicam
Raspberry Pi 5 feature smaller CSI connections, and applications’, right, for more information.
Top Tip you will need a special cable to use these devices. Open a Terminal window (click the black
Handily, most resellers include the narrower monitor icon in the Taskbar) and type:
Compatibility ribbon cable as part of their Raspberry Pi Zero
Raspberry Pi and Raspberry Pi 5 case kits. You’ll need a larger $ rpicam-hello
Camera Modules one for other models of Raspberry Pi.
are compatible with The flex cable inserts into the connector labelled An image from the camera will appear on the
all Raspberry Pi
CAMERA on the Raspberry Pi board. Raspberry Pi screen. If you get an error message turn Raspberry
computers with CSI
connectors – that 5 has two CAM/DISP connectors marked 0 and 1. Pi off and check the cable connections are secure,
is, all models except Connect the camera cable to either of them. and that the cables are the correct way around.
Raspberry Pi 400
Depending on the model, the camera may come Ensuring everything works you can capture an
and the 2016 launch
version of Pi Zero. with a small piece of translucent blue plastic film image using rpicam-jpeg and the -output option
covering the lens. This is only present to protect and a file name.
the lens while it is being mailed to you, and needs
to be removed by gently peeling it off. $ rpicam-jpeg --output test.jpg
Locate the Camera Module port and pull up its
plastic clip (be gentle). The connectors for the
Camera Module and the port need to face each
other. Clip them together and carefully push the
retaining clip back into place.
James Adams at Raspberry Pi created a setup
video for the original Raspberry Pi board, showing
how to attach the camera. The process has
remained the same since (magpi.cc/camsetupvid).
Check that the cable is securely attached
to both the Camera Module and Raspberry Pi
board, and power on.

X The ribbon cable is used to


connect Camera Module
to the CSI socket on
Raspberry Pi boards

66 magpi.cc Incredible vision projects with Raspberry Pi Camera


Press Enter to enact the code. You should see a The rpicam applications
preview window for five seconds. Then, rpicam-
jpeg captures a full-resolution JPEG image and Raspberry Pi OS Bookworm renamed the camera capture
saves it. applications from libcamera to rpicam. Symbolic links
Experiment with taking screenshots of different allow users to use the old names for now, but you should
adopt the new application names as soon as possible.
sizes and dimensions by adding -height and
Raspberry Pi OS versions prior to Bookworm still use
-width options and entering different numerical
values, For example, the following command
libcamera name. Here are the rpicam applications you Top Tip
can use from the command line:
displays the preview window for 2 seconds, then
captures and saves an image with a resolution of
> rpicam-hello: A “hello world”-equivalent for cameras, Camera on
which starts a camera preview stream and displays it
640×480 pixels: The Camera
on the screen.
configuration
rpicam-jpeg --output test.jpg --timeout 2000 > rpicam-jpeg: Runs a preview window, then captures should be enabled
by default. You can
--width 640 --height 480 high-resolution still images.
go to Preferences,
Raspberry Pi
> rpicam-still: Emulates many of the features of the
See the Raspberry Pi documentation for more Configuration and
original raspistill application. check that Enable
information on rpicam and how to use it from
Camera is toggled
Terminal: magpi.cc/rpicam. > rpicam-vid: Captures video. on, then restart
your Raspberry Pi.
Use Python to control the camera > rpicam-raw: Captures raw (unprocessed Bayer)
frames directly from the sensor.
The Picamera2 library is a rpicam-based
replacement for Picamera, which was a Python > rpicam-detect: Not built by default, but users can
interface to Raspberry Pi’s legacy camera stack. build it if they have TensorFlow Lite installed on their
Picamera2 presents an easy-to-use Python API. Raspberry Pi. Captures JPEG images when certain
Documentation about Picamera2 is available on objects are detected.
GitHub (magpi.cc/picam2git) and the Picamera2
Recent versions of Raspberry Pi OS include the five basic
manual (magpi.cc/picam2man).
rpicam-apps, so you can record images and videos using
Recent Raspberry Pi OS images include
a camera even on a fresh Raspberry Pi OS installation.
Picamera2 with all the GUI (Qt and OpenGL)
dependencies. Recent Raspberry Pi OS Lite images
include Picamera2 without the GUI dependencies,
although preview images can still be displayed
using DRM/KMS. camera.py DOWNLOAD
If your image did not include Picamera2, run the
THE FULL CODE:
following command to install Picamera2 with all of magpi.cc/github
> Language: Python
the GUI dependencies:

sudo apt install -y python3-picamera2 001. from picamera2 import Picamera2, Preview
002. import time
Open Thonny Python IDE from the main 003.
Raspberry Pi OS menu, create a new file and save 004. picam2 = Picamera2()
it as camera.py. Note that you should definitely 005. camera_config = picam2.create_preview_configuration()
not name it picamera.py as this will overwrite the 006. picam2.configure(camera_config)
control app. 007. picam2.start_preview(Preview.QTGL)
Enter the code from camera.py, press Save 008. picam2.start()
and Run. Camera Module will display a preview 009. time.sleep(2)
for five seconds, and save the file as test.jpeg in 010. picam2.capture_file(“test.jpg”)
your home folder.

Incredible vision projects with Raspberry Pi Camera magpi.cc 67


FEATURE

Camera Module projects


Get started with Camera Module with these great projects
 ou will need to choose
Y Watch something grow with a time-lapse
a discreet location where Time-lapse videos are great for summarising a project build,
showing the seasons changing, or something growing. They are
you have a clear view one of the best starter projects for Raspberry Pi Camera Module,
although you won’t see the results for a while.
You can either initiate the timelapse from your Raspberry
Capture wildlife in action Pi desktop computer or, more likely, will want to trigger it
We’ve covered lots of different wildlife-detecting projects remotely using SSH to control both Raspberry Pi and Camera
in The MagPi, from the amazing Nestboxlive (mapgi.cc/ Module from afar.
birdbox), which places Raspberry Pi hardware and cameras You will need a steady mount to avoid camera wobbles or
inside bird boxes in nature reserves in the UK and beyond, worse; you don’t want to return to the scene of a days’ or
to all sorts of self-assembly models that keep the elements weeks-long shoot only to find the camera has fallen over leaving
out by housing the camera gubbins inside a plastic tub. you with no usable footage.
If you like the idea of making your own Raspberry Pi Phil King’s detailed tutorial in HackSpace magazine (magpi.cc/
camera-based box, you can buy a kit from the likes of timelapse) walks you through the set up, and recommends mounts
Naturebytes (magpi.cc/naturebytes). Then follow the such as the ZeroView which allows you to attach your Raspberry
instructions to assemble your own using a NoIR Camera Pi Camera Module rig to a window and shoot footage through it.
Module and any standard-size Raspberry Pi. Along with It was created using libcamera, but can easily be updated to rpicam.
the other static photography projects covered here, such as Phil strongly recommends creating test shots so you know
the timelapse one, you will need a housing large enough to what’s in the frame, and explains how to capture code to preview
include a power brick that will keep the Raspberry Pi wildlife images if you’re triggering the camera remotely. To commence
camera running. time-lapsing, Compiling the resulting footage is straightforward
You will need to choose a discreet location where you have too and can be done on Raspberry Pi directly.
a clear view but the bird box is positioned high enough up
that doesn’t attract predators (trauma all around!) and the
location can be monitored throughout the nesting season
without the birds being disturbed. Parents note that this
tutorial is part of the National Curriculum too. Read more
on The MagPi’s website: magpi.cc/infraredbirdbox.

68 magpi.cc Incredible vision projects with Raspberry Pi Camera


FEATURE

Capture celestial wonders


Astrophotography and Raspberry Pi go together very well indeed
using Raspberry Pi smarts to track constellations across the night
sky, so the telescope is primed for the perfect shot. Projects such
as Joe Kutner’s autoglider showcase the possibilities to rather
impressive effect: AutoGlider (magpi.cc/autoglider).
Hubble Pi, meanwhile, makes use of Raspberry Pi’s own
 aspberry Pi cameras
R camera modules to take shots: magpi.cc/hubblepi. With Hubble

are ideal for capturing Pi, Raspberry Pi 4 and the HQ camera are used alongside
a Maksutov telescope and established astronomy software
celestial visual spectacles including KStars to build a picture of the night sky and identify
areas of photographic interest. Maker Santiago particularly liked
the HQ camera’s “bigger, exposed sensor [that] would allow it
Ward off unwanted visitors to essentially use the telescope as a big mirror lens” and found
Parents, nosy neighbours, annoying siblings: who wants them it good value for the quality it could offer. Santiago created
creeping around? Kids keen to try out Camera Module can a Python-based interface he called Astrocam that supports
turn the tables on snoops with a spycam that sends an alert if touchscreen control and allows him to control the ISO, shutter
someone uninvited enters their domain. speed and exposure times as well as capturing multiple shots at
The Parent Detector (magpi.cc/parentdetector) tutorial is once, all of which make it a cut above the average USB camera
easy to follow and explains how to set up Raspberry Pi Camera used for astrophotography.
Module and PIR motion sensor to trigger video recording should This year Europe and swathes of the northern hemisphere
an unexpected visitor be detected. It’s clever enough not to have been treated to some incredible aurora borealis activity
trigger if the door simply rattles, has a stealth mode (no telltale while other places witnessed an eerie solar eclipse. Raspberry
red recording light) to fool suspicious types and provides video Pi cameras are ideal for capturing celestial visual spectacles
evidence should a wannabe snoop plead innocence. Should you (magpi.cc/aurora) as well as being popular for tracking asteroids
receive an intruder alert from the Raspberry Pi camera you can and constellations with AllSky Cameras. We were really taken
view the footage in OMXPlayer to check it wasn’t just the cat with Svalbard resident Frank Prins’ Northern Lights project
paying you a visit before you launch in and raise merry hell with in which a weatherproofed to -50C Raspberry Pi and Camera
the oldies about an invasion of privacy. Module tucked inside
a 3D-printed tube
automatically detect the
aurora borealis, wake up
and record the spectacle
for viewing an whatever
hour he seems fit.
Because it is not
dependent on being
sited in a dark sky
region (and should work
well in light-polluted
urban locations too),
we like the meteor-
detection possibilities of
using Camera Module 3
Wide, especially as the
setup is clever enough
to discern shooting stars
and falling meteors,
then track and record
them as they pass across
the night sky (magpi.cc/
meteortracker).

Incredible vision projects with Raspberry Pi Camera magpi.cc 69


REVIEW

ArmPi FPV AI Vision


HiWonder magpi.cc/armpifpv From £200 / $300

SPECS
A sturdy robotic arm with computer vision for
FEATURES: an impressive range of AI abilities. By Phil King
6DOF (including
gripper),
HD camera,
breakout board,
metal base
and fittings
CONNECTIONS:
Breakout board
screw terminals
for power, JST
connections
for servos
SERVOS:
LX-255 (base)
— 25kg torque;
LX-15D —
17kg torque;
S Block-stacking makes use of computer vision
Anti-blocking and image recognition via Raspberry Pi
bus (gripper)
— 8kg torque
DIMENSIONS/ Strong arm
WEIGHT We tried out the Advanced kit with Raspberry Pi
277 × 177 × 5. The arm comes ready-assembled, sitting on a
428mm; 1.2kg solid black metal base whose rear section holds
Raspberry Pi, secured with screws and pillars. Four
suction cups stick the base to a desk or the floor
X Equipped with a – not the most secure of methods – but the unit
wide-angle camera,
the robotic arm has itself is very sturdy.

E
6DOF including a The breakout board is mounted on Raspberry Pi
strong gripper to
pick up objects up quipped with a camera, the ArmPi FPV is a and wired from JST connectors to the arm, with
to 500g in weight capable robotic arm that uses AI computer some spare servo and SPI sockets. Power – for the
vision to help it perform a range of tasks. arm and Raspberry Pi – is supplied from a 7.5V 6A
The kit is available with or without Raspberry Pi 4 DC PSU via a barrel adapter with two wires that fit

Verdict or 5 (4GB or 8GB RAM) included.


There are also three editions to choose from:
into screw terminals on the breakout board.
The arm itself has six DOF (degrees of freedom)
Great value for Standard, Advanced and Developer. The Standard counting the gripper on the end of it, which can
money considering kit features the robotic arm, breakout board (one be rotated via a ‘wrist’. The base servo enables
the sturdiness of
of two versions, for Raspberry Pi 4 or 5), power the whole arm to rotate, while three vertical
the arm, built-in
camera, and AI supply, paper ‘map’ (more on that later), coloured elbow joints, with anodised metal brackets, enable
vision possibilities blocks, plain blocks, coloured balls, and tags. The countless possible positions. The servos are of

9
Advanced kit adds a couple of flat-pack shelving three types/sizes, each with 0.3° accuracy, 0–240°
units for ‘warehousing’ operations, while the rotation range, and feedback for angle read,

/10
Developer kit adds several extra sensors, a dot temperature, voltage and position. Arm movement
matrix display and a fan. is reasonably smooth, and not particularly noisy.

70 magpi.cc ArmPi FPV AI Vision


REVIEW

 capable robotic arm that uses


A
S The ArmPi FPV comes with a paper ‘map’ with
AI computer vision to help it
block and stacking zones for AI tasks, plus
optional shelves for warehousing perform a range of tasks
A view to a thrill The app is just a showcase for the arm’s
Mounted just behind the gripper, the HD camera capabilities, however: a starting point. By following
offers a wide-angle 120° view. It’s connected an extensive array of online tutorials, you’ll learn
by a long, loose cable to one of Raspberry Pi’s how to program it with Python, use OpenCV for
USB ports, with no clips to secure it to the arm, image recognition, employ ROS (Robot Operating
although it does pass through a cutout in the System) and MoveIt motion planning, use inverse
metal base. kinematics to reach a desired arm position, and
The camera is the key to the arm’s AI abilities. much more.
The simplest way to try these out is with the
WonderPi smartphone app (iOS or Android). Once
your phone is connected to the arm’s automatic T A smartphone app enables manual
remote control and an array of fun
Wi-Fi hotspot, you can use the app to control it
AI modes such as block-stacking
remotely. The gripper, wrist, and base servos are
adjusted by pressing on-screen arrows, while
the others are controlled by dragging them on a
graphic of the arm.
The app’s AI modes are where the fun really
starts. Item tracking sees the arm move to track
an object of the chosen colour (red, green, or
blue) held in your hand. Face recognition is self-
explanatory, resulting in a gripper ‘wave’ to say
hello. Item sorting and stacking modes see the arm
pick up coloured (or tagged) blocks in turn and
either place them on the correct squares on the
paper map, or stacked up on a blank square. It’s
impressive to watch in action and the app gives you
an FPV camera view. If you have the optional shelf
units, you can get it to do warehousing, delivering,
and transferring tasks.

ArmPi FPV AI Vision magpi.cc 71


REVIEW

TouchBerry Pi Panel
PC 10.1
Industrial Shields magpi.cc/touchberrypi10 From £483 / €570 / $614

A robust Raspberry Pi-based touchscreen panel


SPECS PC for industrial automation. By Phil King
DISPLAY:
Capacitive
touch, 10.1-inch,
1280×800, TFT/
IPS, 900 nits,
RTD2662
controller chip

CONNECTIONS:
Screw terminals
for power,
I2C, SPI, RS485,
RS232/TTL,
2 × analogue
inputs,
3 × digital inputs,
5 × digital
outputs

X The 10.1-inch version


of the TouchBerry
Pi has a capacitive
touchscreen with a
16:9 aspect ratio and

D
1280×800 resolution

esigned for use in industrial settings, The touchscreen is surrounded by quite a large
the newly updated TouchBerry Pi is a bezel which forms part of the protective case.
panel PC powered by Raspberry Pi 4 With a lot of metal parts, it’s a pretty hefty unit
that comes in two screen sizes: seven and 10.1- that feels really solid – and heavy, at 1.67kg. Six
inch – we tested the latter. It has been designed mount points (two top and bottom, one either
and produced by Industrial Shields, a Spanish side) enable it to be mounted using the supplied

Verdict company that specialises in industrial automation


solutions based on open-source hardware. Its
brackets and bolts.
By default, the case has an IP (ingress
A really solid unit products are used in a wide range of sectors protection) rating of 20, for protection against
with good hazard – see magpi.cc/iscasestudies for details. solid objects up to 12mm, but you can pay a
protection, a decent
Along with a highly responsive capacitive little extra (€25) for IP65, which offers full
touchscreen, and
enough I/O for touchscreen with a 1280×800 resolution, protection against dust and low-pressure jets
simple applications. the TouchBerry Pi boasts enough digital and of water from all directions. Both versions have

8
analogue I/O to replace a PLC (programmable a wide operating temperature range of 0°C to
logic controller) for some simple automation 50°C, with humidity of 0% to 90%. The unit

/10
applications. To this end, it has numerous screw also has a shock resistance of 80m/s2 in the X,
terminals on the left and right sides. Y, and Z directions.

72 magpi.cc TouchBerry Pi Panel PC 10.1


REVIEW

T he touchscreen is surrounded
by quite a large bezel which forms
part of the protective case

S Node-RED is pre-installed so you can start


creating programming flows in a low-code
environment within a web browser

X The browser-based dashboard for the example


temperature sensor Node-RED program has gauges
for three measurement units

Powering it `up Ins and outs


After connecting a 12V (2.5A) or 24V (1.25A) DC As mentioned, there are two sets of screw terminal
power supply to the relevant screw terminals connections on either side of the device for
on the right-hand side (make sure the polarity I/O. The right-hand side covers all of the main
is correct!), the TouchBerry comes to life, communications protocols: I2C, SPI, RS485 (half
booting into Raspberry Pi OS – there’s no or full duplex), and RS232/TTL.
physical power button. On the left side is the second set of I/Os,
The pre-installed edition of Raspberry Pi OS which requires an additional power supply to be
is the older Buster version, although you could connected to the 24V COM terminals there. Both
always re-flash or replace the microSD card by the digital and analogue I/Os have self-insulation,
opening up the back of the case, a procedure which so can be connected to power supplies with
also enables you to move some jumper switches different voltages than 24V. Two analogue inputs
to reconfigure settings such as voltage levels for can be used in the default 4–20mA configuration
the I/O. The system runs fine, although we did (requiring a 1kΩ resistor) or 0–10V. Three digital
experience occasional lag when trying to select inputs and five digital outputs complete the set.
items on the desktop. While the total number of I/Os on the
You can connect to a Wi-Fi network from the TouchBerry Pi is no match for the huge number
desktop or command line (although we needed to featured on a dedicated PLC, there should be
manually add a network gateway to gain internet enough here for many basic applications. We tested
access), or plug in an Ethernet cable for a wired it out by connecting a DS18B20 temperature sensor
connection. The latter can also be used to network and displaying the data in on-screen gauges using
the TouchBerry Pi with a dedicated PLC to add extra the Node-RED low-code environment, as detailed
I/O and exchange data. Naturally, you can install at magpi.cc/istempdemo. A little configuration is
extra Raspberry Pi software in the usual way. required, but it’s fairly easy to set up and deploy.
The only visual clue to the presence of
Raspberry Pi 4 is provided by a cutouts for the W There are I/O (and
power) connections
latter’s USB and Ethernet ports, at the base – with removable
of the unit. So you can plug in a mouse and screw terminal
blocks – on either
keyboard if you want. Alternatively, you can side of the unit
install an on-screen keyboard.

TouchBerry Pi Panel PC 10.1 magpi.cc 73


REVIEW

LR1302 LoRaWAN HAT +


Gateway Module
Elecrow magpi.cc/LoRaWANHAT From £32 / $41

Improve your IoT devices with this LoRaWAN bundle


SPECS for full-size Raspberry Pi boards. By Rob Zwetsloot
CHIPSET
Semtech
SX1302 with
an RTC battery

SENSITIVITY
-125dBm
@125K/SF7,
-139dBm
@125K/SF12

CHANNELS
8 channels with
bandwidth of
125/250/500 kHz

X The LoRaWAN HAT in


a fetching purple

T he range on the gateway is very good,


and we didn’t have any problems with
devices around our home not reaching it

A s the Internet of Things and home


automation grow more advanced, the
technology that allows devices to connect
up around your house (or office, or farm, etc)
has also beefed up. We’re used to using a lot of
The LoRaWAN HAT from Elecrow paired with the
firm’s Gateway Module is one way to get started
with long-range IoT networking on Raspberry Pi,
fitting neatly on top of any full-size Raspberry Pi
with 40 pins (including Raspberry Pi 1 A+ and B+).
wired connections or making use of proprietary Construction is simple – simply slot the Gateway
wireless formats, however LoRaWAN on Raspberry Module into the HAT’s mini PCIe connector, and
Pi has opened up whole new avenues to users, with slot the HAT on top of your Raspberry Pi. There are
more open and accessible wireless protocols that external antennas to add as well, including a fancy
can cut down on almost all your wires. GPS module in case you need to know its location.

74 magpi.cc LR1302 LoRaWAN HAT + Gateway Module


REVIEW

From source
The software is a little more involved though. The
docs (magpi.cc/loradocs) help guide you in the
setup, which includes compiling the software from
source and connecting everything up to thethings.
network so you can control it all remotely. It’s a
bit of a lengthy process, however it’s definitely
streamlined once you get past the initial compiling
phase. This is not for folks wanting to try out their
first IoT set up though, with LoRaWAN products
definitely having a more professional user in mind,
W The Gateway Module
and the docs don’t help you beyond getting the makes the magic
gateway working. happen

That said, if you know your LoRaWAN stuff,


you’re all ready to start connecting devices. The Prosumer uses
range on the gateway is very good, and we didn’t This is definitely a very powerful piece of kit,
have any problems with devices around our home and very reasonably priced at that, although you
not reaching it. We even put some sensors outside will need to supply your own Raspberry Pi for it
and they worked a treat. The GPS worked well too, as well. If you’re feeling the strain in your home
something you’d need if you’re deploying gateways automation network and fancy upgrading to the
out on a farm or throughout a wider area. You next level, it’s definitely a great way to try out and
could probably jury rig it to work as a GPS tracker experiment with LoRaWAN too, and Elecrow also
or Geocacher if you’d like to as well, however there has Node Boards you can use with it if you need to
are better ways to do that. upgrade that part too.

W All mounted to
Raspberry Pi

Verdict
A great piece of kit
designed for folks
with serious remote
automation needs
that fits snugly atop
a Raspberry Pi

8 /10
LR1302 LoRaWAN HAT + Gateway Module magpi.cc 75
PLAY
& CODE
GAMES!
RETRO GAMING WITH

RASPBERRY PI 3 RD E D I T I O N
Retro Gaming with Raspberry Pi shows you how to set up
Raspberry Pi 5 to play a new generation of classic games. Build your
gaming console and full-size arcade cabinet, install emulation software
and download original games with our step-by-step guides. You’ll
discover a vibrant homebrew scene packed with new games for original
consoles and legal access to all those retro games you remember!

Set up Raspberry Pi
for retro gaming
Emulate classic
computers and consoles
Learn to code
retro-style games
Build a console,
handheld, and full-size
arcade machine

BUY ONLINE: magpi.cc/store


RESOURCES

10 amazing:
big builds
Making something big, and  Teslonda
making it with Raspberry Pi Custom electric car
Taking a 1981 Honda Accord and souping it up is one thing, then there’s

F
making it an electric hot rod. All powered by Raspberry Pi, of course.
eatures Ed Rob has been trying to make ‘Big Builds’
a thing in the magazine for a long time but it never magpi.cc/teslonda
really took off. That hasn’t stopped people from around
the world putting a tiny Raspberry Pi into projects big enough
for a server (sort of). Here are just ten of them.
 Arcade machine
Retro cool
In Retro Gaming with Raspberry Pi, we show
you how to make your own nifty arcade
cabinet powered by Raspberry Pi, and with
your own custom vinyls too!

magpi.cc/retrobook3

 DoodleBorg
Big rover
PiBorg's biggest robot is a rover they made themselves. It’s powerful
enough to pull a caravan, which is why it has a tow ball on it. It was built
to show just how powerful PiBorg tech is.

magpi.cc/doodleborg

 Raftberry
Floating dock
It can be nice to pootle around a lake, especially with some delicious
food and company. This Raspberry Pi-powered raft uses arcade controls
to move around on the water.

magpi.cc/raftberry

78 magpi.cc 10 amazing gaming accessories


RESOURCES

 Magic mirror
Rite of passage
A classic project that just about every Raspberry Pi fan has attempted at
least once, the software for it is very powerful and easy to use too.

magicmirror.builders

 Odyssey Lights
Illuminating Blackpool
One of the biggest Raspberry Pi builds around, these 11-metre-high
interactive towers are full of lights, lasers, speakers and other special  Pinball machine
effects which were made possible with Raspberry Pi.

magpi.cc/odysseylights

 Interactive TTRPG table


Digital D&D
Built for in-person Dungeons & Dragons using popular remote virtual table
software, the only thing it’s missing is an ornate carved fascia.

magpi.cc/dndtable Steel ball run


The folks at Team Pinball design and build their own pinball machines,
and decided that Raspberry Pi was the perfect computer to run these
throwback games.

magpi.cc/teampinball

 Open Weed Locator


Raspberry Pi farming
This big robot travels fields and uses Raspberry Pi with computer vision
software to scan for, and pull up, unwanted weeds and other plants.

magpi.cc/openweed

 SailBot
Robotic boat
Tired of winning robotic
sailing regattas, a group of
university students created
an autonomous sailboat
that could cross the Atlantic
ocean all by itself.

magpi.cc/sailbot

10 amazing gaming accessories magpi.cc 79


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 Databasing
with Raspberry Pi
Hone your database and SQL skills with
these handy resources. By Phil King

Introduction to Databases and SQL


Raspberry Pi Databases offer a more platform. It comprises video and final part of the course covers how
AUTHOR

Foundation sophisticated way of storing text tutorials, along with quizzes to modify an existing database,
data than spreadsheets, and practical exercises. and explores the relationships
Price:
Free enabling large amounts of it After introducing the concept of between tables and how they
to be arranged in a logically databases, you’ll progress to using can be joined.
magpi.cc/
rpfdatabases organised way. This offers the SQL (Structured
advantages of easy access, data Query Language) to
integrity, and security. retrieve, filter, and
Since databases are so useful modify the data in a
in a wide range of fields, database. Practical
learning about them is a key activities require
part of computer science. the use of either
Designed by the Raspberry sqliteonline.com
Pi Foundation, this excellent or the DB Browser
introductory course is available for SQLite tool
for free via the eDX learning (preferred). The

Web resources
Useful online resources to gather data
DATABASE SYSTEMS of SQL, guides you through
This 25-hour, two-part video creating a database, and includes
course from Cornell University is a useful examples.
great introduction, covering SQL, X w3schools.com/sql
storing/indexing data, transaction
processing, and more. SQLBOLT
X magpi.cc/cornelldb A series of 18 interactive lessons,
including exercises, to help you
SQL TUTORIAL learn SQL quickly in your browser.
This excellent W3Schools There are some extra topics, too.
resource details all the functions X sqlbolt.com

Learn Databasing with Raspberry Pi magpi.cc 81


RESOURCES

LibreOffice
Base Documentation
The Document As well as being free, open exploring how databases work,
AUTHOR

Foundation source, and available in aided by comprehensive official


Raspberry Pi OS, LibreOffice Base documentation that gives
Price:
Free – unlike many other office/ you a solid grounding. Planning Further
reading
productivity suites – comes and creating your first database
magpi.cc/lobasedoc
complete with its own relational is made easier with the helpful
database application, Base. While advice here. It then move on to
based on the HSQL Database the basics: creating tables and
Engine, it’s defining relationships between Books to learn more
compatible with them, forms and sub-forms for about databasing
files in common data entry, search queries for
database extracting specific information,
formats such as and reports for sharing. All of
Microsoft Access these can be created using the
and MySQL/ wizard or Design View. Finally,
MariaDB. it covers how data sources can
It’s a good be used with other LibreOffice
starting point for components.

High Performance MySQL,


4th Edition DATABASE DESIGN FOR
MERE MORTALS
Covering all the fundamentals in
Silvia Botros, MySQL is an RDBMS (relational strategies, query performance a software-independent way, this
AUTHOR

Jeremy Tinley database management system) optimization, replication, classic hands-on guide is a great
that employs the widely used backup/recovery, and scalability. way to learn database design.
Price:
£53 / $66 SQL programming language for The 4th Edition has been X magpi.cc/
interacting with data. It also updated to reflect recent advances ddmeremortals4e
magpi.cc/hpmysql
forms a part of the classic LAMP in cloud- and self-hosted MySQL,
stack for website design (Linux, InnoDB performance, and new
Apache, MySQL, PHP). features and tools. SQL ANTIPATTERNS
Aimed at readers who already Antipatterns are erroneous
have some familiarity with practices that result in poor
using relational databases, results. Aimed at experienced
this in-depth guide promises SQL users, this book shows
to take your skills to the next you how to fix them.
level to unleash MySQL’s full X magpi.cc/sqlantipatterns
power. Over 375 pages, it
explores advanced techniques
for optimising MySQL databases PRACTICAL SQL
for improved performance, Billed as a ‘beginner’s guide
and how to turn traditional to storytelling with data’, it
database management tasks into takes you through all the
automated processes. Topics fundamentals of SQL with
covered include schema design plenty of real-world examples.
and management, indexing X magpi.cc/practicalsql

82 magpi.cc Learn Databasing with Raspberry Pi


AN INTRODUCTION TO

& GUI
PROGRAMMING
All you need to know
to write simple
programs in C and
start creating GUIs
Inside:
■ Create simple command-line C programs
■ Control flow with conditions and loops
■ Handle variables, strings, and files
■ Design graphical user interface
applications in C
■ Handle user input with buttons and menus
■ Use advanced UI features such as data
stores and dialogs

£10 with FREE


worldwide delivery

Buy online: magpi.cc/cgui


INTERVIEW

John
Sheehan
The brains behind a California Raspberry Pi
meetup that’s been running for 11 years

> Name John Sheehan > Occupation Freelance software developer


> Community role Raspberry Jam organiser > URL dev.to/jennasys

E very month, without fail,


we put together the list
of upcoming events in
The MagPi’s community events
pages (see p92) and see that
What is your history with
being a maker?
As a kid, I was always taking
things apart to see how they
worked. Most of those things
in computer engineering.
I got back into electronics
during the start of the maker
movement when I first
learned about the Arduino.
there’s a Riverside Raspberry even got put back together. I also got heavily involved
Pi Meetup. It’s been going for Taking after my older brother, with a local makerspace for
over ten years now and is located I started tinkering with several years that expanded
in Riverside, a city/county not electronics when I was a teen. my interest in the process
too far from Los Angeles. Continuing to follow in my of making, learning the
“Someone else actually started brother’s footsteps, I ended up tools, and collaborating with
the group in 2013,” John Sheehan with an undergraduate degree other people.
tells us. He’s currently the
main organiser for the event,
which runs monthly. “At the
time, I had just started up my
own Python meetup group and
I was only one of a few dozen
members in the Raspberry Pi
group. The organiser of the
Raspberry Pi meetup that started
it ended up stepping down in
2014, and Meetup.com sent out
an email saying the group would
be shut down if no one else
stepped up as organiser. I clicked
on a link in the email to find out
more about it, and somehow was
greeted with a message saying
“Congratulations, you are the
new organiser!”. I’m really not
sure what happened there, as it
wasn’t my intent, but I just went
with it. It has now been over a
decade and I’m still here.”

84 magpi.cc John Sheehan


INTERVIEW

What is Riverside Raspberry regulars who have been working S Showing off the projects
and promoting the group
Pi Meetup? with or tinkering with embedded
at a Maker Faire
The meetup is an informal platforms for years. Ages range
monthly meetup for bringing from high schoolers to retirees.
W The event brings together
people together that are Most have at least a little bit people off all ages and
interested in electronics and of experience in some kind of backgrounds

embedded software development. programming, but not always.


But, despite the group name, The membership is pretty
it is not only for the Raspberry
Pi platform. It is as much of
diverse in terms of experience
and goals, but we are very
I want to share in their
a social group as it is a tech open to newcomers. excitement because I remember
group. I try to have formal tech
presentations every once in a What are some of your being there myself
while, but we more frequently favourite moments from
just have open discussions about the meetups?
what everyone is working on, the Really, any time someone Any future events planned?
problems they are facing with brings in a project to show off We meet on the second
their projects, or just sharing the that they have been working Monday of every month in
latest news about new maker on is my favourite part of Riverside, CA, US. We have
tech. I do encourage members belonging to the group. I don’t snacks. We also try to have
to contribute talks for the group even care if it is someone’s first a table at local events a
whenever they can. project where they just have a few times a year and have
blinking LED on a breadboard. I members show off their
What kind of attendees do want to hear about it and share projects, though that schedule
you get? in their excitement because I varies. We collaborated with
Many people who attend the remember being there myself. a few local school districts
meetup are mostly either new My reason for having the group several years ago to put
to the Raspberry Pi platform, or is to share what I know and to on a full Raspberry Pi Jam,
are just starting to learn about learn from others. I believe that and I’d like to do that again
electronics. But we also have inspiration is contagious. sometime as well.

John Sheehan 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
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. Remember to follow along
at the hashtag #MagPiMonday!

01. Two very cool tech YouTubers meeting at Open


Sauce, along with Bubo-2T, the tooting owl
02. A very cool glowing lamp – but does that
colour-scheme mean it’s a Creeper?
03. How big is the train that chuffs past that larger 03
shed, we wonder?
04. Check out diyelectromusic.com for more info
on this very cool MIDI board
05. Sometimes you build something so good you 04
have to make a second version

01

02 05

86 magpi.cc #MagPiMonday
THIS MONTH IN RASPBERRY PI

Events in pictures:
Raspberry Pi Day
2024 Cameroon
Community and official events in the wild

04

03
02

T his event in Cameroon was held in April.


Organisers Mbah Mattklaus and Loic Dessap,
brought several people together to show
off their Raspberry Pi projects, and to learn about
Raspberry Pi in general.
01

01. Some of the Raspberry Pi goodies available at


the event
02. A robot project shown off at the Raspberry Pi Day
2024 event
03. The event drew a fair few young people to learn
about Raspberry Pi
04. Giving a talk about their project using Raspberry Pi

Events in pictures magpi.cc 87


THIS MONTH IN RASPBERRY PI

More events in pictures:


Pi Day Raspberry Jam
Community and official events in the wild

01

A fter having to cancel due to snow on the


actual Pi Day (14 March), the Denver
Raspberry Jam folks were able to finally
hold their Pi Day celebration on 11 April. Held at
the Sam Gary Branch Library ideaLAB, the event
saw a huge number of cool Raspberry Pi kits and
projects on display for people to see and play with.
They even had pie for folks to eat – sounds like
our kind of occasion.
03

01. A few weeks late, however the Pi Day spirit of the


Raspberry Jam was maintained for the event
02. You can make a lot of cool add-ons for flight sims 02
using open source software and a Raspberry Pi
03. Free goodies and hand sanitiser, always the start
of a great event
04. People were soon gathering around the displays
and checking out the projects
05. Real pies were available for those that wished to
partake a slice
06. Setting up the tables ready for guests
07. This 3D-printed Barad-dûr from The Lord of the
Rings has a flaming Eye of Sauron powered by
Raspberry Pi
08. Try out Raspberry Pi projects with these dedicated
activity leaflets

88 magpi.cc More events in pictures


THIS MONTH IN RASPBERRY PI

05

04

FIND
OU T A
M ON BOU T
TH’S
EV EN N E X T
T S ON

PAGE
92

08
06

07

More Events
events in pictures magpi.cc 89
YOUR LETTERS

Your
Letters
T User MrDarSwag found a Raspberry
Raspberry Park Pi at the Jurassic World ride in
Universal Studios Hollywood

I was thinking about the many uses of waiting time displays malfunction and turn
Raspberry Pi and I was wondering – do you out to be driven by Raspberry Pi!
know of any rides in theme parks that use We have heard on the grapevine that they
Raspberry Pi? I’m sure some must, maybe do possibly use them at one of the more
they’re in that Star Wars Land somewhere. major, secretive theme park operators but
despite our best efforts we’ve never got
them to spill the beans on how Raspberry Pi
Beth via email powers their magic. Maybe because this would
unfortunately spoil that magic.
Unfortunately we’ve never had anyone tell or Perhaps we need to find an orange grove
admit to us that they’re using a Raspberry Pi and strongarm Eben into opening a Raspberry
in their theme park – although we have seen Pi amusement park there.

Future forecast
Hi, my dad gets tons of ads watching YouTube on his TV
and I want to learn how to use Pi-Hole to block them.

Matthew via email


X Pi-Hole is a great way
to keep malicious Pi-Hole is very simple to set up! We covered it in issue
ads off your network 104 of The MagPi (magpi.cc/104) with a full set-up
tutorial, and there’s plenty of info on pi-hole.net to
help you out as well.
It’s very easy to set up and only requires a spare
Raspberry Pi for you to do so.

90 magpi.cc Your Letters


USA SPECIAL!
6 ISSUES
FOR $43
Connectability
I read about the new Raspberry Pi Connect
service – will you be doing a tutorial on how
best to use it? I’m still not 100% sure how I’d
want to use it really.

Kit via Threads

It’s incredibly simple to set up so we’ve not


really done much around it yet! However, the
team recently added remote shell access and
are definitely taking in feedback for more features,
so we’ll sort out a tutorial on cool stuff you can
do with it soon!

FREE
RASPBERRY PI
S Raspberry Pi Connect is very cool and works on
even Raspberry Pi 1 computers!
PICO W

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

03

Community
Events Calendar
Find out what community-organised Raspberry Pi-themed
events are happening near you…

01. G
 etting Started with Raspberry Pi 5: 03. Riverside Raspberry Pi Meetup
Unlocking Its Potential Monday 12 August
Sunday 27 July 3600 Lime Street, Riverside, CA, USA
Light House Event Center, Ipaja, Nigeria magpi.cc/rrpm144
magpi.cc/vikirp5 The purpose of Riverside Raspberry is to share
This workshop is designed to introduce participants to the knowledge related to Raspberry Pi hardware in particular,
basics of Raspberry Pi 5 and explore its diverse capabilities. and to promote interest in tech development in the
Whether you’re new to Raspberry Pi or looking to enhance Inland Empire in general. The group is currently meeting
your skills, this event will provide hands-on experience and on the second Monday evening of every month.
practical knowledge.

FULL CALENDAR
Get a full list of upcoming
community events here:
magpi.cc/events
02. Melbourne Raspberry Pi Meetup 04. Tech Cornwall Explorers
Sunday 4 August Summer Sessions Redruth
Docklands Makerspace and Library, Melbourne, Australia Monday 12 August and Tuesday 13 August
magpi.cc/mrpm144 FibreHub, Redruth, UK
This meetup is open to everyone with an interest in magpi.cc/tcessr24
electronics, robotics, home automation, 3D printing, laser Two mornings of interactive learning: Three-hour sessions
cutting, amateur radio, high-altitude balloons, space tech, each morning, packed with engaging discussions and hands-
etc. Makers are invited to bring along their projects and on projects. From Basics to Build: start with setting up a
project ideas, and come connect with other makers. Get Raspberry Pi and progress to constructing your own simple
your questions answered, show off the work you are doing, rover. Focus on Teamwork: collaborate, share ideas, and
and get support to resolve nagging issues. build together in a student-led, inquiry-driven environment.

92 magpi.cc Community Events Calendar


EVENTS

04

01

02

MAKER FAIRE
HANNOVER
Maker Faire
Hannover
> Where Hannover Congress Centrum, Hannover, Germany
> When Saturday 17 August and Sunday 18 August

W e’re proud to partner with Raspberry


Pi Approved Reseller BerryBase to be at
Maker Faire Hannover for the second year
in a row. Come and meet members of the Raspberry Pi
team, learn about our latest products, and share what
you’ve made with Raspberry Pi technology.

magpi.cc/mfh24

Community Events Calendar magpi.cc 93


COMPETITION

WIN 1 OF 3
HOME ASSISTANT
YELLOW
We reviewed Home Assistant Yellow from the Home Assistant
folks in issue 141 and really liked how user-friendly and
powerful it was. We now have three Home Assistant Yellow Kits
(the version with power supply, without PoE) to give away!

Head here to enter: magpi.cc/win | Learn more: magpi.cc/hayellow

Terms & Conditions


Competition opens on 24 July 2024 and closes on 29 August 2024. 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 (X) or any other companies used to promote the service.

94 magpi.cc WIN Home Assistant Yellow


SUBSCRIPTION

200 PAGES OF RASPBERRY PI


QuickStart guide to setting up The very best projects built by
your Raspberry Pi computer your Raspberry Pi community

Updated with Raspberry Pi Pico Discover incredible kit and


and all the latest kit tutorials for your projects

Buy online: magpi.cc/store 95


SUBSCRIBE AND

SAVE UP
TO

35% on the cover price

ISSUE #81

OUT NOW
hsmag.cc
NEXT MONTH

EDITORIAL
Editor
Lucy Hattersley
[email protected]
Features Editor
Rob Zwetsloot
[email protected]
Sub Editor
Ian Evenden

ADVERTISING
Charlotte Milligan
[email protected]
+44 (0)7725 368887

DESIGN
Head of Design
Jack Willis
Designers
Sara Parodi, Natalie Turner
Illustrator
Sam Alder
Photographer
Brian O’Halloran

CONTRIBUTORS
Nate Contino, David Crookes,
PJ Evans, Rosemary Hattersley, Phil
King, Chris Lowder, Sean McManus,
David Plowman, Ashley Whittaker

PUBLISHING
Publishing Director
Brian Jepson
[email protected]
Director of Communications
Helen Lynn
CEO

Powerful Pico Projects Eben Upton

DISTRIBUTION
Seymour Distribution Ltd
Make the most of 2 East Poultry Ave,
London EC1A 9PT
Raspberry Pi’s microcontroller +44 (0)207 429 4000

SUBSCRIPTIONS
Unit 6 The Enterprise Centre
Kelvin Lane, Manor Royal,

The Magpi #145 Crawley, West Sussex, RH10 9PE


+44 (0)1293 312193
magpi.cc/subscribe
On sale 29 August [email protected]

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


from sustainable forests and the printer

Build a camera
operates an environmental management
MASTODON magpi.cc/mastodon system which has been assessed as
conforming to ISO 14001.
that writes poetry The MagPi magazine is published by
THREADS @themagpimag Raspberry Pi Ltd, 194 Cambridge Science

Play a virtual piano


Park, Milton Road, Cambridge, England, CB4
0AB. The publisher, editor, and contributors
accept no responsibility in respect of any
with smart gloves FACEBOOK magpi.cc/facebook omissions or errors relating to goods,
products, or services referred to or advertised
in the magazine. Except where otherwise

Check for damp EMAIL [email protected] noted, content in this magazine is licensed
under a Creative Commons

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

AI puppetry
On interesting uses for the new Raspberry Pi AI Kit, by Rob Zwetsloot

I’ve probably mentioned here or in able to load it into the popular tracking which you usually need
past tutorials that I am a streamer VRChat software, and at least give an iPhone to do? I need to start
when I’m not working on the the illusion that I am running experimenting and hacking I think.
magazine. I play games and build around with full-body tracking.
robot model kits on camera, which However, I recently did a very silly Mobile pose detection?
probably does not surprise anyone stream where I played a Sonic the I’ve also been dreaming up a mobile
who knows me. Hedgehog hoverboard game on the puppeteering system. I mean, it’s
Specifically, I stream as a VTuber. Xbox 360 using the Kinect. It was not often that I would need to walk
What this means is that I have an horrendous, but very funny as I was around with a cartoon version of
animated avatar which I puppet using a web app full-body tracker myself on my chest but it could be
with my face; it uses a mixture of with my 3D model. very funny! And maybe it could be
technologies such as face tracking, used for a silly costume where you
which is mapped to specific image
manipulation software to simulate a
T his has got me put a screen on your stomach and
pretend you’re being controlled by
living, breathing cartoon character. thinking – can a Krang from the old TMNT cartoon?
You also get VTubers who use a 3D I love it when Raspberry Pi
model that works similarly to mocap Raspberry Pi power releases new technology that I can
done for movies and video games. get to mess around with and possibly
I mainly stream with a 2D VTuber tracking? make with stuff with. I really should
cartoon model – one I rigged learn to polish up my projects though
myself, of course, defining how the Usually, full-body tracking so they’re a little more presentable.
different image layers move and requires motion sensors on specific Looking at you, NES controllers with
warp as I do – however I do have a body parts, however like the Kinect a Raspberry Pi Zero inside that I
3D model which can be controlled before it, modern software is able to hacked apart with a Dremel.
with my entire body. make out your body using machine
learning. Just like the new Raspberry Rob Zwetsloot
AUTHOR

Pose detection Pi AI Kit.


Streams online when he’s not Features
Normally I’m sitting at my PC, This has got me thinking – can a Editor of the magazine, but you very
so the full-body tracking is Raspberry Pi power VTuber tracking? likely have not seen his VTuber alter ego.
not something I use often. I’m Can it even do the detailed face magpi.cc

98 magpi.cc AI puppetry
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
Manage your
servers
servers or PCs
remotely!
remotely!

Remote control redefined

PiKVM V4 Mini
Small, cost-effective, and powerful!

Power consumption in idle mode: just 2.67 Watts!


Transfer your mouse and keyboard actions
Access to all configuration settings like UEFI/BIOS
Capture video signal up to 1920x1200@60 Hz
Take full control of a remote PC’s power

PiKVM V4 Plus
The most feature-rich edition

More connectivity
Extra storage via internal USB 3.0
Upgraded powering options
More physical security features
Extra HDMI output
Advanced cooling solution

A cost-effective solution for data-centers,


IT departments or remote machines!

Availableatatthe
Available themain
mainRaspberry
Raspberry Pi
Pi resellers
resellers

List of official
resellers by country:

You might also like