Tag Archives: The MagPi

The Official Raspberry Pi Handbook 2022

via Raspberry Pi

Get the Official Raspberry Pi Handbook 2022 right now! Over 200 pages of Raspberry Pi projects, tutorials, tips, and reviews.

Official Raspberry Pi Handbook 2022

Hey folks, Rob from The MagPi here. It’s been a while! I hope you’re doing well.

We’ve been on double duty this month. As well as making an amazing new issue of The MagPi (out next week), we’ve also put together a brand new book: the Official Raspberry Pi Handbook 2022, which is on sale now!

Official Raspberry Pi Handbook 2022

Packed with projects

The new Handbook is crammed full of incredible community projects, some of our best build guides, an introduction to Raspberry Pi Pico, and reviews of cool Raspberry Pi kits and accessories – all stuffed into 200 pages. Here are some highlights from the book:

Official Raspberry Pi Handbook 2022

Lunchbox Arcade Game – make lunchtime far more exciting by busting out some Street Fighter II and having someone eat your hadoukens. Make sure to eat between rounds for maximum satisfaction.

We Still Fax – one part escape room, one part performance theatre, this relic of office technology has been hacked with a Raspberry Pi to be the centrepiece of a special show in your own living room.

iPod Classic Spotify Player – using a Raspberry Pi Zero W, this old-school iPod has been upgraded with Spotify access. The interface has even been recreated to work the same way as the old iPod, scroll wheel and all.

Official Raspberry Pi Handbook 2022

Play classic console games legally on Raspberry Pi – there are a surprising number of ways to get legal ROMs for Raspberry Pi-powered consoles, as well as a plethora of modern games made for the older hardware.

Build the ultimate media centre – get TV, movies, games, streaming, music, and more on one incredible Raspberry Pi build. It looks good too, thanks to the excellent case.

Stellina – this automated telescope is powered by Raspberry Pi and connects to a tablet to look at planets and other distant celestial objects.

… And much, much more!

Official Raspberry Pi Handbook 2022

Where can I buy it?

You can grab the Official Raspberry Pi Handbook 2022 from our online store, from our Android and iOS app, and in the real world at some newsagents. It will make an excellent stocking stuffer in a few months time. You can also get the PDF free from our website.

Until next time, take care of yourselves!

Official Raspberry Pi Handbook 2022

The post The Official Raspberry Pi Handbook 2022 appeared first on Raspberry Pi.

Humane mouse trap | The MagPi #108

via Raspberry Pi

Safely catching mice is a better way of fixing a problem, and using Raspberry Pi means it needs less supervision. In the new issue of The MagPi magazine, Rob Zwetsloot takes a look with the maker, Andrew Taylor.

With some IoT projects, it’s the little things that help. For example, take Andrew Taylor, who did the good thing of setting up a humane mousetrap. However, checking it to see if any mice had been caught in it, while necessary, was getting a little boring.

There’s one major component to the setup, which is the PIR sensor

“If a mouse had gone in and I did not check it, the mouse would quickly run out of food and water!” Andrew tells us. “Having been interested in Raspberry Pi for a couple of years and having recently begun learning Python using the Enviro+ environment sensors, I figured a Raspberry Pi with a motion sensor would be an ideal way to check.”

It’s a fairly simple setup, one commonly used in CCTV builds and some fun ‘parent detectors’ on the Raspberry Pi Foundation’s projects site.

An old coffee tub is used as a case for the sensor, a good way to recycle

Mouse motion

“I came across a couple of automated mousetraps that people had made from scratch, but wanting to keep it simple and cheap,” Andrew explains. “I wanted to use off-the-shelf parts where possible and keep costs down. The Pi Hut had a tutorial for a DIY burglar alarm utilising a PIR sensor, IFTTT, and Pushbullet, which seemed like an ideal starting point.”

A Raspberry Pi Zero is used to check the motion sensor and send data if it’s activated

IFTTT – If This Then That – is an online service popular with IoT folks. It’s great for small things like cross-posting images on social media services, or sending a push notification when motion is detected in a mousetrap.

“I have only had one mouse since, but it worked!” Andrew says. “I was averaging about 800 detections a day and suddenly got well over a 1000. Sure enough, there was a mouse in the trap which I released shortly afterwards. I do tend to notice that the values fluctuate a bit, so it is always worth checking over the previous day’s results to see if it is notably higher.”

Wiring up the PIR to Raspberry Pi is quite simple, and means the project is easy to maintain

You might think that 800 push notifications a day is far worse than just occasionally checking your garage, and you’d be right, so Andrew tweaked the code a bit: “The code examples I found sent a notification for each movement detection – which I knew would be rather annoying, considering how randomly PIR sensors sometimes seem to trigger. My script instead logs any hits at a max of 1 per 30 seconds and then triggers a notification once every 24 hours, meaning I just get one notification a day.”

It’s a simple design, and was kept simple to keep to a small budget

Beat a path

There’s always room for improvement, as Andrew explains: “I intend to improve the code so that it can record running averages and give an indication as to whether it believes there has been a significant spike that might necessitate me checking it out.”

The first successful capture was released back outside the garage

Whilst the aim of the project was to keep costs down, Andrew is tempted to experiment by adding a camera, and possibly a light, so he can have a peek remotely when there has been a spike in the readings and to see if it is a false alarm. Which, as he admits, is “a new height in laziness!”

The MagPi #108 out NOW!

You can grab the brand-new issue right now from the Raspberry Pi Press store, or via our app on Android or iOS. You can also pick it up from supermarkets and newsagents. There’s also a free PDF you can download.

The post Humane mouse trap | The MagPi #108 appeared first on Raspberry Pi.

Bluebot Shoal Fish Robot

via Raspberry Pi

If you loved the film Finding Dory, you might just enjoy the original story of these underwater robots, fresh out of the latest issue of The MagPi Magazine.

It’s no coincidence that the shoal of robot fish in this Raspberry Pi Zero W project look more than a little like Dory from Pixar’s movie. As with the film character, the Bluebot robot fish are based on the blue tang or surgeonfish. Unlike Dory, however, these robot fish are designed to be anything but loners. They behave collectively, which is the focus of the Blueswarm research project that began in 2016 at Harvard University.

Linked cameras attached to Raspberry Pi Zero W monitor what surrounding fish are doing. The Bluebot robot then mimics their behaviour, such as moving its fins
The Blueswarm team designed a PCB and wrote custom Python code for their subterranean Raspberry Pi experiments

Florian Berlinger and his PhD research project colleagues Radhika Nagpal, Melvin Gauci, Jeff Dusek, and Paula Wulko set out to investigate the behaviour of a synchronised group of underwater robots and how groups of such robot fish are co‑ordinated by observing each other’s movements. In the wild, birds, fish, and some animals co-ordinate in this way when migrating, looking for food and as a means of detecting and collectively avoiding predators. Simulations of such swarm behaviour exist, but Blueswarm has the additional challenge of operating underwater. Raspberry Pi Zero W works well here because multiple Bluebot robots can be accessed remotely over a secure wireless connection, and Raspberry Pi Zero W is physically small and light enough to fit inside a palm-sized robot. 

Mimicking movements

The team designed the fish-inspired, 3D-printed robot body as well as the fin-like actuators and the on-board printed circuit board which connects to all the electronics and communicates with Raspberry Pi Zero W. Designing the robot fish took the team four years, from working out how each robot fish would move and adding sensing capabilities, to refining the design and implementing collective behaviours, coded using Python 3. 

The Blueswarm team designed a PCB and wrote custom Python code for their subterranean Raspberry Pi experiments
The Blueswarm team designed a PCB and wrote custom Python code for their subterranean Raspberry Pi experiments

They used as many off-the-shelf electronics as possible to keep the robots simple, but adapted existing software algorithms for the purposes of their investigations, “with several clever twists on existing algorithms to make them run fast on Raspberry Pi,” adds Florian. 

On-board cameras that offer “an amazing 360-degree field of view” are one of the project’s real triumphs. These cameras are connected to Raspberry Pi via a duplexer board (so two cameras can operate as one) the project team co-designed with Arducam. Each Raspberry Pi Zero W inside follows the camera images and instructs the fins to move accordingly. The team developed custom algorithms for synchronisation, flocking, milling, and search behaviours to simulate how real fish move individually and as a group. As a result, says Florian, “Blueswarm can be used to study inter-robot co-ordination in the laboratory and to learn more about collective intelligence in nature.” He suggests other robot-based projects could make use of a similar setup. 

Imitation of life

Each robot fish cost around $250 and took approximately six hours to make. To make your own, you’d need a 3D printer, Raspberry Pi Zero W, a soldering station – and a suitably large tank for your robot shoal! Although the team hasn’t made the code available, the Blueswarm project paper has recently been published in Science Robotics and by the IEEE Robots and Automation Society. Several biology researchers have also been using the Bluebot shoal as ‘fish surrogates’ in their studies of swimming and schooling.

It may look cute, but Bluebot has a serious purpose
It may look cute, but Bluebot has a serious purpose

The MagPi #107 out NOW!

MagPi 107 cover

You can grab the brand-new issue right now from the Raspberry Pi Press store, the Raspberry Pi Store, Cambridge, or via our app on Android or iOS. You can also pick it up from supermarkets and newsagents. There’s also a free PDF you can download.

The post Bluebot Shoal Fish Robot appeared first on Raspberry Pi.

Get outside with these Raspberry Pi summer projects

via Raspberry Pi

Summer is fast approaching – and that’s the perfect excuse to get building. Whether you want to spy on your local wildlife, upgrade your vegetable patch, or feed your fish when you’re off on a weekend break, Raspberry Pi and a handful of add-ons make a great starting point. The latest issue of The MagPi is packed with some of the most inspirational projects to be found. They include a smart tide monitor, which will tell you when’s the best time to hit the beach, and a clever Heater Meter that can keep an eye on your barbecue while you get on with the prep in the kitchen.

Check the tides

Avoid nasty surprises when you arrive at the beach: check the tide level before you leave home
Avoid nasty surprises when you arrive at the beach: check the tide level before you leave home

If you’re heading out for any kind of water-based activity (and that includes sitting on the beach), it helps to know whether the tide is in or out and which way it’s heading. Sam Baker’s neat e-ink tide and weather tracker uses Raspberry Pi Zero and an enormous (7.5 in) e-ink display to track the motion of the ocean and upcoming weather conditions, so you don’t arrive at the beach to find the sand submerged.

Print your own lawn-mower

The return of summer means an addition to your weekly to-do list: mowing the lawn. But not if you build a PiMowBot smart lawn-mower robot. This uses any Raspberry Pi to control an autonomous lawnmower that navigates your garden using GPS and offers optional remote control, so you can keep the lawn trimmed from the comfort of a garden chair.

Sit back, put your feet up, and enjoy the sunshine while PiMowBot takes care of mowing your lawn
Sit back, put your feet up, and enjoy the sunshine while PiMowBot takes care of mowing your lawn

The hardware, comprising the chassis, cutterbar and so on, is solar-powered and can be 3D-printed, while the software is a €19.99 download. The OBJ (Wavefront OBJect) file patterns for the various parts you’ll need to print are a £29.46 download from Cults3d. You’ll need to buy several components to put it together, as it also relies on a number of sensors, including – aside from the GPS receiver – a temperature and humidity sensor, compass module, and Camera Module.

Although you do need to invest in quite a few parts for the PiMowBot, and spend time assembling them, the project still manages to undercut (sorry!) commercial alternatives, for which prices start at around £500, by a considerable margin.

BBQ safely

One thing that’s certain to put a dampener on a summer get-together is barbecued food that’s charred on the outside and raw in the middle. Fortunately, a lot of makers have set themselves the task of solving this problem – which they’ve done with aplomb. Tempiture pairs Raspberry Pi with a breadboard, food probe, and a handful of resistors to produce a wireless grilling thermometer which sends readings to the web. As a barbecue can take hours to get to cooking temperature, this lets you keep an eye on its progress while you’re prepping food in the kitchen.

HeaterMeter lets you keep an eye on your BBQ from a distance, freeing you to get on with prep in the kitchen while the HeaterMeter maintains cooking temperatures
HeaterMeter lets you keep an eye on your BBQ from a distance, freeing you to get on with prep in the kitchen while the HeaterMeter maintains cooking temperatures

It’s not your only option, either. PitmasterPi performs a very similar job, taking regular readings to populate a real-time dashboard, and optionally sending emails or texts at crucial moments.

HeaterMeter pairs Raspberry Pi with an Adruino microcontroller, thermal probe, and fan to maintain perfect temperatures, with support for web streaming, graphing, and alerts. What’s particularly appealing about HeaterMeter is that you can choose different starting points for your project, depending on how confident you are. If you’re a dab hand at soldering and reading a circuit diagram, start from scratch with a kit; but if you’re just craving a burger, skip all that and opt for a fully assembled board instead.

Build a trail camera

The Naturebytes camera case keeps all the components of an automated bird and wildlife camera neat and tidy
The Naturebytes camera case keeps all the components of an automated bird and wildlife camera neat and tidy

One of the best things about summer is the return of a host of migratory birds that desert us in the colder months. And, while foxes and badgers will have been with us throughout the winter, hedgehogs will have been hibernating between late autumn and early spring. Many of these animals are timid, so spotting them requires that you get up early, stay up late, or set up a trail camera which uses motion detection to capture an image when they pass.

This has been a popular use for Raspberry Pi for years, but there are so many ways to go about it, you might be wondering which are the best options. You can pick up all the parts you need to build your own trail camera – aside from the power supply – from The Pi Hut for £110, or the case on its own for £40 if you have most of the other required components knocking around from old projects.

Get your copy of The Magpi #106 now!

We’ve shared just a few of our favourite summer project ideas here. For the full list, head to page 72 of the latest issue of The MagPi.

magpi magazine issue 106 cover

You can grab the brand-new issue right now online from the Raspberry Pi Press store, or via our app on Android or iOS. You can also pick it up from supermarkets and newsagents. There’s also a free PDF you can download.

The post Get outside with these Raspberry Pi summer projects appeared first on Raspberry Pi.

Calculate pi with a Raspberry Pi Spigot | The MagPi #106

via Raspberry Pi

Here’s an ingenious way of using a Raspberry Pi to calculate pi – and why not? Nicola King runs the numbers in the latest issue of The MagPi magazine.

Pi is an irrational number, which means it can’t be expressed as the ratio of two integers. Since it has an infinite number of decimal places, calculating it to ever greater accuracy has long been an objective of mathematicians. So what better project for Pi Day (14 March) than to get a Raspberry Pi to calculate pi?

You’ll find Adrian on YouTube as bornach

That’s what Adrian Chung reckoned when looking to create a project for a ‘speed round’ contest. “I thought it would be neat to use a Raspberry Pi to compute pi to arbitrarily high precision,” he tells us.

After looking into various methods, he learned about a class of algorithms that differed from the usual summing up of a sequence of decimal approximations. “Intriguingly, these so-called ‘spigot algorithms’ computed the next digit of pi after every few iterations of applying a small set of operations on a handful of integers,” he notes.

Numbers on tap

Rather than simply using a Raspberry Pi to compute pi with a spigot algorithm, Adrian thought it required a more visual approach. “The need for a more visually explicit indication of what was actually running on the Raspberry Pi gave me the idea of creating a physical spigot prop with a tactile check valve that can be used to pause or resume the iterations of the algorithm,” he explains. Upon the user turning the spigot, digits appear to flow from the tap and along an LED matrix display below.

An animation of three LEDs creates the illusion of digits flowing from the tap
An animation of three LEDs creates the illusion of digits flowing from the tap

“The MAX7219 8×8 LED display modules are daisy-chained SPI devices that are hooked up to the SPI interface on Raspberry Pi,” says Adrian. “They are powered directly off the 5V rail; however, I had to add a separate power switch because they power up with all the LEDs turned on and this was pulling down the supply voltage during bootup.”

Three GPIO pins are used to animate the LED drips from the spigot. “The LEDs were cut from a Poundland Christmas decoration. Current is limited by 150 Ω resistors so that the drips don’t appear overly bright against the scrolling display.”

A close-up of the spigot, which is constructed from shiny gold card with a cardboard stand
A close-up of the spigot, which is constructed from shiny gold card with a cardboard stand

A potentiometer in the spigot is connected to two GPIO pins to check the valve position. “This works by using one pin to charge a capacitor through the potentiometer, forming an RC delay, and then timing how long until a logic high is read by the other pin.”

Adjusting the flow

Adrian adapted an existing scrolling text demo script in the luma.led_matrix source code library: “I had to choreograph the dripping LED animation with the previous digits scrolling off to the left and the reveal of a new digit under the spigot.”

He also needed to alter the potentiometer reading script, replacing the simple timing loop with regular system time queries for greater accuracy.

Additional components for the build include resistors, a capacitor, and perfboard
Additional components for the build include resistors, a capacitor, and perfboard

So, how accurately can his Raspberry Pi Spigot calculate pi? “I left it to run for about six hours,” says Adrian. “It computed more than the first 8000 digits. It can compute pi much faster than this, but the animation of the digits streaming from the spigot would just be a blur.

“Because those integer variables in the spigot algorithm only get larger, they continue to consume more and more RAM as more digits are cranked out. I don’t really know how many digits of pi my 1GB Raspberry Pi 2 would have been able to calculate if I had just let it run.”

Whatever the answer, the project has proved a hit with the community: Adrian’s original tweet video has over 10,000 views and was retweeted over 100 times. 

Get your copy of The Magpi #106 now!

magpi magazine issue 106 cover

You can grab the brand-new issue right now from the Raspberry Pi Press store, or via our app on Android or iOS. You can also pick it up from supermarkets and newsagents. There’s also a free PDF you can download.

The post Calculate pi with a Raspberry Pi Spigot | The MagPi #106 appeared first on Raspberry Pi.

Star Wars Arcade Cabinet | The MagPi #105

via Raspberry Pi

Why pay over the odds when you can build an accurate replica, and have fun doing it? For the latest issue of The MagPi Magazine, Rob Zwetsloot switches off his targeting computer to have a look.

header of the arcade cabinet bearing a Star Wars logo
Art had to be rescaled, but it’s been done faithfully

Getting the arcade machine of your dreams gets a little harder every day, especially the older they are. Making one, however, is always possible if you have the right skills and a Raspberry Pi.

“My project was to build a replica, or as close as I could reasonably manage, of the Atari Star Wars arcade cabinet,” James Milroy tells us. “I really wanted to build a cockpit as that’s what I played on in the eighties, but sadly I didn’t have the room to house it, so the compromise was to build a stand-up cabinet instead.”

The workings were simple when it came down to it: Raspberry Pi 3B+ with Pimoroni Picade X HAT. This gives us a power switch, audio amp, buttons, and a joystick if necessary. The replica yoke is interfaced with a USB adapter from the same company
The workings were simple when it came down to it: Raspberry Pi 3B+ with Pimoroni Picade X HAT. This gives us a power switch, audio amp, buttons, and a joystick if necessary. The replica yoke is interfaced with a USB adapter from the same company

Even then, the standard cabinet has a lot of detail, and James really nailed the look of it. Why build it from scratch, though? “Initially, I had toyed with sourcing an original cabinet and restoring it, but soon gave up on that idea after finding it nigh on impossible to source a cabinet here in the UK,” James explains. “Almost all cabinets for sale were located in the USA, so they were out of the question due to the high cost of shipping. Atari only made just over 12,500 cabinets worldwide, so their rarity meant that they commanded top dollar, effectively putting them out of my price range. It was at this point that I decided that if it was going to happen, then I would have to make it myself.”

star wars arcade cabinet full length shot

Making a cabinet is hard enough, but the control system would have to be an original Atari yoke. “The Atari yoke is considered the ‘holy grail’ of controllers and, again, is very hard to find,” James says. “My prayers were answered in October 2018 when a thread on a forum I was subscribed to popped up with a small Utah-based startup aiming to supply replica yokes at a realistic price to the arcade community. I grabbed two of these (one for my friend) and the project was on.”

Good feeling

When it came to actually emulating the game, for James there was only one choice: “My decision to go with a Raspberry Pi was a no-brainer really. I had previously made a bartop cabinet using a Raspberry Pi 3 and RetroPie/EmulationStation which I was really pleased with. So I had a platform that I already had experience with and knew was more than capable of emulating the one game I needed to run. Besides, the simplicity and low cost of the ecosystem for Raspberry Pi far outweighs the extra expense and effort required going down the PC route.”

The riser was a custom build by James that emulates lights from the films
The riser was a custom build by James that emulates lights from the film

With a custom build and emulation, authenticity of the gameplay experience could be a bit off. However, that’s not the case here. “I think that it plays just like the real arcade machine mainly due to the inclusion of the replica yoke controller, and adding your credit by pressing the button on the coin door,” says James. “Ideally a vector monitor or a CRT would go a long way to making it look just like the original, but a reasonable representation is possible on an LCD using shaders and anti-aliasing. Gameplay does seem to get really hard really quick, though; this could be due to an imperfect emulation, but is more likely due to my reactions having dulled somewhat in the last 38 years!”

Always in motion

While the current build is amazing as it is, James does have some ideas to improve it. “Overall, I’m really pleased with the way the cabinet has worked out,” he says. “I will be replacing Raspberry Pi 3B+ with a Raspberry Pi 4 to enable me to run a newer version of MAME which will hopefully offer a better emulation, sort some audio glitching I get with my current setup, and hopefully enable some graphical effects (such as bloom and glow) to make it look more like its running on a CRT.”

Get your copy of The Magpi #105 now!

You can grab the brand-new issue right now online from the Raspberry Pi Press store, or via our app on Android or iOS. You can also pick it up from supermarkets and newsagents, but make sure you do so safely while following all your local guidelines. There’s also a free PDF you can download.

The post Star Wars Arcade Cabinet | The MagPi #105 appeared first on Raspberry Pi.