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

Hs 72 Digital

Uploaded by

vasilecelalat
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)
126 views100 pages

Hs 72 Digital

Uploaded by

vasilecelalat
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

hsmag.

cc November 2023 Issue #72

PROJECTS

Nov. 2023
Issue #72 £6
72›

514006
9 772515

BAR CODES ENERGY MONITOR HAXOPHONE


The easiest form of Save money on your heating Building an electronic
image recognition bill with a Raspberry Pi Pico wind instrument

3D PRINTING ARDUINO NEURAL NETWORKS


Free eBook!

Download your copy from


hsmag.cc/freecadbook
WELCOME EDITORIAL
Editor
Ben Everard
ben.everard@raspberrypi.com

Features Editor
Andrew Gregory
andrew.gregory@raspberrypi.com

Sub-Editors
David Higgs, Nicola King

DESIGN
Critical Media

Welcome to
and Raspberry Pi
criticalmedia.co.uk

Head of Design

HackSpace magazine Lee Allen


Designers
Sam Ribbits, Sara Parodi,
Jack Willis
Raspberry Pi 5 is here! Last month, we chatted to its creators
Photography
about what to expect, and this month, we’ve been putting it Brian O’Halloran

through its paces in a few different projects to find out where CONTRIBUTORS
it really excels. Marc de Vinck, Andrew Lewis,
Thomas Burns, Rob Miles
The Raspberry Pi team has done a great job of increasing
PUBLISHING
performance across the board. That means that most projects Publishing Director
will get a speed boost. If your project is running perfectly Brian Jepson
brian.jepson@raspberrypi.com
fine on its existing hardware, there’s obviously no need to Advertising
upgrade, but if you’re itching to add more things and want Charlie Milligan
charlotte.milligan@raspberrypi.com
them running faster (and let’s face it, we always want more
things running faster), there’s a good chance Raspberry Pi 5 DISTRIBUTION
Seymour Distribution Ltd
will have what you want. 2 East Poultry Ave,
London EC1A 9PT
+44 (0)207 429 4000

BEN EVERARD SUBSCRIPTIONS


Editor ben.everard@raspberrypi.com Unit 6, The Enterprise Centre,
Kelvin Lane, Manor Royal,
Crawley, West Sussex, RH10 9PE
Got a comment,
question, or thought To subscribe

34
about HackSpace 01293 312189
magazine? PAGE hsmag.cc/subscribe

get in touch at Subscription queries


hsmag.cc/hello FREE PICO W hackspace@subscriptionhelpline.co.uk

WHEN YOU
SUBSCRIBE
GET IN TOUCH
This magazine is printed on
hackspace@ paper sourced from sustainable
raspberrypi.com forests. The printer operates an
environmental management system
h
 ackspacemag which has been assessed as
conforming to ISO 14001.
h
 ackspacemag HackSpace magazine is published
by Raspberry Pi Ltd, Maurice Wilkes
Building, St. John’s Innovation
ONLINE Park, Cowley Road, Cambridge,
CB4 0DS The publisher, editor, and
hsmag.cc contributors accept no responsibility
in respect of any omissions or
errors relating to goods, products or
services referred to or advertised.
Except where otherwise noted,
content in this magazine is licensed
under a Creative Commons
Attribution-NonCommercial-
ShareAlike 3.0 Unported (CC BY-NC-
SA 3.0). ISSN: 2515-5148.

3
Contents 06

06 SPARK 23 LENS
06 Top Projects 24 Raspberry Pi Projects
Big or small, you build them all Put the new computer to use

18 Objet 3d’art 36 How I Made: Alexatron


A 3D-printed turntable for your tunes A beautiful mecanum-wheeled robotics project

20 Letters 44 Interview: Jeff Geerling


Our wireless headphones have disturbed some Progress, open source, automation, and more

Cover Feature Tutorial


Laser cutting

Raspberry Pi 64 Teach a K40 laser cutter to speak


proper G-code

Projects

24 36
4
CONTENTS

74
82
Tutorial
Linkages
Crowdfunding
InvenTABLE

70 Design and 3D-print mechanisms to turn


motion into different motion 96 CAD (Cardboard Aided Design) just
got even more professional

53 FORGE 81 FIELD TEST


54 SoM Synthio 82 Best of Breed
Make music on a Raspberry Pi Pico Extract data from black and white lines

58 Tutorial Pico 88 Review Prusa input shaper


Build a simple true-or-false game with a Pico The Prusa MK4 gets an upgrade

64 Tutorial Laser cutting 90 Review LibrePCB


Upgrade your K40 with LightBurn Design software for those who love to make PCBs

70 Tutorial 3D printing 94 Review Kaluma


Design and 3D-print mechanical linkages JavaScript for RP2040 devices

74 Tutorial Active power monitor 96 Crowdfunding InvenTABLE


Keep an eye on how much your heating costs A sharper, cleaner way to cut cardboard

Some of the tools and techniques shown in HackSpace 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. HackSpace Magazine is intended for an adult audience and some projects may be dangerous for children. Raspberry
Pi Ltd does not accept responsibility for any injuries, damage to equipment, or costs incurred from projects, tutorials or suggestions in HackSpace Magazine. Laws and regulations covering many of the topics in
HackSpace 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 HackSpace Magazine may go beyond. It is your responsibility to understand the manufacturer’s limits. HackSpace mag-
azine is published monthly by Raspberry Pi Ltd, Maurice Wilkes Building, St. John’s Innovation Park, Cowley Road, Cambridge, CB4 0DS, United Kingdom. Publishers Service Associates, 2406 Reach Road, Williamsport,
PA, 17701, is the mailing agent for copies distributed in the US and Canada. Application to mail at Periodicals prices is pending at Williamsport, PA. Postmaster please send address changes to HackSpace magazine
c/o Publishers Service Associates, 2406 Reach Road, Williamsport, PA, 17701.

5
Top Projects

REGULAR

Diablo robot
By DirectDriveTech hsmag.cc/Diablo

H
ere we have another one of the many robotics
projects to use ROS, the Robot Operating System,
running on a Raspberry Pi 4, and programmed
in Python. What makes this one special is that it
balances on two wheeled legs, can move at 2 m/s,
can carry up to 80kg, and can balance all by itself. It
can jump down a couple of stairs and land on its feet like a cat – it’s
a little unnerving, but it points the way to a future where delivery
robots won’t be scuppered by having to go up stairs.

Above
This makes our
attempts at
robotics seem
rather rudimentary

6
SPARK

7
Top Projects

REGULAR

Zvychai One
By mkdxdx hsmag.cc/Zvychai-One

I
nspired, in part, by Zack Freedman and his lovely Pi 400
cyber deck, and, in part, by the potential need for a post-
doomsday communication device, maker mkdxdx has
made this, the Zvychai One. It’s a cyber deck, comprising
an 8GB Raspberry Pi 4, a 5-inch Eyoyo TFT display, a backlit
keyboard, several LEDs, and a beautiful 3D-printed clamshell
case. It was the winner of the Hackaday cyber deck competition,
and will be just the thing in the event of apocalypse.

Right
Although this device
is called the Zvychai
One, it’s actually the
fourth iteration

8
SPARK

9
Top Projects

REGULAR

Hnefatafl set
By Leon Reboul hsmag.cc/Hnefatafl

T
afl, from the Anglo-Saxon word for table, is a term
that encompasses a variety of board games that
survive from the early medieval period of northern
Europe. There’s the Ard Rí variant, from what’s now
Scotland, Brandudh from Ireland, and, among others,
Hnefatafl, from Scandinavia. It’s a bit like chess, except
that the two players have different objectives: one player uses his
forces to try to capture the king, located at the centre of the board,
while the other player’s objective is to escape, by getting the king to
one of the corner squares. It’s chess, for Vikings.
This laser-cut Hnefatafl set, by Leon Reboul, uses laser-cut 3 mm
plywood rather than the carved bones of Lindisfarne’s monks, but it
does capture the Viking aesthetic with some gorgeous artwork by
Jonas Lau Markussen (jonaslaumarkussen.com). Now, if only we
knew how to play…

Right
The laser cutting
for this project was
done mostly at
Fablab Skanderborg,
Denmark

10
SPARK

11
Top Projects

REGULAR

Soft robot
By Yoav Matia et al hsmag.cc/Soft-robot

H
ydraulic actuators work the way they do because
the fluid under pressure performs uniformly: move
a piston 50% of the way along its length, and the
connected arm, leg, or whatever, will also move
50% of the way it’s built to.
This robot, built by researchers at Cornell
University’s College of Engineering, uses a different approach. By
using viscous fluid, which behaves unevenly, the team were able to
get the actuators in the robotic legs to move more smoothly. The
difference is akin to that between a jointed limb on a mammal and
the movement of a caterpillar or worm; the clever thing is that by
utilising the properties inherent in a viscous fluid, the hope is that
robots using these actuators will need less computing power to
perform quite complicated movements.

Right
This soft robot can
walk at a speed of
0.05 body lengths
per second, and can
also crouch

12
SPARK

13
Top Projects

REGULAR

Pico W Air
By DPHacks hsmag.cc/PicoAirQualityBoard

F
ree software and open hardware have enabled a
boom in citizen science. This is just the latest device
to add to our knowledge of the world around us.
This board comes with a Raspberry Pi Pico W, and
adds a Qwiic connector for I2C devices, breaks out a
few GPIO pins for 3.3 V, ADC, GND, and four more pins.
Most usefully though, is the built-in MQTT client and built-in HTML
server, so it can easily transmit the environmental data coming in.
It comes with a connection for a PMS5003 particulate matter
sensor, which you’ll have to buy separately, along with a power
source. Other than that, it’s a one-stop device.

Right
We love a nicely
labelled silkscreen

14
SPARK

15
Top Projects

REGULAR

Star Wars Speeder Bike


By James Bruton hsmag.cc/StarWarsSpeederBike

Y
ouTuber and inventor extraordinaire James
Bruton has been building a bike based on a
hoverboard. That’s all you need to know really – go
to the video right now and check it out. He’s taken
the electronics from the hoverboard, added a huge
number of 3D-printed parts, a stem and handlebar
from a bike, an Arduino Uno, some bearings and potentiometers,
and has created a mode of transport that doesn’t work – yet!
It’s fascinating to watch the journey of experimentation that
James is on, as he modifies one thing after the next to get a
working prototype. The hoverboard motors, for example, at first
struggled with the extra weight of all that plastic, so James just
put higher-voltage batteries in. Trial and error has seldom been
more entertaining.

Right
The bike uses
omissions wheels;
next time James
is going to try
mecanum wheels,
last seen in
HackSpace issue 71

16
SPARK

17
Objet 3d’art

REGULAR

Objet 3d’art
3D-printed artwork to bring more beauty into your life

T
he world of high-end audio is
baffling. There are a million
expensive options, with a million
ways of expensively buying the
wrong thing. There’s some
absolute rubbish on the market – we
shudder at the thought of a cheap steel
stylus, rather than a diamond one, going
anywhere near our original 12-inch copy of
Blue Monday – and, at the other end, you
can pay an arm and a leg to get the absolute
best out of your pristine recording of John
Cage’s 4’33”.
Because audio geeks love to experiment,
upgrade, and tinker with things, we’re
surprised we haven’t seen a 3D-printed
turntable like this before. Designed by
FilatoneInstruments, this turntable kit
includes a lightweight carbon fibre tone-arm;
built-in spirit levels, and stroboscope to
ensure perfect levelling; brass bushings; a
two-speed motor; and an Audio Technica
AT3600L Cartridge (that’s the bit that
converts vibrations into electrical signals).
Buy the kit from the Etsy store here:
hsmag.cc/FilaTone, and download the STL
files here: hsmag.cc/FilaTone3D.

18
SPARK

19
Letters

REGULAR

Letters ATTENTION
ALL MAKERS!
If you have something you’d
like to get off your chest (or
even throw a word of praise
in our direction), let us know at
hsmag.cc/hello

RP1
I was kind of sad when Raspberry Pi 4 launched. Don’t get me Ben Says: It is an excellent logo, and deserves to be used more
wrong, it’s a great computer, but it dropped the Raspberry widely. I’ve put in a suggestion that, for Raspberry Pi 6, they
Pi-embossed can on the Wi-Fi chips. I’m not sure why, but that arrange the components in the shape of the logo. It’s going to
just made me smile. While the Wi-Fi remains plain on the take some pretty serious engineering work, but I think it’s
Raspberry Pi 5, I do like that there’s a logo on one of the worth it.
components again – the RP1 chip. I’m sure there’s lots of clever
reasons for this chip, but it’s the logo that makes me smile.

George
Carlisle

20
SPARK

HEADPHONES
OK, we need to talk about those headphones. Prototyping is one thing, but those
are horrific. Personally, I’d not be keen on having that battery there as well.

Sam
Bath

Ben Says: Yeah, I probably took the quick-and-dirty prototyping mindset a bit
too far with those. That said, it did give me a valuable insight into what I want
from a pair of headphones.
To be honest, I still haven’t gotten over the loss of the headphone jack, but
then the headphone jack itself could cause issues when it got stuffed full of
fluff. I seem to have reached the point where I’m disappointed with both wired
and wireless headphones, and it’s just generally stressing me out a bit. Maybe
I’m just hard to please.

SUBLIMATION
I’ve really enjoyed your articles on
sublimation printing because I have
ideas in my head for snarky T-shirts,
mugs, and various paraphernalia that
have – up until now – been stuck in my
head. It’s time to unleash them now.
Brace yourselves for a torrent of snark,
and it’ll all be Andrew Lewis’s fault.

Helen
Coventry

Ben Says: Honestly, sublimation printing


is like magic. You print onto paper, then
bam! You’ve got a mug or a T-shirt. It’s
also one of those techniques that
impresses non-geeks. Custom mugs, and
suchlike, make great gifts.

21
LENS
HACK MAKE BUILD CREATE
Uncover the technology that’s powering the future

PG
PG
24
36
HOW I MADE:
ALEXATRON
A personal assistant with a
little bit more personality Raspberry Pi
PG

44
Projects
Put the new computer to use
INTERVIEW:
JEFF GEERLING
Youtuber, developer, open
source software advocate and
maker of clever things
Raspberry Pi Projects

FEATURE

Raspberry Pi
Projects
Put the new computer to use

24
LENS

T
he Raspberry Pi 5 will very shortly be
available to purchase (and if you’re a
subscriber, you can pre-order from a
guaranteed stock of Raspberry Pis, so
you’ll get one in the first batch. See
hsmag.cc/priorityboarding for details).
Its four cores are now the more powerful Arm
Cortex-A76, which gives more processing power per
clock cycle. The memory is now DDR4X, which gives
faster access. Almost every form of connectivity is
faster, and there are two new ways of connecting
hardware: a UART port and a PCI Express port.
This all adds up to a much more powerful and
capable machine. And, let’s be honest, we geeks can
be attracted to faster machines like moths to a flame.
However, this issue, we’re going to take a step back
and look at some projects that can really benefit from
the extra power this new board brings. Whether you’re
looking for a new desktop, building your own mini-
data centre, or attempting to create sentient digital life.
But first, let’s take a deeper look into exactly how the
new computer is faster than its processors.

25
Raspberry Pi Projects

FEATURE

Benchmarking
Getting to know the new computer

W
e’ve hammered the Raspberry
Pi 5 with benchmarks, testing out
just about every aspect of its
RUNNING YOUR OWN
performance, including 3D BENCHMARKS
rendering, encryption, machine You can compare the performance of Raspberry Pi 5
learning, and more. It should come as no surprise to your own computer by running our benchmarks and
that it’s faster than any previous Raspberry Pi, but comparing them. We used the Phoronix Test Suite to
by how much? hammer our computer in various different ways, and you
can use this tool on your own hardware. It’s available
Last month, we interviewed Eben Upton and
on Linux, macOS, and Windows. You can download it
James Adams from Raspberry Pi Ltd, and they told
from phoronix-test-suite.com.
us to expect a 2.5 × increase in speed. Computer
You can run either individual tests or suites of multiple
performance, however, isn’t a single thing.
tests one after the other. One problem we found was
Depending on your particular use, the bottleneck that many of the tests downloaded tens of gigabytes of
might be networking, disk access, CPU, or data so, unless you have a truly stupendous microSD
something else. We crunched a huge range of card, you’ll need to clear out the installed test after
different processes to find out just how Raspberry each run.
Pi 5 stacks up against Raspberry Pi 400.

CREATION OpenSCAD – Render:


Retro Car (sec)
As makers, handling graphics involves some of OpenSCAD – Render:
the most computationally intensive things that we Mini-ITX Case (sec)
do. We put this to the test with both 2D and 3D
OpenSCAD – Render: Projector
graphics using Inkscape and OpenSCAD. As you Mount Swivel (sec)
can see, both areas got a significant speed boost,
OpenSCAD – Render: Leonardo
with 3D graphics seeing a bigger improvement. Phone Case Slim (sec)
- Raspberry Pi 400
Inkscape – Operation: SVG
files to PNG (sec) - Raspberry Pi 5

0 50 100 150 200

MACHINE LEARNING TensorFlow Lite – Model:


SqueezeNet (μs)
AI and machine learning are starting to creep
into our lives in a huge number of ways. For TensorFlow Lite – Model:
Inception V4 (μs)
benchmarking, we used TensorFlow Lite to do
image recognition, partly because this is the TensorFlow Lite – Model:
most common form of AI we see in Raspberry Pi NASNet Mobile (μs)
projects, but also because it is (in machine learning TensorFlow Lite – Model:
terms at least), well-established and understood. MobileNet Float (μs)
Here, we saw a greater-than-average performance TensorFlow Lite – Model:
increase (3.9 ×). So, it’s a good sign that the MobileNet Quant (μs)
- Raspberry Pi 400
Raspberry Pi 5 could be a great choice for TensorFlow Lite – Model:
embedded AI. This means either running the same Inception ResNet V2 (μs) - Raspberry Pi 5
models faster (or at higher resolution), or running
more complex models. 0 50,000 100,000 150,000

26
LENS

SERVER SQLite – Threads /


Copies: 1 (sec)
Many people run Raspberry Pis as little servers,
either at home or for simple enterprise use. This 0 100 200 300
can take a lot of different forms, but we tried to
benchmark some of the more common uses.
BlogBench – Test: Read
Results were a bit varied, but generally in the
(Final Score)
2–3 × range.
0 200,000 400,000 600,000 800,000

BlogBench – Test: Write


(Final Score)

0 300 600 900

Perl Benchmarks – Test:


Pod2html (sec)

0 0.2 0.4 0.6

- Raspberry Pi 400
PHPBench – PHP
Benchmark Suite (Score) - Raspberry Pi 5

0 200,000 400,000 600,000

There’s faster storage, faster


connectivity, faster memory,
On any constrained device like a Raspberry Pi, and a faster processor
there will always be trade-offs. What we’ve seen
on Raspberry Pi 5 is a fairly broad improvement in
performance across the board.
There’s faster storage, faster connectivity, faster BOOKWORM
memory, and a faster processor. All of those have
kicked up in performance and the 2.5 × Alongside Raspberry Pi 5, there’s a new version
of Raspberry Pi OS, known as Bookworm. This is
performance improvement Eben Upton promised
based on Debian Linux, and the new version brings
us seems about right. That said, there are some in a whole host of improvements and bug fixes.
areas where there’s a significantly higher uptick in The most important for our benchmarking is the
performance, and that’s probably due to the upgrade to Python 3.11. This brings a fairly significant
increased processor cache and NEON. performance boost of around 60%.
It’s worth bearing in mind that this is likely the Obviously, this doesn’t just apply to Raspberry Pi 5,
slowest Raspberry Pi 5 will run. As we’ve seen so you can get a nice little speed-up for any Python
with previous models, future software scripts by grabbing the latest OS and flashing it to your
SD card.
improvements are likely to give
performance improvements.

27
Raspberry Pi Projects

FEATURE

Machine learning
A brain that can see

W
e’ve seen from the benchmarking Once you have a trained model, you can then
that Raspberry Pi 5 performs run it on new images and it will attempt to
particularly well in machine recognise things in them. It’s this process that we
learning using TensorFlow Lite. can run on a Raspberry Pi.
Well, machine learning is perhaps Models vary hugely in size and complexity.
a bit of a misnomer there because we didn’t test Some require specialist hardware with huge
the learning part (which is a complicated and amounts of memory to run, and some can run on
specialist task), but what to do once it has learned. tiny microcontrollers.
TensorFlow is a tool for running neural The most common tool for running these
networks. These are computer programs models on Raspberry Pi computers is TensorFlow
structured in a way inspired by the way human Lite. This can be used with a few different
(and other animal) brains work, with a group of programming languages, but the most common is
neurons that react differently to different stimuli. Python. There is a slight problem that, at the time
You don’t program these models, but train them of writing, the main Python package for
– this is the process of showing them a lot of TensorFlow Lite doesn’t support the version of
known input. In the case of image classification Python in the latest ‘Bookworm’ version of
models, this means showing them a lot of images, Raspberry Pi OS, but we can grab an early version
Below and also feeding in information about the that does.
You can download
contents. Each image adjusts the model slightly, This is available at hsmag.cc/TFLitePy.
pre-trained models
from TFHub.dev making it more accurate.
Specifically, the version we need is:

tflite_runtime_
nightly-2.14.0.dev20230612-cp311-cp311-
manylinux2014_aarch64.whl

Above
The MobileNet recognises many common objects, such as a banana

28
LENS

Left
Raspberry Pi 5 has
two ports that can be
configured as either
camera or display. You
can use TensorFlow Lite
with either of them

You can install this with:

sudo pip3 tflite_runtime_


The most common tool for running
nightly-2.14.0.dev20230612-cp311-cp311-
manylinux2014_aarch64.whl –break-system-packages these models on Raspberry Pi computers is
Once you have that installed, you can use TensorFlow Lite
TensorFlow Lite in your Python programs.
We tested this out with the example code from
the Raspberry Pi blog (hsmag.cc/tflite). This code out the technology. This car, created by
uses the Picamera2 library to bring in images from YouTube user Hungry Man, uses TensorFlow to
camera modules and feed them into a TensorFlow detect things like stop signs.
Lite model.
This worked, but didn’t handle autofocus on the • An AI weather station (hsmag.cc/airai).
Camera Module V3 very well. You can grab Kutluhan Akar trained a TensorFlow Lite model
updated code that continuously autofocuses from to try and predict air quality based on sensor
hsmag.cc/tflitewutofocus. This runs in exactly readings. In most TensorFlow projects,
the same way as the code from the blog (and Raspberry Pi is used to run the models, but in
you’ll need the data files from the repository for this project, Raspberry Pi is used to train a
it to run). project that then runs on an Arduino.

OVER TO YOU • Smart home AI camera (hsmag.cc/homeai).


We’re really excited to see what people do with There are many smart home integrations that
this. To whet your appetite, here are a few projects you can do based on image recognition: turn
built on earlier versions of Raspberry Pi that could on the heating when your car pulls into the
get a performance boost from the new version. drive, or add items to your shopping list when
your fruit bowl is empty, for example. This
• A self-driving car (hsmag.cc/aicar). While Home Assistant add-on helps you use
full-sized self-driving cars are slowly getting TensorFlow models to interact with your other
onto our roads, this one is just a model to test smart gadgets.

29
Raspberry Pi Projects

FEATURE

DIY computer
Create your own custom-built machine

W
ith more computing power than Before we look at the parts you need to build a
ever before, Raspberry Pi 5 computer, let’s think about why you want to. You
makes a great device for building can go to a shop and buy a computer, and there
your own computer with. are literally thousands to choose from. However,
Obviously, this can be as simple despite there being a huge number of models,
as putting it on your desk and plugging in a there really isn’t much choice. In reality, you can
keyboard, laptop, and monitor, but the adaptability get three different computers. You can get a big
of Raspberry Pi means that you can create box to sit on your desk, you can get a foldy one
something far more complex if you’d like. with a screen and keyboard attached, or you can
Way back in issue 24, we built an get a handheld rectangle with no keyboard. These
Below unconventional portable computer with a three come in a range of specifications with a few
It’s a bit bulky, Raspberry Pi 4. It’s now time to modernise it with software choices, but that’s basically it.
but solid, and
very hackable a brand new Raspberry Pi 5. Building your own lets you throw away this
tri-opoly and start with a blank slate. That’s exactly
what we did.
Our main requirements were that we lifted the
screen up to make it more ergonomic, that it
protected what it was carrying, and that there was
space for hacking. We used it as a main computer
for a while, but it did eventually end up in storage
under a bed.

It’s nice to have something


to give us a little connection to
the natural world

Now it’s time to give it a refresh. The first thing


we can say is that we’re really glad we made it out
of wood. This material is almost endlessly
hackable. We’ve pulled some bits out, added some
new ones in, and generally gave it a bit of a shuffle
around. We also really like the feel of wood. In a
world of plastic and aluminium, it’s nice to have
something to give us a little connection to the
natural world.
However you choose to build your computer,
there are a few things you’ll need.

30
LENS

Left
This power module gives
us 3 A at 5 (ish) volts

Below
We’re playing with
the options for 3D
stereoscopic photography
at the moment, but
haven’t settled on a
camera setup, so it’s just
taped together for now

POWER
Obviously, we need 5 V of power for the Raspberry
Pi. Ideally, we should be able to supply 5 A of
power, but we don’t really need this much and we
can get away with closer to 3 A. You’ll also need
power for whatever else you have on the board.
We need 12 V for a screen, so we’ve gone with a
12 V power supply and a switching regulator to
take this down to 5 V for the Raspberry Pi, which
we feed in via USB-C.

SCREENS
You can connect screens to either the
Camera / Display ports or the HDMI ports. The
Camera / Display ports allow slightly tidier wiring,
but there are fewer display options. Using HDMI,
you need cables with quite long connectors (and
the cables themselves tend to be quite long).
In our original build, we opted to go with HDMI KEYBOARD
connectors, though it is the least tidy part of the Our portable computer doesn’t have a keyboard or
build as we have coiled HDMI cables on show. For mouse attached. However, you just need to plug in
now, we’re going to stick with this option, though your own (or use a Bluetooth one that’s not
we will stay on the lookout for alternative options. plugged in). For the authentic Raspberry Pi
Originally, we had two screens, but we found experience, we’ve opted to use an official
we didn’t use the smaller of the two very much, so Raspberry Pi mouse and keyboard. They’re tough,
we’ve removed that to give us more space for reasonably priced, and look the part.
alternative hardware. This also removes some of You can combine these elements however you
the untidy HDMI cables. like to make a computer that suits you perfectly.

31
Raspberry Pi Projects

FEATURE

Home server
Build your own tiny data centre

A
s well as a faster processor, (such as the amount of data you can store), and
Raspberry Pi 5 can get data in and they are run by companies that may have policies
out a whole lot faster thanks to a you disagree with. Nextcloud lets you run a host
PCIe port, faster USB ports, and of popular cloud computing services on any
faster SD card access. This means hardware you like, including a Raspberry Pi. You
that, while the Ethernet port and Wi-Fi are still can edit your documents in a web browser, share
technically the same speed as before, you may well files, and much more. Because it’s running on your
find yourself with a speed boost when using the hardware, you’re in control.
new board.
There are loads of uses for a home server, but LIBREELEC
here are a few of our favourites: Remember when you could go out and buy
media? A DVD of your favourite film or TV series?
NEXTCLOUD Now it seems that there is only streaming services,
Cloud computing has come to mean a lot of with a motley collection of shows that are prone to
different things over the years. These days, it’s disappearing at the whims of licensing agencies.
Above commonly used to refer to user-focused apps that It doesn’t have to be like this. You can have the
Double-tap the power often run in a web browser for things like word benefits of owning media and the benefits of
button to shut down
gracefully. This lets processing, calendar, and file storage. streaming media with LibreELEC. This software
you safely power While the online clouds can be useful, they also lets you stream videos that you own to your TV or
down without a
keyboard attached have issues. There are often limitations on use other devices.

32
LENS

Above
HOME ASSISTANT While the networking
A smart home is a fancy term for having internet- PRIORITY BOARDING hardware remains the
same, the improvements
connected devices that can be controlled from a around it mean that
central location. This could be an intelligent Right now, the factory in Wales is churning out Raspberry you might get faster
Pi 5s as fast as possible. However, there’s almost networking speeds
lighting system, a heating system you can switch
certainly going to be a huge demand for these little
on before you get home, a security system, and computers and, by the time you read this, if you haven’t
much more. There are loads of options for these already got your order in, there’s going to be a long wait.
smart devices, from off-the-shelf appliances you However, we’ve secured enough Raspberry Pi 5s to
can get from your local electronics store to allow every subscriber to HackSpace magazine (and our
homemade builds. sister magazine, The MagPi) to buy a Raspberry Pi 5 at
The key part of a smart home is the central hub the recommended retail price. These will be available for
that brings it all together. This should be able to pre-order before launch, and are guaranteed be in stock
to ship at launch.
talk to the devices and also let you control them in
the way you want to. Not all hubs can talk to all If you’re an existing subscriber, just sit back and wait for
an email with the details. If you’d like to get this fantastic
devices, so getting the right hub is a critical part of
offer, subscribe at hsmag.cc/subscribe.
building the smart home system you need.
Six-month subscriptions start from just £30 / $43 / €43 for
Home Assistant runs on a Raspberry Pi, can talk
UK / USA / EU. You’ll get six magazines delivered to your
to a lot of different bits of hardware, and gives you door for less than the cover price, get a free Raspberry
powerful tools for controlling your home. There’s Pi Pico W, and get the exclusive chance to order a
an easy-to-use graphical interface, or you can dive Raspberry Pi 5 at launch without them selling out. See
in and write scripts to automate common bits of page 62 for more details.
hardware control.

33
SUBSCRIBE
TODAY FREE
Pico W
GET SIX for subscribers!

ISSUES
FOR JUST:
£30 UK / €43 EU / $43 USA & Canada
SUBSCRIPTION

GUARANTEED
RASPBERRY PI 5
AVAILABLE AT LAUNCH
for all subscribers

SUBSCRIBER BENEFITS:
>G
 et every issue of >B
 eat the crowds with
HackSpace magazine guaranteed Raspberry Pi 5
delivered to your door stock for subscribers
>E
 arly access to the >G
 et a free Raspberry Pi
PDF edition Pico W

hsmag.cc/subscribe
Subscribers will get a voucher giving them the chance to purchase one Raspberry Pi 5 from reserved stock at The Pi Hut (thepihut.com) for full retail price. Reserved stock means that these will be available even if they are out of stock for general purchase.
How I Made: Alexatron

FEATURE

HOW
I By Thomas Burns

MADE G
ive a man a standard home
assistant and he’ll ask it
the weather forecast, the
football results, and whether
the traffic’s likely to be bad
on the commute into work.
But give that home assistant a pair of
animatronic eyes and a CRT mouth, and
suddenly you’ve got a robotic person. Kind
of. That’s what Thomas Burns did with
his Alexatron. Thomas reckons it’s the
coolest thing he’s ever built, but don’t take
his word for it: watch his build video at
hsmag.cc/Alexatron, get excited about
building your own, and wonder why more

ALEXATRON
robots can’t be a little bit more human.

An Amazon Alexa with a little bit


more personality

36
LENS

Above
The Alexatron has
seen thing you
wouldn’t believe

HackSpace: What was the inspiration for There’s a ton of R&D going
the Alexatron? Why did you feel the need into creating human-like robots
to make an Alexa more human? these days: human voices,
human heads and faces, etc.
Thomas Burns: As a kid in the 1980s, I But I feel like the closer we
was enthralled with the vision of technology get to humanoid, the more it
that we often saw on TV and in the movies. disturbs people. What I want, and what I
I’m talking about Johnny 5 and R2-D2 and think many users want, is a creature much
K9. These guys weren’t just computers, more like a Muppet, or a pet. A harmless,
they were computer creatures. But today, curious creature with a bit of personality.
the most interactive tech in my house – an Something like the animated toys that greet
Amazon Alexa – doesn’t look anything like JF Sebastian when he comes home to his
that. It’s basically just a small black hockey apartment in the film Blade Runner. So,
puck. Alexa is great, but whenever I use it I the Alexatron project was basically a proof
find myself asking, what happened?! So the of concept for the kind of creatures I’m
goal here was to breathe some life into an focused on making these days.
Alexa to try and make it feel a bit more like
the kind of electronic companion I’d always HS Where did you source the screen?
dreamed of having in my home. Or even LEDs are everywhere nowadays, but
better, at the workbench! CRTs not so much.

37
How I Made: Alexatron

FEATURE

Above
Thomas broke out TB My goal was to inspire the user to of place where I want to search for parts. I
the power from the forget, even if only for a few seconds, love using forgotten analogue technology
Alexa to trigger the
CRT that they are talking with a computer. So in my builds, and several of Tbilisi’s
I needed a mechanism for visualising the markets are awash in Soviet tech, which
creature’s voice that didn’t appear digital. is perfect for my style. I hope that place
Using a waveform on a CRT has a much never changes!
more organic feel than an LCD, in part
because the waveform feels unique every HS You obviously know your way
time the creature speaks. There’s also the around a TV circuit board, and the guts of
nostalgia factor of a CRT, which helps elicit the Alexa. Are you an electrical engineer
an emotional connection from the user, by trade?
something I believe is critical
to achieve truly meaningful TB I discovered electronics relatively late

“I DISCOVERED human-computer interaction.


But, unfortunately, the CRT
in life, but when I finally did discover it,
it felt like the door opened to an entirely

ELECTRONICS
isn’t a viable option for future new creative universe. One of my first
iterations of this build due to projects was using parts from an old Soviet
its size, and also because the black-and-white CRT television to make

RELATIVELY LATE” high voltage required to run it


(around 8000 volts!) is a bit of
an adjustable DC power supply for my
workbench. It’s a bit clunky and not exactly
a safety concern. So now I’m what I would call ‘stable’, but that feeling
looking at ways to recreate a of turning it on after so much work and
unique waveform ‘mouth’ on seeing it come to life is truly indescribable.
an LCD or OLED screen. The trick is making I remember in those early months I would
this digital presentation feel more analogue. start tinkering at my workbench once the
The Samgori Market is one of Tbilisi’s kids went to bed, then get lost in the flow,
many gems, and a place that I visited and suddenly realise it was already 05:00 in
regularly for inspiration. On dark, rainy days the morning.
it can feel very much like a scene from a I’m 100% self-taught, and I’m very
science-fiction film, which is exactly the kind grateful that so much knowledge is available

38
LENS

Left
The animatronics
were inspired by
Will Cogley – check
out his Youtube
channel here: www.
youtube.com/c/
WillCogley

at our fingertips these days. There’s never


been a better time to be a maker!
they follow the user. I had to make a few
HS And the animatronics: is that your modifications to the code to make it work
own design, or are you standing on the for my project, but it’s really a wonderful bit
shoulders of giants? of kit.

TB Everything I’ve ever made was done HS Did anything go wrong while you
by standing on the shoulders of giants. were working on the Alexatron?
The animatronic eyes are an open-source
creation by the talented Will Cogley, who TB Are you kidding? Everything went
has a wonderful YouTube channel with some wrong! But that’s what prototyping looks
very impressive builds. I’m considering like: it’s an incredibly messy process. When
designing my own animatronics module for you’re trying to get to a proof of concept,
future builds, but for the Alexatron project it the best strategy is to move fast and break
offered a fast, simple way to get things up things. Here’s a few of the hundreds of
and running. problems I encountered along the way:

HS How did you handle the face tracking • My initial power supply wasn’t
to determine where the eyes are looking? powerful enough to smoothly
drive the servo motors, but more
TB I decided early in the development powerful supplies were too large for
phase that eye contact would be critical the chassis;
in reaching my goals for the project. So I
did a ton of research into how to achieve • After soldering wires to the Amazon
that. At one point, I had come to the Alexa’s daughterboard to monitor
discouraging conclusion that I’d need to voltage fluctuations, I discovered that
spend dozens of hours programming my the Alexa wouldn’t work correctly
own face-tracking algorithm on a Raspberry outside its case (due to a grounding
Pi. But then I stumbled onto the Person issue, I believe), which required
Sensor, a tiny face-tracking camera board a complete redesign of part of
made by a wonderful start-up called Useful the chassis;
Sensors. I paired the Person Sensor to an
Arduino microcontroller, and was able to • I built an entire part of the chassis
use it to drive the animatronic eyes so that structure around an Arduino Nano,

39
How I Made: Alexatron

FEATURE

only to discover that the voltages I


was using were destroying all the
Nanos I installed;

• I used heat to get the bubbles out


of the glossy resin on the irises
of the eyes, only to later discover use it, because in many ways it’s a much
that the heat had also warped the more pure interaction, unencumbered by
eyeball shape; a lifetime of working with technology. The
best feedback I’ve gotten to date has been
• During the final assembly push, I from parents talking about how their children
discovered the only microcontroller reacted to the build video!
remaining in my kit required a
different type of cable than I’d been HS Did you have to do anything special
Above
It’s watching us, using, so I had to drive all over Tbilisi, with the Alexa’s settings to make it quote
as well as listening on a Sunday when everything was Blade Runner to you, or has it learned
to us
closed, trying to find the right cable. that from your search history?

The list goes on and on and on! I had to TB The Alexa platform does offer some
constantly remind myself that if I wasn’t limited options for customisation. You can
encountering challenges along the way, I change the wake word (from a short list of
probably wasn’t reaching far enough. options), you can choose a voice from their
list, and you can also program answers to
HS Do you find yourself using it more/ specific questions. By the time I reached
interacting with it differently now that the final stages of the build, I already knew
it’s not a bog-standard Alexa? that the next iteration would use an LLM or
AI platform instead of the Amazon Alexa,
TB I’ve been using the finished build mostly so I wanted to see how it would respond in
as a research tool, observing how users more creative ways.
interact with it. And the most valuable Even though the Alexa is in many ways
data comes from watching how children very limited as a ‘brain’ for an interactive

Left
The Alexatron’s

“THERE IS ONE chassis is made


from tiers of clear
laser cut plastic

AREA WHERE
IT EXCELS”

40
LENS

build, there is one area where it excels: start over with ChatGPT? Well, no. Because Above
The component
response time. Alexa’s response time is fast if you constantly do that, you’ll never get the roughly where
enough so that conversations with it don’t project across the finish line. the robot’s nose
should be a camera
feel laboured. At the time of this writing, Version II of this build will be designed to with built-in
all of the speech-to-text and text-to-speech help move the project toward something facial recognition
processing, made
options available for AI and LLMs suffer that is smaller, lighter, more interactive, by Useful Sensors
from very high latency, where responses and more accessible to makers. I’m not
require as much as four to five seconds sure if it will be a kit that makers can use to
before being delivered. I’m sure this will assemble and customise their own versions,
change in the coming months, but for now or possibly even a dedicated product line
it’s a big hurdle for me in moving this project of toys, but I think there’s a lot of potential
to a different platform for interactivity. here for a production run. I’ve never done
a production run of anything before, so this
HS What’s next for version 2? is all new to me. Right now I’m still in the
early tinkering stage, where it’s just me
TB Moving it to an AI platform will be the and a lot of late nights in the workshop.
big change. But AI is changing so incredibly Looking forward, however, I’d like to be
fast these days: by the time I decide on able to build a small, interdisciplinary
a direction forward, some new tech will team to scale this project. I am often
inevitably come out that changes everything. reminded that the best innovation usually
ChatGPT, for example, was released just happens at the intersection of disciplines,
after I entered the production phase on the and I get goosebumps thinking about all
Alexatron build. Do I stop everything and the possibilities!

41
PLAY
& CODE
GAMES!
RETRO GAMING WITH

RASPBERRY PI 2 ND E D I T I O N
Retro Gaming with Raspberry Pi shows you how to set up a
Raspberry Pi to play classic games. Build your own games console or
full-size arcade cabinet, install emulation software and download classic
arcade games with our step-by-step guides. Want to make games?
Learn how to code your own with Python and Pygame Zero.

Set up Raspberry Pi for


retro gaming
Emulate classic
computers and consoles
Learn to code your
own retro-style games
Build a console,
handheld, and full-size
arcade machine

BUY ONLINE: magpi.cc/store


f
Jeff Geerling

f
INTERVIEW

e
J r
Ge
44
e
LENS

ing
HackSpace magazine meets…

l
Jeff Geerling

r
A man who makes things happen – it’s Jeff Geerling everyone!

e
I
f you want to cut through the
buzzwords and find out what tech
actually does, you could do a lot
worse than listen to Jeff Geerling.
He’s built an utterly wholesome
corner of the internet in which he
explains, demonstrates, and demystifies
the latest thing that everybody else
pretends to know about. Linux, single-
board computers, open source, developer
tools, home automation – Jeff does the
lot, and he wants to teach you how to do
it, too. We thought we’d talk to him about
what he’s been getting up to with his
new Raspberry Pi 5

45
f
Jeff Geerling

f
INTERVIEW

e
J r
HackSpace Morning Jeff! You’ve done a little better than a lot of people who are computers we were using turned that
loads of Pi projects over the last couple experts at it. into a multiple-hour fix.
of years. What do you still have running A year or two ago, I talked to [Linux
at the moment? YouTuber] NetworkChuck about recording HS Why Raspberry Pi? What’s so good
a podcast episode. He does a lot of stuff about it?
Jeff Geerling Things that are practical, with Raspberry Pis, too, with red hat
really. I have Pis running all of my home hacking and black hat stuff. And, you JG Raspberry Pi devotes a lot of time to
network stuff, all the home lab-type know, fun things. So we recorded the testing and to making sure
things; I have a Pi running internet podcast. And it never went up because manufacturing is better. And
monitoring, so I can keep my ISP honest. one of the microphones was messed up, manufacturing in the UK is a pretty cool
I have a Pi running my VPN. and it sounded terrible. I didn’t hear from thing. How many computer companies

e
I have no cloud services for my light him for a while, and then on 01 March this manufacture things in their home
bulbs, or for my HVAC or anything. It’s all year, he’s just like, ‘Hey, Jeff, do you want country – there’s not many, and
running through Pis. I don’t have any to work with me on a Mr. Beast project? At Raspberry Pi does on a huge scale. So
cloud account tie-in. If the internet goes like, 9 am, right now?’ I had no travel there’s a lot of those things that some
down here, the only thing is I can’t access planned and no deadlines, so I said yes. people don’t assign value to – not just

e
it remotely, but everything’s still running. And that was terrible, but also the bits and the little circuits on the
I love the privacy aspects of it. And I love awesome. So many people who make board and all that.
the ability to learn new things through it things, especially if you make it for Open source is another balance that
– industrial automations, and Raspberry Pi has to offer. There’s
controls, and APIs with these the Broadcom chip [which isn’t


different systems. open-source] versus you’re
Raspberry Pi

G
I think one of the things that building the operating system
fascinates me the most is all these devotes a lot of based on Debian, which is like
different IOT devices. Before I time to testing and one of the most open-source
knew much about Pis and Linux distributions. And it’s a
microcontrollers, I always thought
to making sure weird balance. In the hardware
IoT was magic. And then you open manufacturing world, it seems like there’s a lot
is better

one of these up, and you just see a less open source, because if you
little microcontroller inside. It put out an open-source design
might just be an ESP board, or a and someone else makes it, all of
Pico, or something else. But I a sudden you have zero revenue.
know that I could hack it, and that opens production use, want to make sure it Versus software, there’s sales and
up a new world. You could build one of actually works. So there’s a deadline support and services, and there’s a lot
those on your own to just about the same attached to it. There are problems; there more revenue opportunities that can’t
quality; you can’t get injection-moulded are always challenges, things you didn’t just be immediately consumed by
plastic, but everything else you can do on even think about. And that’s what another company. Although, recently
your own, and 3D printing has made it so happened on the Mr. Beast project. But we’ve seen Amazon doing that
that enclosures can be so much nicer. It’s that’s also kind of the addiction that sometimes, and leading to licences like
just cool to see. It’s like taking down the drives us forward. Because while I would the BSL, which is not really open-source.
wall of magic that you thought existed say I don’t want to ever do that again, I
between really cool products and your also say that was a fun experience. And HS I’ve heard of the BSD licence, but
own abilities. getting to meet all the people there. And not BSL.
The projects that I do are typically all of us going through that at the same
rehashes of what other people have time, solving all the challenges. It’s a JG Most open-source licences don’t care
done; I might make the documentation a weird kind of addiction that we have, I if you’re a government or a spy or a bad
little better or I might package it up a think, building software, building person or a good person – it’s free. It’s
little nicer. But really, I would say that hardware, and working on something so unencumbered. But the BSL imposes a
I’m beginner-level electronics and big as well. restriction: if you’re a big business, you
beginner-level microcontrollers. I just Any time we solved a problem with a can’t use it. Philosophically I can
have the ability to relate what I’m doing five-minute fix, the sheer number of understand that stance, but don’t call it

46
LENS

rling
e
Above
Jeff exploring the
Sony factory where
Raspberry Pis are
baked

Left
Jeff describes
himself as an
electronics
beginner;
something tells us
he’s being modest

47
f
Jeff Geerling

f
INTERVIEW

e
J r
Below
Testing hardware by
dropping a bowling
ball on to it. Always
wear eye protection!

Ge
48
e
LENS

ng
open source: call it ‘source available’ or, Again, it breaks down that barrier
you know, ‘maker friendly’. But on the flip between you and the magic. You pick up

i
side, there’s so many companies that an iPhone 15 and it can do depth
start as a maker, somebody who designs mapping with whatever that sensor is.

l
a little thing, that thing becomes popular, And you’re like, man, I’ll never be able to
and all of a sudden you’re a big business do that.
and your licence is void, just because you And then you get a Pi 5 with Wi-Fi and

r
hit a revenue number. And it doesn’t two cameras, and you’re like, oh, I can
matter if it’s 50 bucks or $5 billion, it’s a plug these open-source libraries
restriction and it’s a philosophical thing together. And we get this – it might not
that’s not compatible with my be as high resolution, and it might not be

e
understanding of the term ‘open source’. 60 frames per second, but you could do
I think Raspberry Pi offers a little bit depth mapping and 3D stuff with a little
of a different take on it. Early on, a lot of board, and everything’s under 200 bucks,
the hardware was super locked down all in, including power supplies and
and there weren’t datasheets. And one everything. That’s a big difference.
by one, they start making things better When I was a kid, you could go to
at release. So, you know, my hope is that RadioShack and buy an electronics
someday we could get more open hobbyist kit. And that’s how I learned
Above
firmware and stuff for the Broadcom the basics of resistors and all that. You Anyone can plug wires in; it takes skill to get
hardware working together
chips. I don’t know if that’ll ever happen. put them together with little spring
But it would be cool. Unlike many contacts, and it was really fun. And you
companies, where they start out open could make buzzers and radios and all any washing-machine controller.
source and then start closing things, kinds of stuff – they don’t really exist Whereas if you get Philips, you get the
Raspberry Pi has always gotten better, anymore. All those hobbies that were big Philips stuff and if you get Sony, you get
even if it’s not perfect. when I was a kid, a lot of them are the Sony stuff.
superseded just by how amazing the It’s like the tool world: I use DEWALT
HS Hopefully people will like the new technology we have today is. But the mostly, because the first tool I bought
power button. Raspberry Pi brings that back. was a DEWALT. So you gotta use the
DEWALT battery, and then you’re
JG For me, the power button on like, well, I could buy this cheaper


the Pi 5 is the most appreciated tool, it’s better. But then it won’t
new feature. It’s just so handy. For me, the work with my battery. So now I
Like, if I’m running a Raspberry Pi power button on have something like 25 DEWALT
headless, with no keyboard, I can the Pi 5 is the tools. I think that’s dumb. It’s
just do a quick shut down. I mean, ridiculous. And that’s how IoT
I put power buttons on GPIO
most appreciated people want to be: you have the
new feature. It’s just


before, but it’s cumbersome. This smart hub from this company,
is nice to have it on the board. so handy and you buy all their stuff. But
we’ve already seen companies
HS And have you looked into the fail, and then all of your smart
dual camera possibilities? stuff becomes dumb. And it’s
What’s funny is that the Raspberry Pi worse than dumb because you can’t even
JG So machine vision has gotten really is actually better at IoT stuff than most turn on a light bulb, you know – their
interesting in the past year, to the point IoT companies. Mostly because of the server goes down and your lights turn off.
where there are open-source tools to do open source philosophy. If we all work This is an area where instead of just
so many things that used to require tons together, all these individuals around the seeing behind the curtain how it’s
of expensive I/O. You can do stereo world can write plug-ins and do stuff done, you can do it better. That’s one
camera depth vision with all open- where you can put home assistant at thing that I love about the Raspberry Pi
source tools, and [I’m] hoping to use your house. And you can interact with ecosystem and the open-source
Google Coral TPU to do some of this stuff. any light bulb, any doorbell, any camera, ecosystem together.

49
f
Jeff Geerling

f
INTERVIEW

e
J r
HS A slightly less practical, though no I did my first Pi cluster in 2016. And I of that since the Pico came out. I’ve done
less awesome build of yours is the Pi had a cluster running from 2016 to 2020 some more projects: I built a garage door
cluster. Just one question: why? 24/7 at my house, and I think had sensor thing, and I’m working on some
something like two hours of downtime software for the Pimoroni Galactic
JG For me, it’s fun. You get something in that time period. Unicorn to write some stuff on the wall.
out of it when you’re doing all this work And now I have a new office that I’m
on a cluster. And the first time you see all HS You said that you’re not a hardware gonna go into. So there’s a lot of
the nodes come up together, that’s kind of guy. Does that mean that you have a opportunities to build stuff for that.
magic. And then also seeing the fact that, background in software?
like, you can actually program things to HS That’s a majestic piece of kit.
scale. It’s useful for a job, especially if JG I started off doing web design. The

e
you’re gonna build software for the web. first ever project I did was helping a JG Yeah. And they put in little things
It was a springboard for learning. And radio station. They just transitioned to like a button. You know, it’s nice to have
for a lot of us, we love that. We love computers instead of CDs for their music a button here – now you can do, like,
hacking with things, and a Pi cluster is playback, and in their system it had a modes for the display. And you can even
just a fun thing to do it. It also has the file that would write to with the current make a little game on the LEDs matrix.

e
side benefit of being able to develop song. My dad had the idea of taking this That’s the other thing that I love about
skills that might be incredibly the Pi ecosystem: Raspberry Pi
useful. There are still a lot of works directly with some of


companies that will pay good these companies to make things
money for Kubernetes developers, I did my first better for everyone. And these
and a lot of people have learned Pi cluster in 2016. companies work back with them.
And I had a cluster

G
Kubernetes on Raspberry Pi. The It’s a relationship that has been
shortage really built into that. built up over the course of the
And a lot of people started using
running from 2016 past decade. It’s bearing more
to 2020 24/7 at


small PCs that they got on eBay, fruit with the Pico, and I think
which is perfectly fine. I think my house the Pi 5 will drive some of that,
that’s awesome. The hard thing too. I’m really excited to see what
was, like, the reason the Pi was people come up with with HATs
great was because it’s a $35 for the Pi 5 with PCI Express. If
computer – now a $60 computer – data and putting the song name on the anybody comes out with a dual 2.5
but you can still get the Pi 4, and website, so people could be listening, go gigabit network cat, I’m gonna buy that
hopefully there’ll be more available now to the website, on their laptop, or in an thing the second I see it.
that Pi 5 has been announced. But it was office, back then people did not have
a quick way to get into that whole smartphones. It was ahead of its time. So
ecosystem of learning. And, you know, I built a little interface that had, like, a
it’s not necessary at all for a home lab. car radio with the song title in it in a
But it’s fun. little, I think it was in Courier font or
And it translated into me getting a something, because there were only ten
better job and doing consulting, which or so fonts that you could use back then.
also helped me with that opportunity that It worked for five or six years, until they
I got in the pandemic: I was consulting got a real website. But, that was my
and making extra money from doing all first-ever project.
the work I was doing on Pis, learning I learned electronics from my dad,
clustering, because the clustering skills who’s a radio engineer. And I, you know, I
got me a better-paying job. And it gave soldered together an FM radio. I still
me the opportunity to save up some have the voltmeter that I soldered
money over the next year. I went to together when I was, like, eight years old
full-time YouTube in 2021, so maybe the or something. It still works, and I keep
Pi cluster was the reason I got into it. using it, even though it’s not as accurate Above
Jeff’s fascinated by factories. And he loves open
as it could be. And I’m excited to do more source software and hardware

50
LENS

rling
e
Above
The Petabyte Pi: a
Raspberry Pi with
1024 terabytes of
storage

Right
Why build a
Raspberry Pi
cluster? Why not!

51
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


FORGE
HACK MAKE BUILD CREATE
Improve your skills, learn something new, or just have fun
tinkering – we hope you enjoy these hand-picked projects

PG

58
PICO QUIZ PG
53
Get interrogated by your
microcontroller

SCHOOL OF
MAKING
Start your journey to craftsmanship
with these essential skills

54 Synthio
PG

64
LIGHT BURN
Upgrade your laser cutter

PG PG

70 74
AUTOMATIC POWER
APPLAUSE MONITOR
Designing a linkage Make the most of cheap electricity
Making music on Pico

SCHOOL OF MAKING

Making music on Pico


Use CircuitPython to create complex sounds

M
ost microcontroller programming Before we dive into the code, let’s take a look
environments have a way of at the hardware. If you’re using a board without
making beeps, and even if there’s dedicated audio hardware (such as a Pico), you just
not an in-built method, it’s a need to connect a pair of headphones between one
pretty simple thing to do – just of the GPIO pins and ground. The easiest way to do
flick a pin on and off quickly (but this is to clip crocodile clips onto the headphone jack.
Ben Everard not too quickly) and you have an audio signal You can probably get away without adding a
that you can send to a speaker, headphones, or resistor in there as well, but it’s a bit safer to put
Ben’s house is slowly other audio devices. a 220 Ω resistor between the GPIO pin and the
being taken over by 3D
printers. He plans to
CircuitPython, however, has just gained a complex headphones. This stops the current from getting too
solve this by printing an audio synthesis module called synthio. This lets you high (especially if you are using crocodile clips that
extension, once he gets not just create beeps and boops, but control these can accidentally touch).
enough printers.
sounds in a variety of ways. Let’s take a look. Ideally, you should have a capacitor between the
You’ll need a board that supports synthio. RP2040 GPIO pin and ground. This is because the signal
boards, such as Pico and Pico W, are a great option coming from the GPIO pin isn’t an audio signal, but
for testing things out and having a play using a high-frequency PWM signal that, when averaged
headphones; however, a board with dedicated audio out, becomes the audio signal. The capacitor creates
hardware (such as the Adafruit RP2040 Prop-Maker) a low-pass filter that does this averaging out. We
will make it easier to connect a speaker. find that this isn’t generally necessary because the
rest of the circuit tends to act as a low-pass filter, so
it works fine without it.
We used GPIO0, but you can adjust this to any
you want.
Let’s take a look at a really simple example:

import time
import board
import digitalio
import synthio
import audiopwmio
import audiomixer

audio = audiopwmio.PWMAudioOut(board.GP0)
mixer = audiomixer.Mixer(channel_count=1, sample_
rate=22050, buffer_size=2048)
Above
You can use a jack synth = synthio.Synthesizer(sample_rate=22050)
socket if you want,
but crocodile clips are
great for prototyping audio.play(mixer)

54
FORGE

Left
You can get away
without a resistor,
but it’s a bit safer
to add one in line
with the GPIO pin

mixer.voice[0].play(synth) import time


mixer.voice[0].level = 0.1 import board
import digitalio
while True: import synthio
synth.press(65) import audiopwmio
time.sleep(0.5) import audiomixer
synth.release(65)
time.sleep(1) audio = audiopwmio.PWMAudioOut(board.GP0)
mixer = audiomixer.Mixer(channel_count=1, sample_
Here, we use three objects. There’s a PWMAudioOut rate=22050, buffer_size=2048)
which handles the output. There are other output synth = synthio.Synthesizer(sample_rate=22050)
options if you have additional hardware, for example, audio.play(mixer)
if you want to use an I2S DAC. There’s a mixer. mixer.voice[0].play(synth)
Technically, we could get away without this, in which mixer.voice[0].level = 0.1
case, the audio would play at full volume, but this can
be a bit loud on headphones, so we prefer to always amp_env = synthio.Envelope(
use a mixer to enable us to keep control over how attack_time=0.05,
loud we go. In future examples, you’ll also see how a sustain_
mixer can be used to combine sounds. Finally, there’s level=0.2,
a synth which is used to generate the sound. release_time=0.5
In this case, we just loop through, pressing and )
releasing note 65. The notes are given numbers in the
MIDI system, and 65 is F#. while True:
When we press it, it goes on full; when we release synth.envelope = amp_env
it, it goes off instantly. This is OK, but it sounds a synth.press(46)
bit harsh. Wouldn’t it be better if we could fade the time.sleep(1.25)
sound in and out? Synthio has a solution to this – it’s synth.release(46)
called envelopes: time.sleep(1.25)

55
Making music on Pico

SCHOOL OF MAKING

attack_time=0.05,
sustain_level=0.3,
release_time=0.3
)

amp_env2 = synthio.Envelope(
attack_time=0.05,
sustain_level=0.5,
release_time=0.5
)

beat = 0
synth1.envelope = amp_env
while True:
if beat % 2 == 0:
synth1.press(60)
if beat % 2 == 1:
synth1.release(60)
if beat % 4 == 0:
Envelopes are a way of controlling the volume over synth2.press(46)
Above
There’s an example time using the parameters: attack_time, attack_level, if beat % 4 == 2:
guitar created by sustain_time, sustain_level, release_time, decay_time. synth2.release(46)
the Ruiz Brothers
at hsmag.cc/ At first, the volume will ramp up to attack_level time.sleep(1)
synthioguitar
over the period of attack_time. Then it will drop down beat += 1
to sustain_level volume over decay_time. It will then
stay at the same volume for sustain_time, and finally We can’t use a simple repeating loop here because
drop down to zero volume over decay_time. All times that wouldn’t let us play notes at different rates, so
are in seconds, and volumes are between 0 and 1. we’ve created a beat loop, then we can detect which
Now we can play notes that sound a bit more beats we want to start and stop different notes at.
natural, let’s take a look at combining them. The
following code uses two synth objects to play notes ON ANOTHER NOTE
at different times: So far, we’ve set the volume structure of the note,
but we’ve still been playing the same sound – a
import time square wave beep. We can create far more complex
import board


import digitalio
import synthio
Now we can play notes
import audiopwmio
import audiomixer that sound a bit more
natural, let’s take a look at


audio = audiopwmio.PWMAudioOut(board.GP0)
mixer = audiomixer.Mixer(channel_count=1, sample_ combining them
rate=22050, buffer_size=2048)
synth1 = synthio.Synthesizer(sample_rate=22050)
synth2 = synthio.Synthesizer(sample_rate=22050) sounds than this. Synthio uses a wavetable function
to create the audio signal. This basically means that
audio.play(mixer) you can create an array of volumes that define the
mixer.voice[0].play(synth1) shape of the audio signal for a note. This could go
mixer.voice[0].level = 0.1 abruptly from 0 to 1 as in a square way; it could go
mixer.voice[1].play(synth2) up linearly like a triangular wave; it could have a
mixer.voice[1].level = 0.05 curve like a sine wave, or just about anything else.
Each wave shape produces a very different sound.
amp_env = synthio.Envelope( import time

56
FORGE

import board
import digitalio
import synthio
import audiopwmio
import audiomixer
import ulab.numpy as np

audio = audiopwmio.PWMAudioOut(board.GP0)
mixer = audiomixer.Mixer(channel_count=1, sample_
rate=22050, buffer_size=2048)
synth1 = synthio.Synthesizer(sample_rate=22050)
synth2 = synthio.Synthesizer(sample_rate=22050)

audio.play(mixer)
mixer.voice[0].play(synth1)
mixer.voice[0].level = 0.2
mixer.voice[1].play(synth2)
mixer.voice[1].level = 0.05 if beat % 4 == 0:
Above
synth2.press(46) How far do you want
amp_env = synthio.Envelope( if beat % 4 == 2: to disappear down the
synth rabbit hole?
attack_time=0.05, synth2.release(46)
attack_level = 1, time.sleep(1)
decay_time = 0.1, beat += 1
sustain_level=0.3,
release_time=0.3 We’ve only really scratched the surface of what
) you can do with synthio here. It’s a hugely powerful
system for creating music using microcontrollers.
amp_env2 = synthio.Envelope( There’s a more in-depth introduction online at
attack_time=0.05, hsmag.cc/synthiofundamentals.
attack_level = 1,
decay_time = 0.1,
sustain_level=0.1,
release_time=0.1
SYNTH TERMINOLOGY
) Synthio uses similar terminology to many other
synthesizers. You’ll come across envelopes and mixers
SAMPLE_SIZE = 512 similar to those we’ve used in this article in many
SAMPLE_VOLUME = 32000 # 0-32767 other bits of software and hardware. Here are a few
half_period = SAMPLE_SIZE // 2 other things that synthio provides that you will also
find elsewhere:
wave_sine = np.array(np.sin(np.linspace(0, 2*np.
• Low-frequency oscillator (usually known as an LFO)
pi, SAMPLE_SIZE, endpoint=False)) * SAMPLE_VOLUME,
is a special type of oscillator that unsurprisingly
dtype=np.int16)
runs slowly, or at least slower than typical audio
frequencies. The purpose of this isn’t to generate
note1 = synthio.Note(synthio.midi_to_hz(60), audio sounds directly but to influence other audio.
waveform=wave_sine, amplitude=1) For example, you can use it to bend a note in a
vibrato-like effect.
beat = 0 • Filters block some audio signals while allowing
synth1.envelope = amp_env others to pass through. The type of filter defines
while True: what frequencies are allowed to pass through.
Synthio Synthesizer objects have the following
if beat % 2 == 0:
methods to create filters: high_pass_filter,
synth1.press(note1) low_pass_filter, and band_pass_filter. Once they
if beat % 2 == 1: are created, they can be attached to notes or
synth1.release(note1) synthesizer objects.

57
Make a Pico LCD true or false quiz game

TUTORIAL

Make a Pico
LCD true or
false quiz game
An LCD display can display messages from Raspberry Pi Pico.
In this project, the display is used as part of a quiz game

I
Designed for 5 V
Stewart
n this tutorial, we will create an interactive
02
MAKER

true or false quiz game using a Raspberry The port expanders are available on a PCB
Watkiss
Pi Pico and an LCD display. Whilst doing backpack pre-soldered onto the back of the LCD
Also known as so, you will learn about some of the pitfalls PCB. This saves you from having to create your
Penguin Tutor. when connecting to devices running at different own circuit, but it does come with an issue. These
Maker and YouTuber voltages. You’ll discover ways to increase voltage circuits are normally designed for 5 V, whereas a
that loves all things
Raspberry Pi and output using a simple buffer, and how to make Pico uses 3.3 V for the GPIO ports.
Pico. Author of a bidirectional level shifter. The level shifter is Connecting a 5 V signal to a Pico GPIO port
Learn Electronics then used to convert between 3.3 V for the GPIO could cause permanent damage to the latter, so
with Raspberry Pi.
ports on a Pico to 5 V used by the LCD display. this tutorial looks at some of the possible solutions
penguintutor.com The game is programmed in Python, with a text to interfacing between devices designed for
twitter.com/
stewartwatkiss file for the questions. The game can be installed different voltages.
inside an enclosure for a complete game.

Move pull-up to 3.3 V


LCD character display 03
You’ll Need 01 This project is based around an LCD
If the 5 V device did not have a pull-up
resistor, the I2C bus could work with pull-ups to
display. Our display has 16 characters across two the 3.3 V supply instead. This is shown in Figure 2.
> LCD display with lines and is often referenced as a ‘1602’. These The crossed-out resistors are the pull-ups inside
PCF8574T
usually contain an HD44780, or equivalent, driver the LCD I2C backpack and the two pull-up resistors
magpi.cc/
ihaospacelcd chip that displays the appropriate pixels that on the left are connected to the 3.3 V output on a
make up the characters. Pico. Unfortunately, this involves de-soldering
> I2C safe level-
One downside of the display is that the driver surface-mount devices, which can be difficult.
converter
magpi.cc/BSS138 chip needs at least six data connections. This uses
up GPIO ports, as well as needing lots of wires to
> 3 × 16 mm button
the LCD display. A common solution is to have a
switches
Unidirectional level shifter
magpi.cc/
16mmbutton
‘backpack’ fitted to the rear of the LCD display
using a port expander. The example used here is a
04 A simple form of level shifter can be
PCF8574T 8-bit port expander. used when controlling 5 V devices from a 3.3 V

58
FORGE

microcontroller or computer. This is often used for The LCD display has an I2C
controlling NeoPixels from a Pico or a Raspberry backpack which reduces
Pi. In its simplest form, this is a MOSFET with two the number of wires needed
resistors (as shown in Figure 3, overleaf). The gate
resistor RG (typically 470 Ω) reduces the in-rush
current, and RL is a pull-up resistor (typically
2.2 kΩ to 10k Ω). With no input, the pull-up
resistor sets the output high. When a 3.3 V input is
provided, the MOSFET turns on pulling the output
low. This results in an inverted signal.
The code can be configured to invert the output,
or you could add an additional MOSFET to invert it A voltage level shifter converts
Figure 1: Wiring
a second time. A two-stage, non-inverting buffer between 3.3 V for the Pico and 5 V diagram for
for the LCD display Raspberry Pi Pico,
is shown in Figure 4. voltage level shifter,
and LCD display

Bidirectional level shifter LCD circuit


05 The LCD is controlled from your Pico, so
07 The level shifter can be inserted onto the
you may expect the signal would only need to go breadboard and connected between your Pico and
in one direction. However, due to the use of I2C LCD display. Then it’s just a case of adding three
protocol, signals need to pass in both directions. buttons for Start, True, and False. These are shown
We need a bidirectional level shifter. These can in Figure 1.
be made using individual MOSFETS, but using a The top power rail is used for 3.3 V taken from
premade level shifter from Adafruit or SparkFun your Pico’s 3.3 V output, and the bottom power
is more convenient. An example is the Adafruit rail is 5 V taken from the VBUS supply from the
bidirectional level shifter, which has four level USB port.
shifters on a convenient PCB. This is shown The buttons used are 16 mm push-to-make
in Figure 5. switches, similar to arcade buttons, but smaller.
The level shifter has just one MOSFET for each You can use other push-to-make switches if
channel. This is in an unusual configuration. The you prefer.
circuit can be thought of as two sides, with the
left side being for the low voltage and the right
for the higher voltage. The MOSFET joins the two
Download the LCD library
together. The schematic diagram is shown
in Figure 6.
08 The libraries that support the LCD
display with backpack are available from
GitHub (magpi.cc/rpipicoi2clcd). Upload the files

How the level shifter works


06 If both the low-voltage and high-voltage
signals are high, then the MOSFET is off and the
signal is high at both sides. If the low-voltage
signal (left) drops low, then the MOSFET is in the
forward direction and the voltage at the gate will
turn the MOSFET on. This will provide a path to
ground and so the high-voltage signal (right) will
be pulled low. If the high-voltage signal (right)
goes low, due to an internal characteristic of the
MOSFET a small current is able to flow in the
reverse direction. As this happens, the voltage of Figure 2: The I2C
bus needs pull-up
the source pin dips, causing the MOSFET to turn resistors. Having
5 V pull-ups could
on. This pulls the voltage down on the low-voltage
damage a Pico
signal as well. designed for 3.3 V

59
Make a Pico LCD true or false quiz game

TUTORIAL

Figure 3: A simple
MOSFET level shifter.
The output is the
opposite of the input
but higher voltage Figure 4: A second MOSFET can be
used to create a non-inverting buffer

lcd_api.py and pico_i2c_lcd.py to your Pico. You


true_button and false_button to see if either
can see a demo using pico_i2c_lcd_test.py. This
is pressed. It keeps track of the score and then
can be useful for checking your wiring is correct,
displays the score at the end, pausing for five
but you will need to change the pins used for SDA
seconds before restarting the game.
(GPIO 16) and SCL (GPIO 17).

THE MAGPI
Coding the game The quiz file
09 The game code (quizgame.py, overleaf).
11 The questions are stored in the file
starts by setting up the three button objects, along quizfile.txt. This has one line per question.
with i2c and lcd. It then reads the file quizfile.txt, Each line should have three entries separated
which contains the questions.
Then it enters a loop which ensures that the
game can be played over again.
T he code to create the
Within the first few lines of the loop, you can
see that it first clears the display, puts a string
game is included
This tutorial which starts on the top line, moves to the start of
is from in The
the second line, and then puts another string to by a semicolon. The first entry is the top line to
MagPi, the official
Raspberry Pi that line. display, the second is the second line, and the
magazine. Each final entry is a letter T or F to indicate whether the
issue includes a correct answer is True or False.
huge variety of The file is opened using the with statement.
projects, tutorials, Handling button presses
tips and tricks to 10 The button presses are handled by having
Using with means that the file will be
automatically closed after the program has
help you get the
a while loop which runs until an appropriate finished reading in the entries. The readlines
most out of your
Raspberry Pi. button is pressed. In the case of the Start button, method is used to read all the entries into a list.
Find out more at it just looks for that one button, but when waiting To separate the text to display from the
magpi.cc for a true and false, it needs to check both the answers, the split method is used. You may
notice that it also uses the strip method to
ignore any whitespaces, such as spaces before the
newline character.
The quiz file is created separately and must be
uploaded to Pico.

Improving the game


Figure 5: A
bidirectional level 12 The game can be placed in an enclosure
shifter is available on
small PCBs. These to make a complete game. You could start with a
can have headers standard enclosure and cut holes for the display
fitted to be used on
a breadboard and buttons, or if you have a 3D printer you can

60
FORGE

Figure 6: The download an example from the Penguin Tutor


bidirectional level
shifter uses two website (magpi.cc/trueorfalse). One improvement
MOSFETs. This works would be to add some error checking. Without
well for signals with
pull-up resistors error checking, if there is an invalid entry in the
like I2C quiz file, the program may crash.
Another possible improvement would be to
Figure 7: The game can be placed inside an enclosure.
provide a way to add multiple quizzes rather than
If you don’t have a 3D printer, you can use a generic
just limiting them to a single quiz. case and cut appropriate holes

quizgame.py DOWNLOAD
THE FULL CODE:
> Language: MicroPython magpi.cc/picolcdquiz

001. import utime 029. while True:


002. from machine import Pin, I2C 030. if (start_button.value() == 0):
003. from lcd_api import LcdApi 031. break
004. from pico_i2c_lcd import I2cLcd 032. # Quiz start
005. 033. score = 0
006. I2C_ADDR = 0x27 034. for question in questions:
007. I2C_NUM_ROWS = 4 035. lcd.clear()
008. I2C_NUM_COLS = 16 036. # strip off any whitespace
009. 037. # then split the entries into line1, 2 and
010. start_button = Pin(20, Pin.IN, Pin.PULL_UP) answer
011. true_button = Pin(19, Pin.IN, Pin.PULL_UP) 038. (text, text2, answer) =
012. false_button = Pin(18, Pin.IN, Pin.PULL_UP) question.strip().split(";", 3)
013. 039. lcd.putstr(text)
014. i2c = I2C(0, sda=machine.Pin(16), 040. lcd.move_to(0,1)
scl=machine.Pin(17), freq=400000) 041. lcd.putstr(text2)
015. lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, 042. while True:
I2C_NUM_COLS) 043. if (true_button.value() == 0):
016. 044. if (answer == "T"):
017. lcd.hide_cursor() 045. score += 1
018. 046. break
019. # Read questions into a list 047. if (false_button.value() == 0):
020. with open("quizfile.txt", 'r') as file: 048. if (answer == "F"):
021. questions = file.readlines() 049. score += 1
022. 050. break
023. while True: 051. lcd.clear()
024. lcd.clear() 052. lcd.putstr("Game over")
025. lcd.putstr("True or False") 053. lcd.move_to(0,1)
026. lcd.move_to(0,1) 054. lcd.putstr("Score {} of {}".format(
027. lcd.putstr("Press Start ...") score, len(questions)))
028. 055. utime.sleep(5)

61
RASPBERRY PI 5
Priority Boarding
We’ve reserved Raspberry Pi 5 boards
for HackSpace magazine subscribers

GET YOUR How it works!


If you have a print subscription to

RASPBERRY PI 5 HackSpace magazine or The MagPi, we will


have your email on file. We’ll send each of
our subscribers a unique code in the next
few days. Along with the code, you’ll get
details of how to use it through our partners
Want to get Raspberry Pi 5 sent to you (Pi Shop in USA and Canada and the Pi Hut
as soon as it’s released? With Priority everywhere else).
Boarding, you can pre-order your
Raspberry Pi 5 (4GB or 8GB) and it’ll be
sent out in the first week. Get started
New subscribers to HackSpace mag will get
Raspberry Pi has set aside thousands
a code when they sign up. So don’t delay;
of Raspberry Pi 5 computers for The
take out a subscription today (hsmag.
MagPi and HackSpace magazine print
cc/subscribe). You’ll be able to buy your
subscribers to buy. Enough to guarantee Raspberry Pi 5 first and get a magazine
every subscriber can get one without packed full of incredible maker tutorials,
going out of stock. projects, and reviews.
Find out more at

hsmag.cc/priorityboarding
Terms & Conditions Priority Boarding codes will be emailed to everybody with a print subscription to The MagPi or HackSpace magazine. People who subscribe to both magazines (print only) will receive two codes. Priority boarding does not apply to people
with App Store, Google Play, ZINIO, PDF contributions, or other paid-for subscriptions. Each code will entitle you to purchase 1 × Raspberry Pi 5 model (4GB or 8GB) for the standard retail price and delivery. Multiple codes need to be used individually. This is
a limited offer and is subject to change or withdrawal at any time.
Controlling the K40 laser cutter with LightBurn

TUTORIAL

Controlling the
K40 laser cutter
with LightBurn
Make the K40 speak GRBL

O
ne of the biggest complaints that
people have with the K40 laser
STAY SAFE
cutter is that it doesn’t speak
A laser cutter is a dangerous machine, and a partially
proper G-code. It speaks a sort of disassembled laser cutter is doubly so. Unplug the
proprietary language that isn’t really machine from the mains before you open the controller
compatible with anything except for enclosure, and then proceed under the assumption
Dr Andrew Lewis the software it ships with. A couple of open-source that the machine is actively trying to kill you. You can
packages like K40 Whisperer have managed to never be completely certain that the machine is dead.
Dr Andrew Lewis is a Capacitors hold power for a long time after a machine
specialist fabricator learn to speak K40 and, while these packages are
is unplugged, the wrong plug could have been pulled,
and maker, and is the great, they don’t have the features and the polished or the wrong isolator switch could have been switched.
owner of the Andrew
Lewis Workshop.
interface that a commercial product like LightBurn Invisible laser radiation can disfigure or permanently
can offer. In this project, you’ll find out how to blind you. Always wear laser safety goggles when
replace the controller of your K40 so that it speaks working with the laser. Never leave the laser in a state
a more conventional dialect of G-code and can where it could be powered up accidentally.
interface with applications like LightBurn.

64
FORGE

Left
The Mini Gerbil from
Awesome.Tech has
connectors that match
those on the original
control board, which
makes upgrading
exceptionally easy.
Additionally, there
are plenty of extra
pins that facilitate
other functions
like automatic air
assist management
and pause/resume
controls

” The stock controller is built


to be the cheapest possible
TIED UP WITH RIBBONS
You can use just about any controller to control your


laser, and choose between Marlin or GRBL for your
functional option firmware, just as you can for a 3D printer. In this
project, you’ll see that we’re using the Awesome.Tech
Mini Gerbil v3 (also called the MG3). This board
NEVER TRUST A LIVE LASER is a fantastic choice to run a K40 for a couple of
reasons. There are several variants of the K40, some
Like every other component on the K40 laser, the
of which wire the motors to the control board with
stock controller is built to be the cheapest possible a conventional cable bundle, while others use a
functional option. Aside from the proprietary control flat ribbon cable for the X-axis motor and endstop.
language, it has several other shortcomings that The MG3 supports both types, with a ribbon cable
make it ripe for replacement. The motor controllers connector built straight onto the board. Most notably,
for the laser are integrated into the board and it comes completely preconfigured to run on your K40
with very little extra effort – it’s essentially a plug-and-
aren’t adjustable, and there’s no support for more
play direct swap for the existing controller, right down
advanced features like air assist or exhaust fan
to the A4988 controllers being pre-tuned to suit the
control. You can’t even adjust the laser power K40’s stepper motors. In theory, if you aren’t interested
with software using the standard board. To some in the extra features of the board and don’t care about
extent this is a safety feature, because you can’t dead buttons on your control panel, you could replace
accidentally change a software setting and blow your existing controller, recalibrate, and be done in
up the laser. In reality, it’s just another way that the about 15 minutes.
manufacturer can save some money.

65
Controlling the K40 laser cutter with LightBurn

TUTORIAL

Above AUTO SHUTDOWN


The original control
board sits vertically at
the front right-hand If you’ve had your K40 for a while and you value your with no microprocessor required. From a safety perspective,
side of the machine, eyesight, you’ve probably added a safety interlock to the switching that sort of safety system to software control is
held in place by four
laser chamber door so that the laser switches off when a bad idea. Computers can go wrong, and it’s possible the
bolts. Removing these
bolts can be tricky, the door is opened. You’ll recognise that, although the system might not behave as expected in an emergency. So
because the nuts are laser switches off when you open the door, the motors will how do you resolve this, allowing the convenience of the
not fixed on the rear
side, but you can
continue to move, dashing any hope of rescuing a piece software pause with the safety of the hardware interlock?
usually reach behind unless the program has already been paused. The MG3 One method is to employ multiple switches – one that
with a thin spanner, or board can be used to monitor the laser chamber door, and operates the interlock, and another that connects the LID
even a screwdriver, to
hold the nuts in place pause the machine when it is opened. That means the and GND pins on the MG3 control board. Alternatively, a
while you unscrew machine will stop working when the door is opened, and you single DPDT microswitch could perform the same function,
from the front can press a resume button to start the laser cutting again with one pole connected to the interlocks, and the other
once the door closes. This is a great upgrade, but isn’t as connected to the LID and GND pins of the MG3. Having the
straightforward as you might think. Safety interlock systems microswitch double-throw allows you to decide whether
are designed to be very simple – in the K40, it’s essentially the switch will make or break the connection when the
a number of switches or relays connected together into a door is opened, to match the system you already have. For
loop. If one of the switches is activated, the loop breaks, more information and discussion about this, have a look
and the laser stops working. It’s a purely mechanical system at hsmag.cc/LaserSwitch.

66
FORGE

Left
Throw away your
expectations of colour
coding for the wires
inside a K40. The
colour choices appear
to be entirely arbitrary.
High- and low-voltage
wires may even use
the same colour and
be right next to each
other. In this example,
both 240 V wires are
coloured red, and so
is the laser active pin,
while the 5 V is white
and also yellow. The
laser power wires are
black and red, 24 V
DC is black, and the
ground wire is white
or black. Chase every
wire from end to end
– don’t trust colour
at all


Changing the control board will correct these
shortcomings, and as a result, you’ll need to make It’s good practice to take
some additional changes to your machine. Most
a few photographs of the
obviously, you’ll have a control panel with a lot of
buttons on it that don’t do anything any more. Laser connections and wires


control will be handled with software, so all of the inside the machine
buttons or dials you have to control laser power will go
away. In addition to this, you’ll be able to make some
safety improvements and upgrades that will make life the plastic cable organiser that is bundling things
much more comfortable when using the laser. together and cut a few cable ties to do this. Separate
Fitting the MG3 control board into the K40 is fairly out the high-voltage wires that go to the power and
trivial, and it actually presents a good opportunity emergency stop switches, and don’t mess with
to double-check your connections and make sure them. You’re going to leave them connected just as
everything looks healthy inside the machine. It’s they are, but will disconnect almost everything else
good practice to take a few photographs of the from the panel. Most modern K40s have a digital
connections and wires inside the machine before display with push-buttons to control laser power,
you do anything, just in case anything comes loose a rocker switch that operates the safety interlock
while you’re rummaging around in there and you and prevents the laser from firing, and a switch to
need to check where something went. turn the light on or off in the laser chamber. None
The control board will have connectors for the X of these switches really make sense for the way QUICK TIP
and Y axis motors, input power, and laser control. that the laser is going to work, and can be removed. Before you
Disconnect the cables from the control board and A common feature on the K40 control panel is an disconnect
everything and
throw it onto your scrap pile while uttering a suitably ammeter to monitor laser power. If you have one
take your laser
pithy insult. Now turn your attention to the control of these, you’ll need to disconnect it and fit it into out of action, cut
panel and power switches, and trace the wires that your new control panel. The wires that control the a replacement
connect to them. You’ll probably need to unwrap push‑buttons for the laser power and the test control panel.

67
Controlling the K40 laser cutter with LightBurn

TUTORIAL

button can be removed from the wiring loom. Trace


Above STAYING TRIM them back to the power supply, and unscrew them
There are as many
designs for K40 from their connectors.
control panels as You might find that the first time you run the laser, after
there are K40 laser changing the board and installing the proper settings The new control-panel-only template provided
cutters. A simple
Google search will into LightBurn, that you’ll need to adjust the trim of here features a couple of buttons to pause and
reveal plenty, although the motor controller slightly. This is particularly true if resume the laser, a key switch that replaces the
it’s easy enough to
come up with a design
you’ve modified your laser to add air assist or alignment K40’s laser enable switch, and the ammeter. There’s
that suits your own lasers on the gantry. This is because the extra weight no practical need for the chamber light to have a
needs using Inkscape of the modified gantry can be enough to overpower the
or a similar package switch, so the wires for the light can be connected
current limit on the A4988 controllers. It’s most likely
that you’ll have an issue with the Y-axis motor, as this directly to the 24 V/GND connection of the power
is the one that is moving the most weight. Very slightly supply. If the machine is on, the lights are on.
tweaking the trim pot on the controller by 1/8th of a turn The pause and resume buttons are normally open,
clockwise (or even less) should be enough to correct momentary push-button switches that connect
this. It’s tempting, if this happens, to consider replacing between the named pins on the control board and
the stepper motors with more powerful versions, but
the ground pin. The key switch connects into the
this isn’t really necessary and will probably just cause
interlock loop on the laser power supply, just as the
more problems. The steppers on the K40 use 0.9-degree
stepping, rather than the more common 1.8-degree laser enable switch did on the unmodified K40.
steppers used by 3D printers. You will need to adjust With the new control panel fitted in the machine,
for this if you replace them. You would also need to add you’re almost done. The power connector for the
an additional 24 V power supply to avoid overloading control board should match the old board and the
the laser supply (which can only output 1A maximum cable should plug in without any modification.
at 24 V). On top of this, if you intend to replace the
However, it’s worth double-checking that you don’t
X-axis motor, you’d probably find that the ribbon cable
can’t carry enough current to the motor and will need have a strange variant of the board and that the
replacing with an alternative cable. To be blunt, it isn’t pinouts match the new board, just to be sure. Finally,
worth the effort in the majority of cases. you need to connect the PWM pin on the MG3
controller to the PWM IN or POT IN pin of your laser

68
FORGE

QUICK TIP
Using a key as one
of your interlocks
is a good way to
reduce the chance
of someone firing
the laser without
permission, either
purposefully or
accidentally.

Left
LightBurn makes
it much easier to
perform common
laser tasks like
automatic shape
offsetting, and having
multiple cut layers for
each project

power supply. There are a few different designs of


power supply out there, so you’ll need to check the
DOLLAR STORE
datasheet for your specific model if you’re not sure The $ settings are G-code’s way of letting you fiddle
which pin this is. Use the plastic stand-offs that with the internal configuration of your machine to
came with your board to mount the MG3 into your tweak performance and enable or disable certain
case, and double-check all of your wiring before features. You can assign these values directly in your
G-code console by typing something like $96=1 (which
plugging in the power and turning on the machine.
would tell the MG4 to turn off air assist when the
Assuming everything looks good, plug in a USB machine pauses), but if you’re using a package like
cable and finally connect the laser to your computer. LightBurn, some of these features might be accessible
You should be able to control the laser with through a graphical menu. Be aware that fiddling with
any standard G-code controller, but for the best these settings inadvisedly can make your machine do
experience, download LightBurn and give it a try. At terrible things. Expensive things. Things that go bang
£50, it’s a relatively affordable luxury and it offers and catch fire. Be careful. With that warning out of the
way, there are a few settings that you might want to
some excellent features, even when using the free
pay attention to if you’re using an MG3 on your K40:
30-day trial. On the first run, click on the Devices
button and add a new Gerbil-STM device. Follow the $95=1 Inverts the operation of the air assist pin
setup wizard, setting the dimensions of the work $96=1 Turns off air assist when the machine pauses
area to 320 × 230, and set the origin of the machine $97=1 enables the laser chamber door safety system
to Rear-Left. Click Finish on the wizard, and your $110=24000 X-axis feed rate (24000=400mm/s)
$111=8000 Y-axis feed rate
laser cutter should be working with LightBurn and
you’ll have access to features like automatic shape A more complete list is available from here:
offsetting, and camera overlays of your laser bed awesome.tech/what-are-settings.
when arranging items.

69
Changing motion with linkages

TUTORIAL

Changing motion
with linkages
A round of applause for ourselves

L
ast month, we looked at linkages – into (almost) horizontal motion. We need to do
ways of joining together moving parts this for both hands, so we have two Bell linkages.
using solid bars. This month, we’re By flipping one around, we can get anticlockwise
going to design one. We want to create motion on one linkage and clockwise on the other.
an arrangement of rods and joints that This does present a problem because one of the
can only move in one way, and that’s to linkages will be further along the arm than the other,
Ben Everard make a pair of hands clap. We want both hands to and the further along the arm it is, the more motion
move toward each other. it will get as the arm moves. We can simply offset
Alternatively, hands can be on rods that rotate this by making the arm on one of the Bell linkages
Ben’s house is slowly
around a point. However, we need one to rotate longer than the other.
being taken over by 3D
printers. He plans to clockwise and one to rotate anticlockwise. This doesn’t quite solve the problem though,
solve this by printing an ‘Bell (crank) linkage’ is a name for an L-shaped as we still need a way to actuate this pair of Bell
extension, once he gets
enough printers.
rod attached at the angle in the middle of the L. This linkages. We opted for an arm on a pivot. If we
linkage gives us a way to transfer motion between attach both linkages to this then, as we rotate the
different directions, because pushing the base of arm, it will move the two Bell linkages. However,
the L up makes the top of the L move sideways. In one of the Bell linkages will be further out than the
this way, we can transfer (almost) vertical motion other, so will rotate further. The solution to this is to

Above
Open …

Left
… and shut

70
FORGE

Left
Push the filament into
the hole, and trim the
end for a strong pivot

make one of the Bell linkages have a proportionately


longer base to the L, and then the leverage effect
EXTENDING
counteracts the fact that it moves further. It would be fairly easy to extend this project by linking
Once the plan was sketched out, calculating the the main bar to a wheel that you could turn, either
lengths of everything was just a little trigonometry. by hand or with a motor. This would make it easy to
generate a lot of applause. Equally, you could use the


movement to do something else – clang some cymbals
together or get a pair of hands to wave goodbye
Spend a bit of time looking (or hello).

at other linkages and


familiarise yourself with conclusion that short sections of filament performed


well. This month, we’ve continued to use these.
some of the simple ones Most of the links are, therefore, bars with 2 mm
holes in them at the ends. These are really easy
to draw in FreeCAD. We created an object that
DESIGN DECISIONS took data from a spreadsheet and made the bars
As with many linkages, once the design is finalised, suitably sized.
everything seems very straightforward. This doesn’t The Bell linkage bars are slightly different because
mean it was straightforward to design. The best these need to have 90-degree bends in them. We
advice we can give for designing linkages is to spend created them using two sketches – one with the
a bit of time looking at other linkages and familiarise outline of the bar which we then padded, and one
yourself with some of the simple ones. Don’t forget with the holes that we then pocketed.
the importance of CAD – Cardboard Assisted Design. Finally, you need to add a base, whose sole
With an old box, some scissors, and some pivots purpose is to hold everything together.
(pretty much anything you have to hand can work, Once we had the linkage set, the only thing left
from split pins to screws), you can quickly test out was to add the hands. We traced around our hands
Above
some designs. and cut them out of cardboard. A bit of sticky tape Tape on a pair of
Last month, we looked at different techniques holds them onto the linkage. Of course, you could hands and clap away

for joining our rods together and came to the print out hands for this if you prefer.

71
This stunning 224-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.

Get game design tips and


tricks from the masters

Explore the code listing


and find out how they work

Download and play game


examples by Eben Upton

Learn how to code your own


games with Pygame Zero

Available now hsmag.cc/store


Pico Agile Octopus Tariff Display

TUTORIAL

Pico Agile Octopus


Tariff Display
Get live updates of your electricity prices

F
ind out how to make a Raspberry SLICED DREAD
Pi Pico W-powered electricity tariff The Agile Octopus tariff divides the day into 48 half-
display to help plan your energy hour ‘slices’, each with its own price. The prices for
use. Along the way, you will also the slices (sorry) are released one day in advance.
discover how to configure settings in an They are calculated by Octopus from the projected
embedded device using your browser. cost of energy for that time. If the weather is going
Rob Miles to be windy and sunny, there will be a lot of cheap,
AGILE ENERGY TARIFFS green energy available, and prices will go down.
Rob Miles has been If you are looking for a way to reduce your electricity On cloudy, still days, the price may go up. During
playing with hardware bills, you might want to look at the world of agile the day the price varies, usually with a couple of
and software since
almost before there was pricing. The author is presently using an agile tariff peaks (a smaller one in the morning and a larger
hardware and software. and it seems to be working so far, making noticeable one in the evening). The peaks are very predictable
You can find out more savings. The author doesn’t have any solar panels (the largest one starting around 4:00 pm) and only
about his so-called life at
robmiles.com. or batteries at his house, but he does drive an during the middle of the peaks does the price
electric car. He doesn’t have any special control exceed the price the author was paying on his
systems for any of his household devices; the previous tariff.
savings have been achieved just by doing things at Figure 1 shows the display from the Agile Octopus
different times. He is using the Agile Octopus tariff website, giving prices over the day. The author was
(hsmag.cc/AgileTariff). There may be similar surprised to discover that night-time prices (which
offerings from other suppliers. are usually associated with off-peak energy) are not
always lower than daytime ones (although they are
in Figure 1 – it must have been a windy night). It will
be interesting to see how prices change during the
winter months, with more wind and less sunshine.

TARIFF DISPLAY
You can get the tariff information on your phone or
computer, but the author really wanted a gadget
that could be kept in the kitchen (where a lot of
the power is consumed) and help decide when to
Figure 1 do things. The tariffs are exposed by Octopus as
Sometimes the price
goes negative, and JavaScript Object Notation (JSON) formatted data
you get paid for which is read by a Pico W connected to the home
using electricity.
Unfortunately, this Wi-Fi. The author has been through a few design
doesn’t happen very iterations with his wife (who is playing the role of the
often (although it did
on this day at 5:00 am) customer for this development).

74
FORGE

Figure 2 shows the two versions of the display. GET YOUR TARIFFS HERE
Figure 2
The left-hand display uses a backlit LCD panel, and Octopus provides web addresses for all its tariffs, We are not sure if
the right-hand one uses e-ink. Both devices are which are exposed as JSON-encoded files. You the price values are
being shown too
showing the same data. The number at the top can get the tariff code from your Octopus account precisely. Perhaps
we don’t need to see
gives the current price per kilowatt hour. An electric details. Visit your Personal Details page and select fractions of a penny
kettle uses around 3 kilowatts, so if you spent an the API (application programmer interface) page.
hour making tea at the price shown this would cost This shows your unique key that you can use to
you around 39 pence (3*13). The dark bars show validate requests to read your energy usage data
upcoming prices. Each bar represents the price for from Octopus. If you scroll down the page, you
that time slice – the solid bars are hourly prices, and can find the item marked ‘Unit rates’ as shown in
the dotted bars are half-hourly. The numbers on the Figure 3. The address we will use is the part that YOU’LL NEED
right-hand side of the display give the maximum and hasn’t been crossed out. A suitable box
minimum prices for the day. The maximum price (some 3D printable
designs are also
for the day (which occurs at around 6:30 pm) will be
available)
35 pence. The minimum price will be -2 pence. This
means that for the magical time slice (from 5:00 to
HARD TIMES A Raspberry
Pi Pico W
5:30 am) you would get paid for consuming power. One of the biggest problems the author had with (remember to get
building the display turned out to be dealing with time,


the W version
more specifically, British Summer Time. This moves the as this has Wi-Fi
For the magical time slice clocks in the UK forward in summer. Unfortunately, the capability)
items in the data supplied by Octopus are not adjusted
– from 5:00 to 5:30 am – for this change, so during summer, the display must
A display. The
software works
you would get paid for ask for readings starting one hour before the required with either liquid


time. This means that the display must decide if it is in crystal (Pico GFX)
consuming power summertime before asking for tariff values. or e-ink (Pico
Inky) devices from
Pimoroni
period_from=2023-09-22T23:00Z&period_
to=2023-09-23T23:00Z A smart
The faintly dotted bars show the previous prices for
electricity meter.
the day. The time is shown in the bottom right-hand The code above shows the time period that was The agile tariffs
corner. The left-hand corner shows status messages. fetched by the display for the 23 September. Because can only be used
This display has been in use for a while and is if your meter can
this is in summertime (one hour ahead of the time
send half-hourly
useful for quickly deciding when to turn on the standard used by Octopus), the display fetches readings to your
washing-machine or tumble dryer, and when values from one hour behind the current time, which electricity provider.
means that the first hour is fetched from ‘yesterday’. The author’s lowly
to bake a cake. It is powered by a Raspberry Pi
Fortunately, in a previous life, the author wrote a SMETS1 meter
Pico W running a MicroPython program which proved equal to this
lot of code for managing date stamp production
gets and displays the tariff values. You can find task, but this does
and was equal to the task. The program contains a vary from meter to
the code on the GitHub site for this project at TimeManager class which does this. meter and supplier
hsmag.cc/AgileInstall. to supplier

75
Pico Agile Octopus Tariff Display

TUTORIAL

Figure 3
If you open the web
address in your
browser, you will
see a page of JSON
which contains the
current tariff values

BUILDING AN ADDRESS that connects to the network and sets the time
The web address can be followed with query values is part of a Connection class which manages the
to specify the start and the end of the period for network connection.
which prices are required.
Figure 4 shows a complete address that FETCH THE DATA
would obtain the price data for 23 September It turns out that it is very easy to fetch the tariff data
2023. The MicroPython program controlling the once the Pico W has been connected to the local
display uses the current date and time to build a Wi-Fi. The urequests library can do this with a single
string like this. function call:

SAY HI TO THE WI-FI import urequests


Before any data can be fetched into the Pico W, the
program must first connect to the local Wi-Fi network. res = urequests.get(url+"?"+period)

import network The code above creates a tariff request containing


the URL and the period query values and then calls
self.wlan = network.WLAN(network.STA_IF) the get function in urequests to get the tariff values
self.wlan.active(True) into a string called res. This data is supplied as a
if not self.wlan.isconnected(): JSON-encoded string:
self.wlan.connect(ssid, pwd)
while not self.wlan.isconnected(): {
pass "count": 46,
"next": null,
The MicroPython code above sets up a connection "previous": null,
to the local Wi-Fi using the values in ssid and pwd "results": [
as the access point name and password. Once the {
display has connected to the local network, it now "value_exc_vat": 17,
needs to obtain the current date and time so that it "value_inc_vat": 17.85,
can request the tariff data for the day. "valid_from": "2023-09-23T21:30:00Z",
"valid_to": "2023-09-23T22:00:00Z",
import ntptime "payment_method": null
},
ntptime.settime() {
"value_exc_vat": 17.2,
The code above sets the time in the Pico W from "value_inc_vat": 18.06,
the network. In the finished application, the code "valid_from": "2023-09-23T21:00:00Z",
"valid_to": "2023-09-23T21:30:00Z",
"payment_method": null
LCD VS E-INK },
The author wasn’t sure whether to use a liquid crystal (LCD) panel or electronic ink (e-ink) ... another 44 values are here
for the tariff display device. Fortunately, the displays weren’t particularly expensive, and ]
so he decided to get one of each and see which looked the best. The picture in Figure }
2 doesn’t really do the LCD panel on the left justice. For an LCD device, the screen is
actually very good. It also has a multicoloured backlight, so it would be possible to make
Above you can see the JSON returned from the web
the display light up red when power was expensive. The e-ink display looks very nice, but
it does take a couple of seconds or so to update when it is redrawn. During the update, it request. Only the first two of the 46 price values are
flashes the whole screen black and white, which can be distracting. shown. The next and previous items are used if the
response forms part of a larger response to a request

76
FORGE

for a lot of data. This response contains only 46 items, Figure 6 shows the webpage which is used
Figure 4
so next and previous are not needed. The results to configure the display. JavaScript code in the The query (?)
item is a list of price values for different time periods. page communicates with the display and generates character in the URL
string marks the
this configuration page which is used to enter start of the query
values which specify
results = res.json()["results"] setting values. These are then sent back to the the time range
display which stores them in local filestore on
The MicroPython statement above decodes the the device. You could use this to manage any
JSON and creates a variable called results which MicroPython-powered device that contains user-
holds all the result values in a list. The program can defined setting values. You can download the
then iterate through these values, find the highest configuration site from GitHub, or you can use it
and lowest prices and use the price and valid_from online at hsmag.cc/AgileGitHub.
elements to build a list of all the prices.
CREATIVE LAZINESS
for result in results: A good description of a programmer is ‘creatively
price = result["value_inc_vat"] lazy’. Programmers build things which make their
valid_from = result["valid_from"] lives easier. The web-based configuration of the
.. build the histograms display is a good example of how creative laziness
can save a lot of work. The author could have
The program draws the bar chart display differently created a custom webpage for the display containing
for the e-ink and LCD versions. The e-ink display is the elements you see in Figure 6. However, he
made from shaded boxes, whereas the LCD version decided to create a system where the page creates
is made from lines. This is done to get the best itself from the settings information. This approach
results on the two different displays. uses the ability of JavaScript code to generate new
webpage elements from software.
CONFIGURING WITH THE BROWSER The settings are stored in the display device as
When you create an embedded device, you a string of JSON. The string describes an array
sometimes need to modify the program code to containing setting values. This string is kept in a file
set up things like Wi-Fi passwords and other device in the display device and sent to the webpage when
specific data. The author wanted to avoid this with it is being configured.
the tariff display. He wanted it to be possible to
configure the display without changing the code in {
it. Figure 5 shows how this is done. The display "wifiSSID": {
owner connects their device to their computer using "name": "WiFi SSID",
a USB-serial connection (the same one that was "desc": "Name of the SSID point for the
used to load the software onto the Pico). They then network",
open the configuration page in the browser on their "type": "text", Figure 5
computer. The webpage contains JavaScript code The settings for the
"value": "",
display are stored in a
which updates the settings in the device. "order": 1 text file on the display

77
Pico Agile Octopus Tariff Display

TUTORIAL

Figure 6
The setting for
the display type is
selected from the
options displayed on
the page. You can
select a ‘print’ display
which prints values
on the MicroPython
console for testing

}, data",
"type": "text",
"wifiPWD": { "value": "https://api.octopus.energy/v1/
"name": "WiFi Password", products/AGILE-FLEX-22-11-25/electricity-tariffs/
"desc": "WiFi password for the network", E-1R-AGILE-FLEX-22-11-25-M/standard-unit-rates/",
"type": "password", "order": 4
"value": "", }
"order": 2 }
},
"display": {
"name": "Display type", Above are the setting values for the display. Each
"desc": "Type of display being used in setting has the properties’ name, description, type,
the device", value, and order. The order property is used to
"type": "string", determine the order of the items in the page created
"value": "lcd", by the browser. The type property determines the
"values": ["print","e-ink","lcd"], type of HTML element used to edit the setting on
"order": 3 the webpage. The display property has a values
}, element which gives the possible values it can have.

"AgileURL": { BUILDING WEBPAGES FROM JAVASCRIPT


"name": "Agile Octopus URL", When you visit a webpage in your browser, there
"desc": "URL for the Agile Octopus price is a good chance that the page content that you
see is not fetched from a web server. Instead,
the webpage you receive will contain a JavaScript
SECURITY IS A THING program which runs in the browser. This code will
When you create an embedded device, you must be mindful of security issues. The tariff fetch a small amount of data from the server and use
display stores Wi-Fi settings which can be extracted from it. Anyone can connect a USB this to create the page that you see. This is how our
cable to a MicroPython device and read back the contents of files on the device. The tariff display configuration works. The configuration
author considered encrypting the settings in the tariff display, but this would not provide page contains a single HTML element:
a completely secure solution because the device must also decrypt them before they are
used, so the data will always be obtainable by a determined hacker. In the end, it was
<p id="stageDescription"></p>
decided that the best solution was to connect the tariff display to a guest Wi-Fi account
on the home network. If the display is lost or stolen, the guest password will be easier to
change without affecting other devices. The element above describes an empty paragraph.
The element has been given the identifier

78
FORGE

MAKING A CASE
type); QUICK TIP
inputElement.value = value.value; If you are happy
After a design review meeting in the kitchen, it stageElement.appendChild(inputElement); to modify the
was decided that the e-ink display was to be used. }); MicroPython
The case design is shown below. The design box program in your
was produced using a Python program running inside The code above loops through the items display, you just have
FreeCAD to make the initial designs. The lid was then to edit the DEFAULT_
in settingsObject and uses the document.
tweaked with the addition of chamfers and bevels. SETTINGS string in
The design files are available on the GitHub site for createElement method to create an HTML input the Config class.
the project. element for each setting. The type and the value of
this element are set to the values for the setting.
Then the new element is appended to stageElement
using the appendChild method. At this point it will
appear on the page.
The actual code is slightly more complex than
the above, in that a label element is also created,
but you can see the underlying principle at work
here. The result is that the contents of the page is
determined by the JSON setting description received
from the display device. This is ‘creative laziness’
in action (or should that be inaction?) in that if we
add new settings to the JSON in the display, we
don’t have to do anything else. The new settings will
automatically appear on the configuration page.
stageDescription. When the configuration page When the Submit button is pressed, another
displays the setting values, a JavaScript program JavaScript function runs with extracts the values
runs, which first gets a reference to this element: from the elements, builds a JSON object, and then
sends it back to the display device.
let stageElement = document.
getElementById("stageDescription"); FURTHER DEVELOPMENT
The displays have buttons which could be used to
The statement above asks the document object select different display options. The Octopus API
Below
model (DOM) managed by the browser for a allows customers to read back their usage, so it The lid of the display
reference to the stageDescription paragraph. HTML would be possible for the display to show how much was printed the same
way up as you see it
elements can act as containers for other elements. electricity was used in each of the time slices. This here. This gave the
The program is going to add extra elements to this would be a great extension to the project. But as it best possible finish
to the edges and the
paragraph, at which point they will appear on the stands, it has already proved effective. display surround
browser page. The JavaScript variable stageElement
refers to the empty paragraph on the page which is
going to be filled with the input elements.
The program can now add all the elements
that are needed to edit the settings of the display
to this element. In the code below, the variable
settingsObject contains a JavaScript object which
was created from the JSON settings description
received from the display:

settingsObject.forEach((setting) => {
let id = setting[0];
let value = setting[1];

inputElement = document.
createElement("input");
inputElement.setAttribute("type", value.

79
DON’T MISS THE BRAND NEW ISSUE!

SUBSCRIBE
FOR JUST

£10!
> T
 HREE!issues
of The MagPi

> F
 REE!
Raspberry Pi
Pico W

> F
 REE!
delivery
to your door

NEW
+ FREE
MODEL!

RASPBERRY PI
*W

PICO W*
hil
es
toc
ks
las
t

Three issues and free Pico W for £10 is a UK-only offer. Free Pico W is included with a
12-month subscription in USA, Europe and Rest of World. Not included with renewals.
Offer subject to change or withdrawal at any time.

magpi.cc/subscribe
FIELD TEST
HACK MAKE BUILD CREATE
Hacker gear poked, prodded, taken apart, and investigated

PG

88
INPUT SHAPER
Prusa printers get a
speed boost
PG
82
BEST OF
BREED
PG

90
LIBREPCB Bar codes are the best codes
A new way to design
your circuits

PG

94

KALUMA
Program your Pico
with JavaScript
Bar-code readers and more

BEST OF BREED

ONLYTHE
BEST
Bar-code
readers and more
Sensors for reading the messages found in bar-codes and QR codes

By Marc de Vinck @devinck

B
eing able to read bar-codes isn’t just
reserved for big box stores for
quickly looking up a price, or giant
warehouses tracking the flow of
their inventory. There are plenty of
other use cases for using bar-codes;
even small electronic kit makers can use them to
track limited inventory and the steps in the
manufacturing process. I’ve also seen some really
creative uses for bar-codes and QR codes that
include interactive art, musical instruments, and
even as a discrete set of instructions for robotics.
There are plenty of small manufacturers out there
that need a custom solution where the typical
handheld scanners available just don’t work.
This is certainly a very niche topic for this month’s
Best of Breed, but I found the whole ecosystem of
how they work, and the multitude of types of QR
and bar-codes out there, kind of fascinating. And
since there are dozens, if not hundreds, of different
inexpensive handheld scanners available, it only
seems natural that you’d be able to buy the discrete
components to build your own. My adventure
started when I found a very interesting and
affordable QR code scanner from Adafruit. So, let’s
jump right in and take a look.

82
FIELD TEST

Tiny Code Reader from Useful


Sensors vs Zero Barcode HAT
ADAFRUIT $7 adafruit.com TINDIE $69.99 tindie.com

T
his is the product that inspired the
entire roundup. The Tiny Code Reader
from Useful Sensors is available at
Adafruit. It has an RP2040 on the back
and a camera module on the front. It
allows you to quickly scan a QR code
and feed the data into a microcontroller or single-
board computer. And it’s really inexpensive! Just $7!
The on-board microcontroller runs TensorFlow Lite
and does some complicated image recognition to
decode the QR code. Simply connect it to your
microcontroller via the STEMMA QT / Qwiic
connector or wire it up the old-fashioned way. It’s
amazing to think about this $7 technology compared
to what was available ten years ago. We are in
the future!

N
ext up is the Zero Barcode HAT from
SB Components in the UK. This HAT is
the perfect addition for your Raspberry VERDICT
Pi Zero. It features a DE2120 scanner
module, buzzer, 1.14” LCD screen, and Tiny Code Reader
from Useful
a micro USB connector to get you up
Sensors
and running fast. It can scan any of 20 different bar-
codes, both 1D and 2D. And since it’s a camera, it can Amazing tech at
an amazing price.

10/ 10
also decode QR codes. Once scanned, you can display
the data on the crisp LCD screen. It’s a complete
system, minus the Raspberry Pi!
The HAT also has two LEDs: one for lighting up the
graphic, and the other to project the red line, like laser- Zero Barcode HAT
based scanners. The data the sensor reads can be Capable, but at
transmitted via the on-board micro USB port or the a price.

8/ 10
UART pins. If you have a Raspberry Pi Zero and want
to include some bar-code scanning abilities, this is a
great HAT for your project.

83
Bar-code readers and more

BEST OF BREED

SparkFun 2D Barcode
Scanner Breakout
SPARKFUN $53.50 sparkfun.com

T
he SparkFun 2D Barcode Scanner uses
the same DE2120 sensor as the Zero
Barcode HAT, so it has many of the
same functions. However, this breakout
board isn’t in the Raspberry Pi Zero form VERDICT
factor, and it doesn’t have a screen, so SparkFun 2D
you save a little bit of money if you don’t need those Barcode Scanner
features. But it’s still very Raspberry Pi-friendly! Breakout
This breakout board aims to make it easy to access A breakout
all the features of the DE2120 without dealing with its board for a
small pitch and sometimes finicky flat flex cables. You’ll reliable sensor.

8/ 10
have basic feedback thanks to the on-board LED and
buzzer. Check out the comprehensive SparkFun 2D
Barcode Scanner Breakout Hookup Guide for a lot
more information.

RFID WIZ KIT BY SMOOTH TECHNOLOGY

ADAFRUIT $49.94 adafruit.com

Yes, I know, this isn’t a bar-code or QR code reader. But


when researching the topic, I found this handy little RFID
reader kit available at Adafruit. What I like about this one,
compared to a whole host of other versions, is the built-in
relay and the fact that it’s a complete kit with no code
required. The kit includes the RFID Wiz board, 13.56MHz Tag
Reader board, 12 V 2A power supply, 6-pin JST-XH cable,
2-pin JST-XH cable, RFID key fob, RFID card, 5 × RFID
stickers, and a QR code that directs to the Adafruit learning
guide. Simply train the board with the included RFID cards
and start making!

84
FIELD TEST

Barcode Reader/Scanner Module


- CCD Camera - USB Interface
ADAFRUIT $69.95 adafruit.com

T
he Barcode Reader/Scanner Module
from Adafruit can decode nearly any
kind of 1D bar-code in a very small
form factor. The sensor takes 100
photos per second and is very similar to
the laser-based scanners, but with no
VERDICT
moving parts, so it’s more robust. Barcode Reader/
All you need to do is plug it into any available USB Scanner Module
port and it will show up as an HID keyboard. When - CCD Camera -
you scan a bar-code, the raw data is decoded and USB Interface
parity-checked, then output to your computer as a Compact and
series of digits, just like entering them on a keyboard. ready to go.

8/ 10
And if you don’t want USB output, check out the PS/2
interface version which is compatible with almost
any microcontroller.

85
Bar-code readers and more

BEST OF BREED

Barcode HAT for Raspberry Pi


1D/2D Codes Reader
TINDIE $76.94 tindie.com

O
nce again, we find the ever-
popular DE2120 scanner
module, but this time in a
form factor that’s perfect
for your Raspberry Pi.
The Barcode HAT for VERDICT
Raspberry Pi by SB Components is a Barcode HAT
perfectly sized and capable bar-code for Raspberry
scanner. In addition to the DE2120, the board Pi 1D/2D Codes
features a 1.14” LCD screen for displaying Reader
scanned results, a micro USB port, LED, button, piezo Form-fitting for
buzzer, and handy pass-through 40-pin GPIO header. I your Raspberry Pi.

9/ 10
like the fact that you can still access many of the
GPIO pins after attaching this HAT, allowing for a lot
of expansion possibilities.

HANDHELD 2D & 1D USB


BARCODE SCANNER

PIMORONI $47.93 pimoroni.com

OK, so you aren’t into building a bar-code scanner, we


won’t judge. But when you start looking at what is
available out there, it can be overwhelming. That’s where
this USB scanner comes into play. Pimoroni offers a
simple, easy-to-program USB scanner. Once you figure
out how to get access to the built-in USB cord (yes, there
is a trick), you can simply scan the bar-code on its site to
change the functionality from factory default to a much
handier USB HID controller or a variety of other
possibilities. Head over to its website to learn more.

86
THE OFFICIAL
Raspberry Pi
Beginner’s Guide
The only guide you
need to get started
with Raspberry Pi
Inside:
Now • Learn how to set up your Raspberry Pi,
includes install an operating system, and start using it
Scratch 3  • Follow step-by-step guides to code your
projects!
own animations and games, using both the
Scratch 3 and Python languages
• Create amazing projects by connecting
electronic components to Raspberry Pi’s
GPIO pins

Plus much, much more!

Just £10

Buy online: magpi.cc/BGbook


Prusa MK4 input shaping

REVIEW

Prusa MK4 input shaping


Get more speed out of your printer

FREE UPGRADE prusa3d.com

By Ben Everard

B
ack in issue 67, we reviewed the acceleration and deceleration as well. To a certain
Prusa MK4. At launch, we found it to extent, you can mitigate this by making the frame
be a good printer, but it wasn’t quite stronger. However, increasingly, the most effective
as fast as some of the competition. way of mitigating this is in software.
Lingering behind that was the promise If the processor on the printer can predict how the
of improved firmware to speed it up. frame will move and wobble at a particular amount of
The limiting factor in how fast you can 3D-print is force, it can compensate for this in how it moves the
usually not the actual speed the motors can move, motors. This is what input shaping refers to. The latest
or even how fast the processor can go, but how version of firmware for the MK4 printers includes this.
much the frame shakes. Because 3D printing typically They are by no means the first printers to include
involves lots of short moves, increasing the speed input shaping, but they have implemented their own
Above
It’s Benchy, but bigger only really has an effect if you can increase the version of it.

88
FIELD TEST

Left
At these speeds,
everything starts to
shake, so make sure
your printer’s on a
solid table


IN PRACTICE
We’ve been using the input shaper in both its pre-
This sort of speed makes it
release alpha version and the release version for a comparable with the
while now, and it’s working well. We’re basically
fastest alternative consumer


getting the same prints in less time and there’s not
much to complain about there. Exactly how much 3D printers
faster it goes depends a lot on the specific model,
and the quality you’re after. The classic Benchy,
for example, takes 38 minutes when printed at exotic machines (such as homemade Vorons) can end
0.2 mm layer height and sliced normally. If you really up faster, but that’s a whole different class of printer.
want to push things, you can print a pretty decent- Perhaps the first thing you’ll notice when you
looking Benchy in twelve minutes if you’re willing start using the new firmware is that the names of
to sacrifice good printing practice (take a look at the slicing profiles have changed. There’s no longer
hsmag.cc/BenchyInputShaping). ‘speed’ and ‘draft’, now it’s ‘speed’ and ‘structural’.
However, while Benchy is a great test for a lot They should both have a similar look, but the faster
of things, it’s not actually that indicative of the sort prints can be a little weaker, so if you need your prints
of speed changes you’re likely to see because it’s to stand up to the tests of time, you’ll want structural.
a small, intricate model. To give you a better idea, Currently, this firmware is only released as stable
we scaled Benchy up to 200% of its size. At this for the MK4. However, recently an alpha version
scale, it’s a bit more like most of the prints we do for the Prusa Mini has been released. This doesn’t
(though your usage may be different). A Prusa MK4, quite match the speeds of the MK4 version, but it’s
with input shaping, prints in 2h 19m. Without input a significant increase on the previous Prusa Mini
shaping, it’s 3h 54m. On a Prusa MK3, it’s 4h 59m. speed. We have not tested this out yet, but if they
This is broadly indicative of the times we’ve been are able to do this, it will be a particularly impressive VERDICT
seeing with real-world models. achievement to squeeze this additional speed out of Everything we
This sort of speed makes it comparable with the an older printer. loved about
fastest alternative consumer 3D printers. Which In our original review of the Prusa MK4, we said the MK4, but
printer will be fastest for you will depend on the that it was a good printer without the input shaping, now faster.

10/ 10
particular model you’re printing and the slicer and all the things that made it a good printer then still
settings you use. However, there’s not going to be stand. However, it’s now almost twice the speed,
a significant difference one way or the other. More and that’s a great new feature to have.

89
LibrePCB v1.0

REVIEW

LibrePCB v1.0
A new electronics design tool

FREE librepcb.org

By Ben Everard

P
CB design is fundamentally a go through, and there are the considerations around
deceptively tricky thing. It’s deceptive the physics of moving electrons through a substance.
because the end results aren’t usually In other words, there’s a lot that can go wrong on
particularly complex – you just create a PCB, and it’s the job of the design tool to help
a few vector images to send off to a the designer avoid as many of these problems as
factory and, compared to most vector possible, while still allowing them the freedom to
images, they’re pretty simple. There aren’t that many create the design they want.
traces on a PCB compared to, say, brush strokes on Having just reached version 1.0, LibrePCB is much
a painting. younger than most established players, and this
However, the complexity comes not from the brings both advantages and disadvantages.
amount of detail needed, but the correctness LibrePCB feels like it’s been designed for flexibility.
needed. There are thousands of different electrical Footprints are assigned to components after the
Below
The documentation components, all with slightly different requirements. schematic stage, so you can throw whatever you like
is currently quite
limited, but hopefully
There are also different limitations and considerations into your circuit without having to worry about what
it will grow over time of the various different manufacturing processes to part will actually do the job. You can keep several
different designs of the PCB synchronised with the
schematic, meaning that you can hack about on
different designs before deciding which route to
go down.
The flexibility extends down to the library level
as well, allowing you, for example, to have multiple
footprints for the same package. This could be a
hand-solderable footprint and a reflow footprint that
you can choose between.

FABRICATION
Perhaps one of the most confusing things about
getting a PCB made is Gerber files. This is almost –
but not quite – a standard format. It’s just different
enough that a single Gerber file won’t always work
between different manufacturers. Or, it might.
LibrePCB includes a fabrication service which
allows you to send your projects directly to
manufacturers and, in turn, these manufacturers
make a donation to LibrePCB. At the moment, this

90
FIELD TEST

Left
You too can design
a Raspberry Pi HAT
with a single LED


only works with AISLER and PCBWay. Depending on
your point of view, this could be a convenient way of Software without
supporting your design tool while getting your PCBs documentation is going to end
made, or it could be a commercial intrusion into your
up being frustrating


software. We’re inclined to view it in the first way,
and it’s by no means the first PCB design tool to be sooner or later
funded by a PCB manufacturer.
There are a couple of downsides to LibrePCB
being so new. The first is that it hasn’t yet built Software without documentation is going to end up
up as big a library of parts as some of the more being frustrating sooner or later. There is a Discourse
established EDA tools. Again, how big a problem forum for help, but there’s not a lot of activity on it.
this is depends very much on how you use it. Many We found LibrePCB to be easy to use and generally
people prefer to maintain their own libraries anyway pretty sensible, but we’re quite light hobbyist users.
as this can reflect the parts they have, and they can Existing tools, such as KiCad and EAGLE, have plenty
be completely confident in the parts there. Trusting a of powerful features that are lacking here. How much
user-contributed library part when designing a PCB is you miss them will depend entirely on how you use
something that’s caused us (and many other people) your existing tool. VERDICT
problems in the past. The LibrePCB developers say that they have It’s still young,
The second downside is that there is far less created a tool for everyone. We’re not quite so sure. but shows
documentation about it. There’s a ‘Quick Start’ tutorial We strongly suspect that there are plenty of people promise.

8/ 10
and a fairly sparse user guide. You can figure out quite out there who like the rigidity of some EDA programs.
a bit by clicking around, but there are always going However, we really like it, and we suspect that it will
to be things you can’t find, or figure out how to do. appeal to others as well.

91
T H AT M A D E

OUT
“The Computers That Made Britain
is one of the best things I’ve read
NOW
this year. It’s an incredible story of
eccentrics and oddballs, geniuses and
madmen, and one that will have you
pining for a future that could have been.
It’s utterly astonishing!”
- Stuart Turton, bestselling author
and journalist

Available on

Buy online: wfmag.cc/ctmb


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
Kaluma

REVIEW

Kaluma
JavaScript on Pico

Free Kalumajs.org

By Ben Everard

P
rogramming languages are strange JavaScript programs tend to rely heavily on
things. In a very real sense, they’re events. Let’s take a look at the example of blinking
all exactly equivalent – you can write an LED. Using C or MicroPython, you’d typically do
equivalent programs in just about this using a loop and a delay, but let’s take a look at
any modern language. However, at the how it’s done in Kaluma:
same time, they’re entirely different.
var led = 25;
Learning a programming language – not just the
pinMode(led, OUTPUT);
basics, but really taking the time to become fluent in
setInterval(() => {
it – affects the way you program, and even the way
digitalToggle(led);
you think.
}, 1000);
Kaluma is a port of JavaScript to RP2040-based
devices (currently Pico and Pico W are supported). As you can see, the setInterval function creates
It might seem a little strange to port JavaScript a repeating timer that runs every second and calls
Below to a microcontroller. After all, this is a language that another function (in this case, the second function
You can find out
everything you started out as a way to add widgets to webpages, isn’t named and just contains one line of code:
need to know about and superficially, that’s got little in common with digitalToggle(led).
getting started
at kalumajs.org blinking LEDs and reading temperature sensors. You can do this in C, or you can do it this way
in MicroPython. But for most C or MicroPython
programmers, it wouldn’t be the natural way of
doing it. Which is the better way of blinking an LED?
Well, that’s a can of worms that we’re not going
to open. However, there are two key advantages
of having JavaScript on a microcontroller. Firstly, it
enables programmers who are most familiar with
JavaScript (and other similar) languages to feel at
home using microcontrollers. Secondly, it enables
people using microcontrollers to gain experience
doing things the JavaScript way while still feeling
at home. Both of those things are unequivocally a
good thing.

EXPLORING KALUMA
This doesn’t really say much about Kaluma itself,
though, just the idea behind it – so let’s dive in and
see what it’s like.
There are two parts to Kaluma: the firmware that
runs on the device (which you can download from
kalumajs.org) and the software that interacts with

94
FIELD TEST

Left
The eight-part
‘getting started’
series will help
you start working
with hardware

it (which you can install via Node.js). Both installed great detail and explains the technical details
without problems for us. behind them.
With so many things that we look at, This series is probably more suited to people
documentation is the difference between an OK who know JavaScript and need some help with the
product and a great product. After all, it doesn’t physical computing side than electronic engineers
matter how well something could work if you can’t who need help getting to grips with JavaScript.
work out how to use it. We’ve been really impressed The main downside of Kaluma is the main
downside of every new programming language for


a microcontroller – hardware support. By this, we
Documentation is don’t mean the hardware on the Pico (or Pico W)
boards, but any additional hardware your project
the difference between needs. At the moment, there’s out-of-the-box
an OK product and support for a relatively small amount of hardware.


There’s not even support for the almost ubiquitous
a great product WS2812 LEDs. That isn’t to say that you can’t use VERDICT
this hardware with Kaluma; you just have to be
Documentation
willing to work at a low level. You can use I2C, SPI, and tutorials
with Kaluma so far. It’s obviously a small product, and even RP2’s PIO blocks to communicate with make it easy to
so don’t expect the sheer volume of documentation most things, but this means working at a low level. get started with
that you might find with larger ones. However, the Overall, we found it easy to get started this version of
API is clearly detailed at kalumajs.org/docs, and with Kaluma. The software worked and the JavaScript.

8/ 10
there’s an eight-part series to get you started at documentation was easy to follow. It won’t be
kalumajs.org/docs/tutorials. This goes through for everyone, but it’s a welcome addition to the
the basics of connecting to common hardware in Raspberry Pi Pico family.

95
Crowdfunding now

REGULAR

CROWDFUNDING
NOW
InvenTABLE
Cardboard cutting made easy

From $189 hsmag.cc/inventable Delivery: March 2024

C
ardboard is a really great material. It’s
generally a waste material, so it’s
Below
basically free, it’s strong enough to hold As well as
its shape even in large objects, and it’s cardboard, you
can cut other
light enough to be easy to work with thin materials
(even for children). However, it’s kind of a pain to cut.
Sure, scissors will get through it, but it’s awkward to
make long cuts without creasing the sheet. You can
use a sharp knife, but that’s also tricky (and not an
option for young makers).
The InvenTABLE is intended as a solution to this.
It’s a power tool for cutting cardboard in a way that’s
safe and easy. As far as we can tell, it’s similar in style
to a sheet metal nibbler, and each oscillation of the
cutting head ‘nibbles’ off a small section without
exposing a blade or teeth. This means that it should
be very difficult to hurt yourself with it.
At $189, it’s not the cheapest way of cutting
cardboard. But this should still be within reach of
many craft centres and maker spaces (and a lot
cheaper than a laser cutter, which is something we’ve
resorted to in the past).
We’ve not used this, so can’t comment on how
well it works but, as far as we can see, the principle
behind it is straightforward and it looks like it should
be possible.

96
BUYER
BEWARE !
When backing a crowdfunding
campaign, you are not purchasing
a finished product, but supporting
a project working on something
new. There is a very real chance
that the product will never ship
and you’ll lose your money. It’s
a great way to support projects
you like and get some cheap
hardware in the process, but if
you use it purely as a chance to
snag cheap stuff, you may find
that you get burned.

Above
Build your
projects out of
old packaging

97
#73 ON SALE
23 NOVEMBER

ROBOTS
ALSO
RASPBERRY PI 5
3D PRINTING
MICROPYTHON
KICAD
AND MUCH MORE

DON’T MISS OUT

hsmag.cc/subscribe
Stereovision
Raspberry Pi 5 comes with two camera ports. You can use them for all
sorts of things, such as getting images from two different types of camera
(like many smartphones do) and capturing data in different directions.
However, our favourite use of them so far is taking stereoscopic images.
These allow you to capture 3D images. You can process these to
produce depth maps or even process them so you can view the images
using red/cyan glasses.
PiKVM Manage your servers or
workstations remotely

A cost-effective solution for data-centers,


IT departments or remote machines!

PiKVM HAT
for DIY and custom projects Pre-Assembled version

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

Available at the main Raspberry Pi resellers

Reseller suggestions and inquiries:


wholesale@hipi.io

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy