Tag Archives: Raspberry Pi Zero/Zero W

Wes’s wonderful Minecraft user notification display

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/wess-wonderful-minecraft-user-notification-display/

This Minecraft sign uses a Raspberry Pi to notify you when, and how many of, your friends are logged into your dedicated Minecraft server.

Let’s start by pointing out how wonderfully nostalgic many of Wes ‘Geeksmithing’ Swain’s projects are. From his Raspberry Pi–housing cement Thwomp that plays his favourite Mario games to The NES Project, his NES replica unit with a built-in projector — Wes makes the things we wished for as kids.

The NES Project covered in HackSpace magazine

We honestly wouldn’t be surprised if his next project is a remake of Duckhunt with servo-controlled ducks, or Space Invaders but it’s somehow housed in a flying space invader that shoots back with lasers. Honestly, at this point, we wouldn’t put it past him.

Making the Minecraft friend notification display

In the video, Wes covers the project in two parts. Firstly, he shows off the physical build of making the sign, including laser-cut acrylic front displayed with controllable LED lights, a Raspberry Pi Zero, and the wooden framing.

Secondly, he moves on to the code, in which he uses mcstatus, a Python class created by Minecraft’s Technical Director Nathan Adams that can be used to query servers for information. In this instance, Wes is using mcstatus to check for other players on his group’s dedicated Mincecraft server, but the class can also be used to gather mod information. You can find mcstatus on GitHub.

Each friend is assigned a letter that illuminates if they’re online.

Lucky for Wes, he has the same number of friends on his server as the number of letters in ‘Minecraft’, so for every friend online, he’s programmed the display to illuminate a letter of the Minecraft logo. And while the server is empty, he can also set the display to run through various light displays, including this one, a dedication to the new Minecraft Nether update.

If you’d like to try making this project yourself, you can: Wes goes into great detail in his video, and the code for the project can be found on his GitHub account.

And while we have your attention, be sure to subscribe to Geeksmithing on YouTube and show him some love for such a great project.

The post Wes’s wonderful Minecraft user notification display appeared first on Raspberry Pi.

These loo rolls formed a choir

Post Syndicated from Ashley Whittaker original https://www.raspberrypi.org/blog/these-loo-rolls-formed-a-choir/

Have all of y’all been hoarding toilet roll over recent weeks in an inexplicable response to the global pandemic, or is that just a quirk here in the UK? Well, the most inventive use of the essential household item we’ve ever seen is this musical project by Max Björverud.

Ahh, the dulcet tones of wall-mounted toilet roll holders, hey? This looks like one of those magical ‘how do they do that?’ projects but, rest assured, it’s all explicable.

Max explains that Singing Toilet is made possible with a Raspberry Pi running Pure Data. The invention also comprises a HiFiBerry Amp, an Arduino Mega, eight hall effect sensors, and eight magnets. The toilet roll holders are controlled with the hall effect sensors, and the magnets connect to the Arduino Mega.

In this video, you can see the hall effect sensor and the 3D-printed attachment that holds the magnet:

Max measures the speed of each toilet roll with a hall effect sensor and magnet. The audio is played and sampled with a Pure Data patch. In the comments on his original Reddit post, he says this was all pretty straight-forward but that it took a while to print a holder for the magnets, because you need to be able to change the toilet rolls when the precious bathroom tissue runs out!

Max began prototyping his invention last summer and installed it at creative agency Snask in his hometown of Stockholm in December.

The post These loo rolls formed a choir appeared first on Raspberry Pi.

Track your cat’s activity with a homemade speedometer

Post Syndicated from Ashley Whittaker original https://www.raspberrypi.org/blog/track-your-cats-activity-with-a-homemade-speedometer/

Firstly, hamster wheels for cats are (still) a thing. Secondly, Bengal cats run far. And Shawn Nunley on reddit is the latest to hit on this solution for kitty exercise and bonus cat stats.

Here is the wheel itself. That part was shop-bought. (Apparently it’s a ZiggyDoo Ferris Cat Wheel.)

Smol kitty in big wheel

Shawn has created a speedometer that tracks distance and speed. Every time a magnet mounted on the wheel passes a fixed sensor, a Raspberry Pi Zero writes to a log file so he can see how far and fast his felines have travelled. The wheel has six sensors, which each record 2.095 ft of travel. This project revealed the cats do about 4-6 miles per night on their wheel, and they reach speeds of 14 miles an hour.

Here’s your shopping list:

  • Raspberry Pi
  • Reed switch (Shawn got these)
  • Jumper wires
  • Ferris cat wheel

The tiny white box sticking out at the base of the wheel is the sensor

Shawn soldered a 40-pin header to his Raspberry Pi Zero and used jumper wires to connect to the sensor. He mounted the sensor to the cat wheel using hot glue and a pill box cut in half, which provided the perfect offset so it could accurately detect the magnets passing by. The code is written in Python.

Upcoming improvements include adding RFID so the wheel can distinguish between the cats in this two-kitty household.

Shawn also plans to calculate how much energy the Bengals are expending, and he’ll soon be connecting the Raspberry Pi to their Google Cloud Platform account so you can all keep up with the cats’ stats.

The stats are currently available only locally

And, get this – this was Shawn’s first ever time doing anything with Raspberry Pi or Python. OK, so as an ex-programmer he had a bit of a head start, but he assures us he hasn’t touched the stuff since the 1990s. He explains: “I was totally shocked at how easy it was once I figured out how to get the Raspberry Pi to read a sensor.” Start to finish, the project took him just one week.

The post Track your cat’s activity with a homemade speedometer appeared first on Raspberry Pi.

Create your own home office work status light with Raspberry Pi

Post Syndicated from Ashley Whittaker original https://www.raspberrypi.org/blog/create-your-own-home-office-work-status-light-with-raspberry-pi/

If you’re working from home and you have children, you’re probably finding it all pretty demanding at the moment. Spreadsheets and multiple tabs and concentrating aren’t nearly so manageable without the dedicated workspace you have at the office and with, instead, small people vying relentlessly for your attention.

And that’s not to mention the horror that is arranging video conference calls and home life around one another. There’s always the danger that a housemate (young offspring or otherwise) might embarrassingly crash your formal party like what happened to Professor Robert Kelly live on BBC News. (See above. Still funny!)

Well, Belgian maker Elio Struyf has created a homemade solution to mitigate against such unsolicited workspace interferences: he built a status light that integrates with Microsoft Teams so that his kids know when he’s on a call and they should stay away from his home office.

DIY busy light created with Raspberry Pi and Pimoroni Unicorn pHAT

The light listens to to Elio’s Microsoft Teams status and accordingly displays the colour red if he’s busy chatting online, yellow if his status is set to ‘Away’, or green if he’s free for his kids to wander in and say “Hi”.

Here’s what you need to build your own:

The Pimoroni Unicorn pHAT has an 8×4 grid of RGB LEDs that Elio set to show a single colour (though you can tell them to display different colours). His Raspberry Pi runs DietPi, which is a lightweight Debian distro. On top of this, running Homebridge makes it compatible with Apple’s HomeKit libraries, which is how Elio was able to connect the build with Microsoft Teams on his MacBook.

Elio’s original blog comprehensively walks you through the setup process, so you too can try to manage your home working plus domestic duties. All you need is to get your five-year-old to buy into your new traffic-light system, and with that we wish you all the luck in the world.

And give Elio a follow on Twitter. Fella has mad taste in T-shirts.

The post Create your own home office work status light with Raspberry Pi appeared first on Raspberry Pi.

Resurrecting a vintage microwave sensor with Raspberry Pi

Post Syndicated from Ashley Whittaker original https://www.raspberrypi.org/blog/resurrecting-a-vintage-microwave-sensor-with-raspberry-pi/

Here’s one of those lovely “old tech new spec” projects, courtesy of hackster.io pro Martin Mander.

After finding a vintage Apollo microwave detector at a car boot sale, and realising the display hole in the top was roughly the same size as a small Adafruit screen, he saw the potential to breath new life into its tired exterior. And resurrected it as a thermal camera!

Right up top – the finished product!

Martin assumes it would have been used to test microwave levels in some kind of industrial setting, given microwave ovens were a rarity when it was produced.

Old components stripped and ready for a refit

Anyhow, a fair bit of the original case needed to be hacked at or sawn off to make sure all the new components could fit inside.  A Raspberry Pi Zero provides the brains of the piece. Martin chose this because he wanted to run the scipy python module to perform bicubic interpolation on the captured data, making the captured images look bigger and better. The thermal sensor is an Adafruit AMG8833IR Thermal Camera Breakout, which uses an 8×8 array of sensors to create the heat image.

The tiny but readable display screen

The results are displayed in real time on a bright 1.3″ TFT display. Power comes from a cylindrical USB battery pack concealed in the hand grip, which is recharged by opening up the nose cone and plugging in a USB lead. Just three Python scripts control the menu logic, sensor, and Adafruit.io integration, with the display handled by PyGame.

It gets better: with the click of a button, a snapshot of whatever the thermal camera is looking at is taken and then uploaded to an Adafruit dashboard for you to look at or share later.

Sensor and screen wired up

Martin’s original post is incredibly detailed, walking you through the teardown of the original piece, the wiring, how to tweak all the code and, of course, how he went about giving it that fabulous BB-8 orange-and-white makeover. He recorded the entire process in this 24-minute opus:

Apollo Pi Thermal Camera

This vintage Apollo microwave detector now has a shiny new purpose as a thermal camera, powered by a Raspberry Pi Zero with an Adafruit thermal camera sensor…

But what can you actually do with it? Martin’s suggestions range from checking your beer is cold enough before opening it, to testing your washing machine temperature mid-cycle. If you watch his video, you’ll see he’s also partial to monitoring cat tummy temperatures. His kid doesn’t like having his forehead Apollo Pi’d though.

Check out more of Martin’s projects on hackster.io.

The post Resurrecting a vintage microwave sensor with Raspberry Pi appeared first on Raspberry Pi.

Stay busy in your Vault with a Raspberry Pi Zero Pipboy

Post Syndicated from Ashley Whittaker original https://www.raspberrypi.org/blog/raspberry-pi-fallout-pipboy/

While being holed up in the Vaults living off our stash of Nuke cola, we’ve come across this mammoth junk-build project, which uses Raspberry Pi Zero W to power a working Pipboy.

Pipboy scrap build

No Description

UK-based JustBuilding went full Robert House and, over several months, built the device’s body by welding together scrap plastic. Raspberry Pi Zero W serves as the brain, with a display header mounted to the GPIO pins. The maker wrote a Pipboy-style user interface, including demo screens, in Python — et voilà…



Lucky for him, semiconductors were already invented but, as JustBuilding admits, this is not what we’d call a beginner’s project. Think the Blue Peter show’s Tracey Island extravaganza, except you don’t have crafty co-presenters/builders, and you also need to make the thing do something useful (for our US readers who just got lost there, think Mr Rogers with glitter glue and outdoor adventure challenges).

The original post on Instructables is especially dreamy, as JustBuilding has painstakingly produced a really detailed, step-by-step guide for you to follow, including in-the-making photos and links to relevant Raspberry Pi forum entries to help you out where you might get stuck along the way.

And while Raspberry Pi can help you create your own post-apocalyptic wristwear, we’re still working on making that Stealthboy personal cloaking device a reality…

If you’re lucky enough to have access to a 3D printer, the following is the kind of Pipboy you can knock up for yourself (though we really like JustBuilding’s arts’n’crafts upcycling style):

3D Printed Pipboy 3000 MKIV with Raspberry Pi

Find out how to 3D print and build your own functional Pipboy 3000 using a Raspberry Pi and Adafruit 3.5″ PiTFT. The pypboy python program for the Raspberry …

The post Stay busy in your Vault with a Raspberry Pi Zero Pipboy appeared first on Raspberry Pi.

Building a split mechanical keyboard with a Raspberry Pi Zero controller

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/building-a-split-mechanical-keyboard-with-a-raspberry-pi-zero-controller/

Looking to build their own ergonomic mechanical split keyboard, Gosse Adema turned to the Raspberry Pi Zero W for help.

So long, dear friend

Gosse has been happily using a Microsoft Natural Elite keyboard for years. You know the sort, they look like this:

Twenty years down the line, the keyboard has seen better days and, when looking for a replacement, Gosse decided to make their own.

This is my the first mechanical keyboard project. And this will be for daily usage. Although the possibilities are almost endless, I limit myself to the basic functionality: An ergonomic keyboard with mouse functions.

Starting from scratch

While searching for new switched, Gosse came across a low-profile Cherry MX that would allow for a thinner keyboard. And what’s the best device to use when trying to keep the profile of your project as thin as possible? Well, hello there, Raspberry Pi Zero W, aren’t you looking rather svelte today.

After deciding to use a Raspberry Pi as the keyboard controller over other common devices, Gosse took inspiration from an Adafruit tutorial on turning Raspberry Pi into a USB gadget, and from “the usbarmory Github page of Chris Kuethe”, which describes how to create a USB gadget with a keyboard.

Build your own

There is a lot *A LOT* of information on how Gosse built the keyboard on Instructables and, if we try to go into any detail here, our word count is going to be in the thousands. So, let’s just say this: the project uses some 3D printing, some Python code, and some ingenuity to create a lovely-looking final keyboard. If you want to make your own, Gosse has provided absolutely all the information you need to do so. So check it out, and be sure to give Gosse some love via the comments section on Instructables.

Mechanical keyboards

Also, if you’re unsure of how a mechanical keyboard differs from other keyboards, we made this handy video for you all!

How do mechanical keyboards work?

So, what makes a mechanical keyboard ‘mechanical’? And why are some mechanical keyboards more ‘clicky’ than others? Custom PC’s Edward Chester explains all. …

The post Building a split mechanical keyboard with a Raspberry Pi Zero controller appeared first on Raspberry Pi.

Make a hamster feeder with Raspberry Pi Zero

Post Syndicated from Helen Lynn original https://www.raspberrypi.org/blog/make-a-hamster-feeder-with-raspberry-pi-zero/

People make marvellous things for their pets with Raspberry Pi. Here’s a splendid hamster feeder tutorial from Christopher Barnatt of Explaining Computers, just perfect if you’re after a small project for this weekend.

Raspberry Pi Zero Hamster Feeder

Raspberry Pi servo-controlled pet feeder, using a Raspberry Pi Zero and two SG90 servo motors. This project builds on the servo control code and setup from m…

All you need to build your hamster feeder is a Raspberry Pi Zero and peripherals, a couple of servos, some plasticard, sellotape and liquid polyadhesive, and some jumper wires. The video takes you very clearly through the entire set-up, from measurements to wiring details to Python code (which is available to download). As Christopher explains, this will allow you to feed your hamster controlled portions of food at suitable intervals, so that it doesn’t eat the lot in one go and, consequently, explode. What’s not to love?

Check out the Explaining Computers YouTube channel for more clear, detailed videos to help you do more with computing. And for more Raspberry Pi projects, head to our own Raspberry Pi projects, with hundreds of ideas for beginners and beyond available in English and many other languages.

The post Make a hamster feeder with Raspberry Pi Zero appeared first on Raspberry Pi.

Build a Raspberry Pi Zero W Amazon price tracker

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/build-a-raspberry-pi-zero-w-amazon-price-tracker/

Have you ever missed out on a great deal on Amazon because you were completely unaware it existed? Are you interested in a specific item but waiting for it to go on sale? Here’s help: Devscover’s latest video shows you how to create an Amazon price tracker using Raspberry Pi Zero W and Python.

Build An Amazon Price Tracker With Python

Wayne from Devscover shows you how to code a Amazon Price Tracker with Python! Get started with your first Python project. Land a job at a big firm like Google, Facebook, Twitter or even the less well known but equally exciting big retail organisations or Government with Devscover tutorials and tips.

By following their video tutorial, you can set up a notification system on Raspberry Pi Zero W that emails you every time your chosen item’s price drops. Very nice.

Devscover’s tutorial is so detailed that it seems a waste to try and summarise it here. So instead, why not make yourself a cup of tea and sit down with the video? It’s worth the time investment: if you follow the instructions, you’ll end up with a great piece of tech that’ll save you money!

Remember, if you like what you see, subscribe to the Devscover YouTube channel and give them a thumbs-up for making wonderful Raspberry Pi content!

The post Build a Raspberry Pi Zero W Amazon price tracker appeared first on Raspberry Pi.

Cats and lasers and (Raspberry) Pi, OH MY!

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/cats-and-lasers-and-raspberry-pi-oh-my/

Keeping a modern cat entertained requires something more high-tech than a ball of yarn. The MagPi’s Phil King wonders if this is a purr-fect project…

WARNING! LASER EYE! Don’t look into a laser beam, and don’t point a laser beam at a somebody’s head. For more on things you SHOULDN’T do with a laser, visit magpi.cc/lasersafety.

Xander the cat is a much-loved family pet, but as his owners live in a flat, he can get a little bored staying indoors when they’re out at work. Seeking a way to keep his cat entertained, Enzo Calogero came up with an ingenious Raspberry Pi–powered project. “We noticed that he loves to chase a laser light, so we decided to create a device to make laser games for him,” explains Enzo.

The result is the Tri-Lasers for Felines device which, when the cat’s presence is detected by a PIR motion sensor, beams a laser dot around the room for Xander to chase between randomly generated points. Judging by the video on the project’s Hackster tutorial page, he seems to love it.

trilaser

This video is about trilaser

Pan and tilt

The laser’s main movement trajectory is handled by mounting it on a Pan-Tilt HAT, which has vertical and horizontal servo motors. “A pair of coordinates (x, y) is generated randomly,” explains Enzo. “The laser point moves from the current point to a new coordinate, following the segment that connects the two points, at a speed defined by a status variable. Once the new coordinates are reached, we loop back to point one.”

To add extra interest for Xander, its movement is randomised further by switching between three laser diodes to perform micro random movements very quickly. “Switching the active laser among the three allows extremely rapid movements of the laser dot, to create an extra variability of the light trajectories which seems more enjoyable for the cat,” says Enzo.

While the laser point is visible in daylight, it shows up better when there’s less light: “Xander prefers it when the room is completely dark.”

The device’s three laser diodes are set into a 3D-printed triangular holder that sits atop the Pan-Tilt HAT’s acrylic mount — which would normally be used to hold a Camera Module. Enzo also designed and 3D-printed a case for the PIR sensor.

Cat-a-log

In addition to handling laser movement, the Python script saves a log of Xander’s activity: “We check it now and then out for curiosity,” says Enzo. “When Xander was a kitten, he was playing with it very often. Now he is a bit older and much more prone to sleep rather than play, we switch it on when we are out in the evening to keep him busy during our prolonged absence.”

One issue that came up is that, being naturally curious animals, cats are prone to investigate any new objects. “We try to put it as high and unreachable as possible, but cats are extremely skilled,” says Enzo. “So, he was able to reach the device few times. And the best way to save the device from cat attacks is to make it as still as possible, so the cat loses interest.”

Therefore a tilt sensor was added to the device, to cause it to shut down if triggered by an inquisitive Xander, thus reducing the risk of damage.

This isn’t the only feline-focused project from Enzo, who has also built an IoT food scale to monitor when and how much Xander eats, sending the data to a Google Cloud online dashboard. He’s now working on a wheeled robot to track the cat with a camera and perform a few interactions — we wonder what Xander will make of that.

More from The MagPi

The MagPi magazine is available from newsagents in the UK, Barnes & Noble in the US, the Raspberry Pi Store here in Cambridge, and online in the Raspberry Pi Press store.

This month’s issue comes with a free stand for your Raspberry Pi 4. Yay!

A note from Alex regarding cats and lasers

Some cats don’t like lasers. They find it far too upsetting when they can’t catch what it is they’re chasing. If your cat starts to pant while chasing lasers, don’t assume it’s just exhausted. Panting can be a sign of stress in cats, and stressed is something your cat shouldn’t be. Exercise caution when playing with your cat and laser toys, and consult a vet if you’re unsure whether their behaviour is normal.

Signed,

The owner of a cat who doesn’t like laser toys

The post Cats and lasers and (Raspberry) Pi, OH MY! appeared first on Raspberry Pi.

Protect your veggies from hail with a Raspberry Pi Zero W

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/protect-your-veggies-from-hail-with-a-raspberry-pi-zero-w/

Tired of losing vegetable crops to frequent summertime hail storms, Nick Rogness decided to build something to protect them. And the result is brilliant!

Digital Garden with hail protection

Tired of getting your garden destroyed by hail storms? I was, so I did something about it…maker style!

“I live in a part of the country where hail and severe weather are commonplace during the summer months,” Nick explains in his Hackster tutorial. “I was getting frustrated every year when my wife’s garden was get demolished by the nightly hail storms losing our entire haul of vegetable goodies!”

Nick drew up plans for a solution to his hail problem, incorporating liner actuators bolted to a 12ft × 12ft frame that surrounds the vegetable patch. When a storm is on the horizon, the actuators pull a heavy-duty tarp over the garden.

Nick connected two motor controllers to a Raspberry Pi Zero W. The Raspberry Pi then controls the actuators to pull the tarp, either when a manual rocker switch is flipped or when it’s told to do so via weather-controlled software.

“Software control of the garden was accomplished by using a Raspberry Pi and MQTT to communicate via Adafruit IO to reach the mobile app on my phone,” Nick explains. The whole build is powered by a 12V Marine deep-cycle battery that’s charged using a solar panel.

You can view the full tutorial on Hackster, including the code for the project.

The post Protect your veggies from hail with a Raspberry Pi Zero W appeared first on Raspberry Pi.

IoT ugly Christmas sweaters

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/iot-ugly-christmas-sweaters/

If there’s one thing we Brits love, it’s an ugly Christmas sweater. Jim Bennett, a Senior Cloud Advocate at Microsoft, has taken his ugly sweater game to the next level by adding IoT-controlled, Twitter-connected LEDs thanks to a Raspberry Pi Zero.

IoT is Fun for Everyone! (Ugly Sweater Edition)

An Ugly Sweater is great-but what’s even better (https://aka.ms/IoTShow/UglySweater) is an IoT-enabled Ugly Sweater. In this episode of the IoT Show, Olivier Bloch is joined by Jim Bennett, a Senior Cloud Advocate at Microsoft. Jim has built an Ugly Sweater using Azure IoT Central, Microsoft’s IoT app platform, and a Raspberry Pi Zero.

Jim upgraded his ugly sweater to become IoT-compatible using Microsoft’s IoT app platform Azure IoT Central, Adafruit’s programmable NeoPixel LED Dots Strand and, of course, our sweet baby, the Raspberry Pi Zero W.

After sewing the LED strand into the ugly sweater and connecting it to Raspberry Pi Zero, Jim was able to control the colour of the LEDs. Taking it one step further, he then built a list of commands within Azure IoT Central and linked the Raspberry Pi Zero to a Twitter account to create the IoT element of the project.

Watch the video above for full details on the project, and find all the code on Github.

The post IoT ugly Christmas sweaters appeared first on Raspberry Pi.

Listen to World War II radio recordings with a Raspberry Pi Zero

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/listen-to-world-war-ii-radio-recordings-with-a-raspberry-pi-zero/

With the 50th anniversary of the D-Day landings very much in the news this year, Adam Clark found himself interested in all things relating to that era. So it wasn’t long before he found himself on the Internet Archive listening to some of the amazing recordings of radio broadcasts from that time. In this month’s HackSpace magazine, Adam details how he built his WW2 radio-broadcast time machine using a Raspberry Pi Zero W, and provides you with the code to build your own.

As good as the recordings on the Internet Archive were, it felt as if something was missing by listening to them on a modern laptop, so I wanted something to play them back on that was more evocative of that time, and would perhaps capture the feeling of listening to them on a radio set.

I also wanted to make the collection portable and to make the interface for selecting and playing the tracks as easy as possible – this wasn’t going to be screen-based!

Another important consideration was to house the project in something that would not look out of place in the living room, and not to give away the fact that it was being powered by modern tech.

So I came up with the idea of using an original radio as the project case, and to use as many of the original knobs and dials as possible. I also had the idea to repurpose the frequency dial to select individual years of the war and to play broadcasts from whichever year was selected.

Of course, the Raspberry Pi was immediately the first option to run all this, and ideally, I wanted to use a Raspberry Pi Zero to keep the costs down and perhaps to allow expansion in the future outside of being a standalone playback device.

Right off the bat, I knew that I would have a couple of obstacles to overcome as the Raspberry Pi Zero doesn’t have an easy way to play audio out, and I also wanted to have analogue inputs for the controls. So the first thing was to get some audio playing to see if this was possible.

Audio playback

The first obstacle was to find a satisfactory way to playback audio. In the past, I have had some success using PWM pins, but this needs a low-pass filter as well as an amplifier, and the quality of audio was never as good as I’d hoped for.

The other alternative is to use one of the many HATs available, but these come at a price as they are normally aimed at more serious quality of audio. I wanted to keep the cost down, so these were excluded as an option. The other option was to use a mono I2S 3W amplifier breakout board – MAX98357A from Adafruit – which is extremely simple to use.

As the BBC didn’t start broadcasting stereo commercially until the late 1950s, this was also very apt for the radio (which only has one speaker).
Connecting up this board is very easy – it just requires three GPIO pins, power, and the speaker. For this, I just soldered some female jumper leads to the breakout board and connected them to the header pins of the Raspberry Pi Zero. There are detailed instructions on the Adafruit website for this which basically entails running their install script.

I’d now got a nice playback device that would easily play the MP3 files downloaded from archive.org and so the next task was to find a suitable second-hand radio set.

Preparing the case

After a lot of searching on auction sites, I eventually found a radio that was going to be suitable: wasn’t too large, was constructed from wood, and looked old enough to convince the casual observer. I had to settle for something that actually came from the early 1950s, but it drew on design influences from earlier years and wasn’t too large as a lot of the real period ones tended to be (and it was only £15). This is a fun project, so a bit of leeway was fine by me in this respect.

When the radio arrived, my first thought as a tinkerer was perhaps I should get the valves running, but a quick piece of research turned up that I’d probably have to replace all the resistors and capacitors and all the old wiring and then hope that the valves still worked. Then discovering that the design used a live chassis running at 240 V soon convinced me that I should get back on track and replace everything.

With a few bolts and screws removed, I soon had an empty case.

I then stripped out all the interior components and set about restoring the case and dial glass, seeing what I could use by way of the volume and power controls. Sadly, there didn’t seem to be any way to hook into the old controls, so I needed to design a new chassis to mount all the components, which I did in Tinkercad, an online 3D CAD package. The design was then downloaded and printed on my 3D printer.

It took a couple of iterations, and during this phase, I wondered if I could use the original speaker. It turned out to be absolutely great, and the audio took on a new quality and brought even more authenticity to the project.

The case itself was pretty worn and faded, and the varnish had cracked, so I decided to strip it back. The surface was actually veneer, but you can still sand this. After a few applications of Nitromors to remove the varnish, it was sanded to remove the scratches and finished off with fine sanding.

The wood around the speaker grille was pretty cracked and had started to delaminate. I carefully removed the speaker grille cloth, and fixed these with a few dabs of wood glue, then used some Tamiya brown paint to colour the edges of the wood to blend it back in with the rest of the case. I was going to buy replacement cloth, but it’s fairly pricey – I had discovered a trick of soaking the cloth overnight in neat washing-up liquid and cold water, and it managed to lift the years of grime out and give it a new lease of life.

At this point, I should have just varnished or used Danish oil on the case, but bitten by the restoration bug I thought I would have a go at French polishing. This gave me a huge amount of respect for anyone that can do this properly. It’s messy, time-consuming, and a lot of work. I ended up having to do several coats, and with all the polishing involved, this was probably one of the most time-consuming tasks, plus I ended up with some pretty stained fingers as a result.

The rest of the case was pretty easy to clean, and the brass dial pointer polished up nice and shiny with some Silvo polish. The cloth was glued back in place, and the next step was to sort out the dial and glass.

Frequency, volume, glass, and knobs

Unfortunately, the original glass was cracked, so a replacement part was cut from some Makrolon sheet, also known as Lexan. I prefer this to acrylic as it’s much easier to cut and far less likely to crack when drilling it. It’s used as machine guards as well and can even be bent if necessary.

With the dial, I scanned it into the PC and then in PaintShop I replaced the existing frequency scale with a range of years running from 1939 to 1945, as the aim was for anyone using the radio to just dial the year they wanted to listen to. The program will then read the value of the potentiometer, and randomly select a file to play from that year.

It was also around about now that I had to come up with some means of having the volume control the sound and an interface for the frequency dial. Again there are always several options to consider, and I originally toyed with using a couple of rotary encoders and using one of these with the built-in push button as the power switch, but eventually decided to just use some potentiometers. Now I just had to come up with an easy way to read the analogue value of the pots and get that into the program.

There are quite a few good analogue-to-digital boards and HATs available, but with simplicity in mind, I chose to use an MCP3002 chip as it was only about £2. This is a two-channel analogue-to-digital converter (ADC) and outputs the data as a 10-bit value onto the SPI bus. This sounds easy when you say it, but it proved to be one of the trickier technical tasks as none of the code around for the four-channel MCP3008 seemed to work for the MCP3002, nor did many of the examples that were around for the MCP3002 – I think I went through about a dozen examples. At long last, I did find some code examples that worked, and with a bit of modification, I had a simple way of reading the values from the two potentiometers. You can download the original code by Stéphane Guerreau from GitHub. To use this on your Raspberry Pi, you’ll also need to run up raspi-config and switch on the SPI interface. Then it is simply a case of hooking up the MCP3002 and connecting the pots between the 3v3 line and ground and reading the voltage level from the wiper of the pots. When coding this, I just opted for some simple if-then statements in cap-Python to determine where the dial was pointing, and just tweaked the values in the code until I got each year to be picked out.

Power supply and control

One of the challenges when using a Raspberry Pi in headless mode is that it likes to be shut down in an orderly fashion rather than just having the power cut. There are lots of examples that show how you can hook up a push button to a GPIO pin and initiate a shutdown script, but to get the Raspberry Pi to power back up you need to physically reset the power. To overcome this piece of the puzzle, I use a Pimoroni OnOff SHIM which cleverly lets you press a button to start up, and then press and hold it for a second to start a shutdown. It’s costly in comparison to the price of a Raspberry Pi Zero, but I’ve not found a more convenient option. The power itself is supplied by using an old power bank that I had which is ample enough to power the radio long enough to be shown off, and can be powered by USB connector if longer-term use is required.

To illuminate the dial, I connected a small LED in series with a 270R resistor to the 3v3 rail so that it would come on as soon as the Raspberry Pi received power, and this lets you easily see when it’s on without waiting for the Raspberry Pi to start up.

The code






If you’re interested in the code Adam used to build his time machine, especially if you’re considering making your own, you’ll find it all in this month’s HackSpace magazine. Download the latest issue for free here, subscribe for more issues here, or visit your local newsagent or the Raspberry Pi Store, Cambridge to pick up the magazine in physical, real-life, in-your-hands print.

The post Listen to World War II radio recordings with a Raspberry Pi Zero appeared first on Raspberry Pi.

We love a good pen plotter

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/we-love-a-good-pen-plotter/

BrachioGraph touts itself as the cheapest, simplest possible pen plotter, so, obviously, we were keen to find out more. Because, if there’s one thing we like about our community, it’s your ability to recreate large, expensive pieces of tech with a few cheap components and, of course, a Raspberry Pi.

So, does BrachioGraph have what it takes? Let’s find out.

Raspberry Pi pen plotter

The project ingredients list calls for two sticks or pieces of stiff card and, right off the bat, we’re already impressed with the household item ingenuity that had gone into building BrachioGraph. It’s always fun to see Popsicle sticks used in tech projects, and we reckon that a couple of emery boards would also do the job  although a robot with add-on nail files sounds a little too Simone Giertz, if you ask us. Simone, if you’re reading this…

You’ll also need a pencil or ballpoint pen, a peg, three servomotors, and a $5 Raspberry Pi Zero. That’s it. They weren’t joking when they said this plotter was simple.

The plotter runs on a Python script, and all the code for the project has been supplied for free. You can find it all on the BrachioGraph website, here.

We’ll be trying out the plotter for ourselves here at Pi Towers, and we’d love to see if any of you give it a go, so let us know in the comments.

 

The post We love a good pen plotter appeared first on Raspberry Pi.

Estefannie’s Jurassic Park goggles

Post Syndicated from Helen Lynn original https://www.raspberrypi.org/blog/estefannies-jurassic-park-goggles/

When we invited Estefannie Explains It All to present at Coolest Projects International, she decided to make something cool with a Raspberry Pi to bring along. But being Estefannie, she didn’t just make something a little bit cool. She went ahead and made Raspberry Pi Zero-powered Jurassic Park goggles, or, as she calls them, the world’s first globally triggered, mass broadcasting, photon-emitting and -collecting head unit.

Make your own Jurassic Park goggles using a Raspberry Pi // MAKE SOMETHING

Is it heavy? Yes. But these goggles are not expensive. Follow along as I make the classic Jurassic Park Goggles from scratch!! The 3D Models: https://www.thingiverse.com/thing:3732889 My code: https://github.com/estefanniegg/estefannieExplainsItAll/blob/master/makes/JurassicGoggles/jurassic_park.py Thank you Coolest Projects for bringing me over to speak in Ireland!! https://coolestprojects.org/ Thank you Polymaker for sending me the Polysher and the PolySmooth filament!!!!

3D-printing, sanding, and sanding

Estefannie’s starting point was the set of excellent 3D models of the iconic goggles that Jurassicpaul has kindly made available on Thingiverse. There followed several 3D printing attempts and lots of sanding, sanding, sanding, spray painting, and sanding, then some more printing with special Polymaker filament that can be ethanol polished.

Adding the electronics and assembling the goggles

Estefannie soldered rings of addressable LEDs and created custom models for 3D-printable pieces to fit both them and the goggles. She added a Raspberry Pi Zero, some more LEDs and buttons, an adjustable headgear part from a welding mask, and – importantly – four circles of green acetate. After quite a lot of gluing, soldering, and wiring, she ended up with an entirely magnificent set of goggles.

Here, they’re modelled magnificently by Raspberry Pi videographer Brian. I think you’ll agree he cuts quite a dash.

Coding and LED user interface

Estefannie wrote a Python script to interact with Twitter, take photos, and provide information about the goggles’ current status via the LED rings. When Estefannie powers up the Raspberry Pi, it runs a script on startup and connects to her phone’s wireless hotspot. A red LED on the front of the goggles indicates that the script is up and running.

Once it’s running, pressing a button at the back of the head unit makes the Raspberry Pi search Twitter for mentions of @JurassicPi. The LEDs light up green while it searches, just like you remember from the film. If Estefannie’s script finds a mention, the LEDs flash white and the Raspberry Pi camera module takes a photo. Then they light up blue while the script tweets the photo.




All the code is available on Estefannie’s GitHub. I love this project – I love the super clear, simple user experience provided by the LED rings, and there’s something I really appealing about the asynchronous Twitter interaction, where you mention @JurassicPi and then get an image later, the next time googles are next turned on.

Extra bonus Coolest Projects

If you read the beginning of this post and thought, “wait, what’s Coolest Projects?” then be sure to watch to the end of Estefannie’s video to catch her excellentCoolest Projects mini vlog. And then sign up for updates about Coolest Projects events near you, so you can join in next year, or help a team of young people to join in.

The post Estefannie’s Jurassic Park goggles appeared first on Raspberry Pi.

Tracking the Brecon Beacons ultramarathon with a Raspberry Pi Zero

Post Syndicated from Helen Lynn original https://www.raspberrypi.org/blog/tracking-the-brecon-beacons-ultramarathon-with-a-raspberry-pi-zero/

On my holidays this year I enjoyed a walk in the Brecon Beacons. We set out nice and early, walked 22km through some of the best scenery in Britain, got a cup of tea from the snack van on the A470, and caught our bus home. “I enjoyed that walk,” I thought, “and I’d like to do one like it again.” What I DIDN’T think was, “I’d like to do that walk again, only I’d like it to be nearly three times as long, and it definitely ought to have about three times more ascent, or else why bother?”

Alan Peaty is a bit more hardcore than me, so, a couple of weekends ago, he set out on the Brecon Beacons 10 Peaks Ultramarathon: “10 peaks; 58 kilometres; 3000m of ascent; 24 hours”. He went with his friend Neil and a Raspberry Pi Zero in an eyecatching 3D-printed case.

A green 3D-printed case with a Raspberry Pi sticker on it, on a black backpack leaning against a cairn. In the background are a sunny mountain top, distant peaks, and a blue sky with white clouds.

“The brick”, nestling on a backpack, with sunlit Corn Du and Pen y Fan in the background

The Raspberry Pi Zero ensemble – lovingly known as the brick or, to give it its longer name, the Rosie IoT Brick or RIoT Brick – is equipped with a u-blox Neo-6 GPS module, and it also receives GPS tracking info from some smaller trackers built using ESP32 microcontrollers. The whole lot is powered by a “rather weighty” 20,000mAh battery pack. Both the Raspberry Pi and the ESP32s were equipped with “all manner of additional sensors” to track location, temperature, humidity, pressure, altitude, and light level readings along the route.

Charts showing temperature, humidity & pressure, altitude, and light levels along the route, together with a route map

Where the route crosses over itself is the most fervently appreciated snack van in Wales

Via LoRa and occasional 3G/4G from the many, many peaks along the route, all this data ends up on Amazon Web Services. AWS, among other things, hosts an informative website where family members were able to keep track of Alan’s progress along windswept ridges and up 1:2 gradients, presumably the better to appreciate their cups of tea and central heating. Here’s a big diagram of how the kit that completed the ultramarathon fits together; it’s full of arrows, dotted lines, and acronyms.

Alan, Neil, the brick, and the rest of their gear completed the event in an impressive 18 hours and one minute, for which they got a medal.

The brick, a small plastic box full of coloured jumper leads and other electronics; the lid of the box; and a medal consisting of the number 10 in large plastic characters on a green ribbon

Well earned

You can follow the adventures of this project, its antecedents, and the further evolutions that are doubtless to come, on the Rosie the Red Robot Twitter feed. And you can find everything to do with the project in this GitHub repository, so you can complete ultramarathons while weighed down with hefty power bricks and bristling with homemade tracking devices, too, if you like. Alan is raising money for Alzheimer’s Research UK with this event, and you can find his Brecon Beacons 10 Peaks JustGiving page here.

The post Tracking the Brecon Beacons ultramarathon with a Raspberry Pi Zero appeared first on Raspberry Pi.

Retrofit a vintage camera flash with a Raspberry Pi Camera Module

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/retrofit-vintage-camera-flash-with-camera-module/

Wanting to break from the standard practice of updating old analogue cameras with digital technology, Alan Wang decided to retrofit a broken vintage camera flash with a Raspberry Pi Zero W to produce a video-capturing action cam.

Raspberry Pi Zero Flash Cam Video Test

Full story of this project: https://www.hackster.io/alankrantas/raspberry-pi-zero-flash-cam-359875

By hacking a somewhat gnarly hole into the body of the broken flash unit, Alan fit in the Raspberry Pi Zero W and Camera Module, along with a few other components. He powers the whole unit via a USB power bank.

At every touch of the onboard touchpad, the retrofit camera films 12 seconds of footage and saves it as an MP4 file on the onboard SD card or an optional USB flash drive.

While the project didn’t technically bring the flash unit back to life — as the flash function is still broken — it’s a nice example of upcycling old tech, and it looks pretty sweet. Plus, you can attach it to your existing film camera to produce some cool side-by-side comparison imagery, as seen in the setup above.

For a full breakdown of the build, including the code needed to run the camera, check out the project’s Hackster.io page.

The post Retrofit a vintage camera flash with a Raspberry Pi Camera Module appeared first on Raspberry Pi.

Build your own Raspberry Pi night vision camera

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/build-your-own-raspberry-pi-night-vision-camera/

A Raspberry Pi Zero W, Pimoroni HyperPixel screen, and Raspberry Pi IR Camera Module are all you need to build this homemade night vision camera.

How to build a night vision camera

How to build a night vision camera, video showing the process and problems that I came across when building this camera

Raspberry Pi night vison camera

Built into the body of an old camera flash, Dan’s Raspberry Pi night vision camera is a homage to a childhood spent sneaking around the levels of Splinter Cell. Says Dan:

The iconic image from the game is the night vision goggles that Sam Fisher wears. I have always been fascinated by the idea that you can see in the dark and this formed the foundation of my idea to build a portable hand-held night vision piece of equipment.

The camera, running on Raspbian, boasts several handy functions, including touchscreen controls courtesy of the Pimoroni HyperPixel, realtime video and image capture, and a viewing distance of two to five metres.

It’s okay to FAIL

Embracing the FAIL (First Attempt In Learning) principle, Dan goes into detail about the issues he had to overcome while building the camera, which is another reason why we really enjoyed this project. It’s okay to fail when trying your hand at digital making, because you learn from your mistakes! Dan’s explanations of the struggles he faced and how he overcame them are 👌.

For a full rundown of the project and tips on building your own, check out its Hackster.io page.

The post Build your own Raspberry Pi night vision camera appeared first on Raspberry Pi.

Real-time train station departure board

Post Syndicated from Liz Upton original https://www.raspberrypi.org/blog/real-time-train-station-arrival-board/

All across the UK, you’ll find train departure boards on station platforms that look like this:

They’ve looked this way for as long as I can remember (before they were digital dot-matrix displays, they were made from those flappy bits of plastic with letters of the alphabet and numbers printed on them, which whirled round like a Rolodex; they still look very similar). If you’re a frequent train traveller in the UK, you probably have a weird emotional response to seeing one of these. Mine is largely one of panic about being late.

Some people have a more…benign relationship with trains than I do, like Chris Crocker-White, who has adapted a build tweeted by Chris Hutchinson to make a miniature departure board for his desk. Here’s the tweet that started it all:

Chris Hutchinson on Twitter

Pretty hyped about my most recent @Raspberry_Pi project – a realistic, real-time, train departure board I’ve open sourced the software over at: https://t.co/vGQzagsSpi Next step: find a case and make it a permanent fixture! https://t.co/HEXgzdH8TS

Chris C-W’s build is similar, but has a couple of very neat upgrades, including some back-end software work (his build runs in Docker on balenaCloud, to make configuration easier), and some work on the display, which he’s tweaked to use 1:1 pixel mapping of the fonts and avoid any scaling, so the tiny board looks more like the dot-matrix LED displays you’ll see when you visit the station. You can see the difference in the image below:

 

Chris seems to be using his board as a piece of desktop furniture, where it looks terrific, but model train or narrow-gauge enthusiasts should be all over this project too; it’s a lovely way to inject some realism into a miniature setup. You can find a very complete guide to making your own here.

Now, if you’ll excuse me, I have a train to catch.

 

 

The post Real-time train station departure board appeared first on Raspberry Pi.

Build Demolition Man’s verbal morality ticketing machine

Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/build-demolition-mans-verbal-morality-ticketing-machine/

In the 1993 action movie Demolition Man, Sylvester Stallone stars as a 1990s cop transported to the near-future. Technology plays a central role in the film, often bemusing the lead character. In a memorable scene, he is repeatedly punished by a ticketing machine for using bad language (a violation of the verbal morality statute).

In the future of Demolition Man, an always-listening government machine detects every banned word and issues a fine in the form of a receipt from a wall-mounted printer. This tutorial shows you how to build your own version using Raspberry Pi, the Google Voice API, and a thermal printer. Not only can it replicate detecting banned words, but it also doubles as a handy voice-to-paper stenographer (if you want a more serious use).

Prepare the hardware

We built a full ‘boxed’ project, but you can keep it simple if you wish. Your Raspberry Pi needs a method for listening, speaking, and printing. The easiest solution is to use USB for all three.

After prototyping using Raspberry Pi 4 and various USB devices, we settled on Raspberry Pi Zero W with a small USB mic and Pimoroni Speaker pHAT to save space. A Pico HAT Hacker allowed the connection of both the printer and Speaker pHAT, as they don’t share GPIO pins. This bit of space-saving means we could install the full assembly inside the 3D-printed case along with the printer.

Connect the printer

To issue our receipts we used a thermal printer, the kind found in supermarket tills. This particular model is surprisingly versatile, handling text and graphics.

It takes standard 2.25-inch (57mm) receipt paper, available in rolls of 15 metres. When printing, it does draw a lot of current, so we advise using a separate power supply. Do not attempt to power it from your Raspberry Pi. You may need to fit a barrel connector and source a 5V/1.5A power supply. The printer uses a UART/TTL serial connection, which neatly fits on to the GPIO. Although the printer’s connection is listed as being 5V, it is in fact 3.3V, so it can be directly connected to the ground, TX, and RX pins (physical pins 6, 8, 10) on the GPIO.

Install and configure Raspbian

Get yourself a copy of Raspbian Buster Lite and burn it to a microSD card using a tool like Etcher. You can use the full version of Buster if you wish. Perform the usual steps of getting a wireless connection and then updating to the latest version using sudo apt update && sudo apt -y upgrade. From a command prompt, run sudo raspi-config and go to ‘Interfacing options’, then ‘Enable serial’. When asked if you would like the login shell to be accessible, respond ‘No’. To the next question, ‘Would you like the serial port hardware to be enabled?’, reply ‘Yes’. Now reboot your Raspberry Pi.

Test the printer

Make sure the printer is up and running. Double-check you’ve connected the header to the GPIO correctly and power up the printer. The LED on the printer should flash every few seconds. Load in the paper and make sure it’s feeding correctly. We can talk to the printer directly, but the Python ‘thermalprinter‘ library makes coding for it so much easier. To install the library:

sudo apt install python3-pip
pip3 install thermalprinter

Create a file called printer.py and enter in the code in the relevant listing. Run the code using:

python3 printer.py

If you got a nice welcoming message, your printer is all set to go.

Test the microphone

Once your microphone is connected to Raspberry Pi, check the settings by running:

alsamixer

This utility configures your various sound devices. Press F4 to enter ‘capture’ mode (microphones), then press F6 and select your device from the list. Make sure the microphone is not muted (M key) and the levels are high, but not in the red zone.

Back at the command line, run this command:

arecord -l

This shows a list of available recording devices, one of which will be your microphone. Make a note of the card number and subdevice number.

To make a test recording, enter:

arecord --device=hw:1,0 --format S16_LE --rate 44100 -c1 test.wav

If your card and subdevice numbers were not ‘0,1’, you’ll need to change the device parameter in the above command.

Say a few words, then use CTRL+C to stop recording. Check the playback with:

aplay test.wav

Choose your STT provider

STT means speech to text and refers to the code that can take an audio recording and return recognised speech as plain text. Many solutions are available and can be used in this project. For the greatest accuracy, we’re going to use Google Voice API. Rather than doing the complex processing locally, a compressed version of the sound file is uploaded to Google Cloud and the text returned. However, this does mean Google gets a copy of everything ‘heard’ by the project. If this isn’t for you, take a look at Jasper, an open-source alternative that supports local processing.

Create your Google project

To use the Google Cloud API, you’ll need a Google account. Log in to the API Console at console.developers.google.com. We need to create a project here. Next to ‘Google APIs’, click the drop-down menu, then ‘New Project’. Give it a name. You’ll be prompted to enable APIs for the project. Click the link, then search for ‘speech’. Click on ‘Cloud Speech-to-Text API’, then ‘Enable’. At this point you may be prompted for billing information. Don’t worry, you can have up to 60 minutes of audio transcribed for free each month.

Get your credentials

Once the Speech API is enabled, the screen will refresh and you’ll be prompted to create credentials. This is the info our code needs to be granted access to the speech-to-text API. Click on ‘Create Credentials’ and on the next screen select ‘Cloud Speech-to-text API’. You’re asked if you’re planning to use the Compute Engine; select ‘no’. Now create a ‘service account’. Give it a different name from the one used earlier, change the role to ‘Project Owner’, leave the type of file as ‘JSON’, and click ‘Continue’. A file will be downloaded to your computer; transfer this to your Raspberry Pi.

Test Google recognition

When you’re happy with the recording levels, record a short piece of speech and save it as test.wav. We’ll send this to Google and check our access to the API is working. Install the Google Speech-To-Text Python library:

sudo apt install python3-pyaudio
pip3 install google-cloud-speech

Now set an environment variable that the libraries will use to locate your credentials JSON:

export GOOGLE_APPLICATION_CREDENTIALS="/home/pi/[FILE_NAME].json"

(Don’t forget to replace [FILE_NAME] with the actual name of the JSON file).

Using a text editor, create a file called speech_to_text.py and enter the code from the relevant listing. Then run it:

python3 speech_to_text.py

If everything is working correctly, you’ll get a text transcript back within a few seconds.

Live transcription

Amazingly, Google’s speech-to-text service can also support streaming recognition, so rather than capture-then-process, the audio can be sent as a stream, and a HTTP stream of the recognised text comes back. When there is a pause in the speech, the results are finalised, so then we can send the results to the printer. If all the code you’ve entered so far is running correctly, all you need to do is download the stenographer.py script and start it using:

python3 stenographer.py

You are limited on how long you can record for, but this could be coupled with a ‘push to talk’ button so you can make notes using only your voice!

Banned word game

Back to Demolition Man. We need to make an alarm sound, so install a speaker (a passive one that connects to the 3.5mm jack is ideal; we used a Pimoroni Speaker pHAT). Download the banned.py code and edit it in your favourite text editor. At the top is a list of words. You can change this to anything you like (but don’t offend anyone!). In our list, the system is listening for a few mild naughty words. In the event anyone mentions one, a buzzer will sound and a fine will be printed.

Make up your list and start the game by running:

python3 banned.py

Now try one of your banned words.

Package it up

Whatever you decide to use this project for, why not finish it up with a 3D-printed case so you package up the printer and Raspberry Pi with the recording and playback devices and create a portable unit? Ideal for pranking friends or taking notes on the move!

See if you can invent any other games using voice recognition, or investigate the graphics capability of the printer. Add a Raspberry Pi Camera Module for retro black and white photos. Combine it with facial recognition to print out an ID badge just using someone’s face. Over to you.

The MagPi magazine issue 84

This project was created by PJ Evans for The MagPi magazine issue 84, available now online, from your local newsagents, or as a free download from The MagPi magazine website.

The post Build Demolition Man’s verbal morality ticketing machine appeared first on Raspberry Pi.