Intro: Pi Zero Talking Radio
This is a late 1940s DeWald table radio that I've given a new life using a Raspberry Pi Zero, a Blinkt! LED strip and a pair of PC Speakers. It reads out notifications from a range of internet-connected services using the Pyvona text-to-speech (TTS) engine and IF This Then That (IFTTT) integration. The LEDs are amazingly bright, and light the radio's dial a different colour depending on keywords in the notification text, for example "youtube" = Red.
I picked up this sweet little radio at a car boot sale over the summer for £3 - I was immediately taken by its compact size and classic design, and managed to see its potential through the sun-faded exterior and many cracks! I've been wanting to create "something decent for the living room" for a while now and this was the ideal starting point.
I've experimented with text-to-speech notifications before on the Rabbit Pi project and hoped to build on what I'd learned to make something that would "just work" on a daily basis.
In case you can't see the embedded video it's at: https://youtu.be/a3V24ywGgSc
Step 1: Blinkty Pi
I picked up my first Pi Zeros recently and was instantly amazed by their tiny size! After soldering in the GPIO header and connecting the adaptors the first one was ready to go. Originally I'd planned to make an improved Rabbit Pi but after a while this felt more like work than fun so I shelved it - though not before I started experimenting with a Unicorn pHAT, a 4x8 matrix of programmable LEDs, which was an absolute heap of fun! The only downside was that using the pHAT complicated the audio setup, and I wanted to keep my next project really simple.
Everything fell into place at the Cambridge Raspberry Jam in September when I saw the Blinkt! on sale at the Pimoroni stall - it's just like the Unicorn pHAT but with a single row of 8 LEDs, perfectly sized to fit on a pi zero's GPIO header. It comes with loads of documentation and examples and was up & running in no time - now it was time to start putting together the rest of the code.
Step 2: Talking Code
I started with a copy of the main code from the Rabbit Pi, as this already had my Ivona text-to-speech credentials stored in it. You need to set up an Ivona developer account before using the service, but the process is straightforward as I've documented before.
The next step was to install Pyvona, the Python wrapper to integrate with the Ivona TTS service, which couldn't have been easier (pip install pyvona).
With this in place I started amending the Rabbit Pi code, taking out the references to motor control and selfie-taking to leave me with just the bits that read out notifications from the Subject lines of Gmail messages. The critical development with this code was adding in a series of IF statements to look for specific keywords in the messages, so that the Blinkt! would glow different colours depending on the message.
This took me a while as I'm still finding my feet with Python, but having defined my keywords ("Cloudy", "Sunset", "Showers", "Facebook", "Twitter", "Youtube" and "Sunny") I was able to control the Blinkt! colour depending on the text that was read out.
The simple, if inelegant, code I used is on GitHub, though I've already added in more keywords and colours! I tested it outside the case using a battery powered speaker - more on the audio setup later. The last step was to set the python script, radiot.py, to run on startup.
Step 3: Notification Central
Now that the Pi would reliably read out messages and glow different colours I needed to set up the notifications so that they would come through spontaneously - I remember in an old Tom & Jerry cartoon the radio would just pipe up occasionally (Jerry's Diary (1949) - same period as the radio!) and this is the effect I was after, that it would sit in the corner and look nice, occasionally lighting up and reading out notifications that I wouldn't otherwise pick up on my phone.
First I set up a separate Gmail account to receive the notification emails - this meant that I wouldn't be bombarded with new mail notifications or pollute my existing inbox with hundreds of auto-generated messages.
Next I nipped over to IFTTT (IF This Then That) to set up the automation. With IFTTT you can easily connect multiple "Channels" to your account and set them to interact with one another using "Recipes", in this case funnelling multiple social media and real-world actions into a stream of emails. I customised the "Then That" part of the Recipes so that they would all send an email to the Gmail account I set up for notifications, and used the "Ingredients" section to make sure that the key information would be included in the email Subject, the part that is read out. At the moment I have the following IFTTT recipes set up, but these are being added to all the time!
- Every day at 9pm send tomorrow's weather by email
- Every day at Sunset send the date & time by email
- IF I'm tagged in a Facebook photo send an email
- IF my phone is plugged/unplugged send the battery percentage by email
- IF I enter a geographical area send an email "MisterM has arrived at work!"
- IF I upload a YouTube video send an email
- IF a specific person tweets, send it by email
- IF a google calendar event starts send it by email
- IF the current weather changes to rain send an email ("Look out, it's about to start raining!"
- IF the smart socket is turned on or off send an email
- IF a new SMS message is received send it by email
- IF phone battery drops below 15% send an email ("Charge your phone you idiot")
- IF I have a new Twitter follower or mention send an email
It's a great mixture of predictable daily events and unexpected announcements - my favourite is the Sunset notification, it's interesting at this time of year to see how its time changes daily. The Twitter notifications are the most fun, at the moment it reads out any new tweets from "Beef & Dairy Network", "Very British Problems", "My Sweary Cat" and "Henry Thoreau" (though some of these get toggled off in the IFTTT app in polite company). Being able to read out specific Twitter accounts makes it really flexible, and these can be customised via IFTTT rather than having to reprogram the Pi each time.
Step 4: Audio Options
Next I needed to sort out the audio, with two challenges! Firstly how to get the audio out of the Pi. Unlike its bigger sibling the Pi Zero has no 3.5mm audio output, so I needed to use some kind of an adaptor. Initially I thought I'd use an HDMI to VGA + Audio connector but this seemed like overkill (and I needed it for another project!), so I used a cheap USB audio adaptor. This was fairly easy to set up, just a case of setting the USB soundcard as the default ALSA device on the Pi. This did mean I needed to include a USB hub to house the WiFi adaptor, but I managed to dismantle and reuse an old one I had lying around.
Secondly I needed to choose an amplifier/speaker combination that would give good quality sound and be constantly turned on. I've previously used battery powered speakers but needing regular charging these would be no good for "always on" use, also they often had noticeable background hissing. I've also cannibalised old ipod docks in the past, but these tended to have power saving "features" and turned off after a few minutes of silence.
I went with something new in the end, a pair of PC speakers for the bargain price of £6.99. I didn't expect too much but the sound quality was absolutely fine, with no hissing or timing out. The added bonus of the PC speakers was that they included an on/off switch and volume dial, which I hoped to be able to connect to the radio's original controls. It all worked on the bench, so now it was time to fit it in the case!
Step 5: Retro Fitting
When I first brought the radio home I removed the original circuits which were, in places literally, toast. I was impressed with the original construction though, it was obviously designed to be easily dismantled and fixed as after undoing a couple of bolts the entire assembly slid out on a kind of chassis. I decided to use the same approach and put the new components together on a base that could then slide into the case and be secured like the original.
I started with a thin wooden shelf from an old DVD rack, cutting it to size and drilling holes for the case bolts. Next I dismantled the speakers, cutting down the plastic cases with a hacksaw and rotary tool. The now-slimline speakers were fixed to the wooden base with a 90 degree bracket made from Meccano. The amplifier circuit was next - because of space constraints this unfortunately needed to be mounted upside down and raised about an inch above the base. I had to build some kind of pillar arrangement to support and secure the board, but got stuck with how to do this neatly. The ideal solution was right under my nose - a coloured pencil! I cut sections of the pencil to size, then fitted these into holes drilled in the base. The perfect thing about using a coloured pencil is that the "lead" in the centre can be really easily drilled out, leaving a convenient hole for the circuit board screws.
I used a combination of Meccano and Lego pieces to make a bracket to support the Pi itself, and tidied up the stray leads with cable ties. The volume and on/off switches were further apart on the speaker circuit board than the holes in the radio case (you can't have everything) so I extended them using sections of a hollow plastic balloon stick.
Step 6: Case Work
As I mentioned earlier the radio case was in a dreadful state, so I patched up the worst holes & cracks using polyfilla and sanded it down all over. I decided to stick with a nice cream colour for the paint, to co-ordinate with the brown of the tuning dial. The paint claimed to be "primer & paint in one" but I gave it a few coats of primer first just to be on the safe side. The knobs took a fair bit of scrubbing (60+ years of grime!) but came out well - I just secured the original cream tuning knob to the dial itself with a bolt as it wasn't connected to any components.
After the paint had hardened it was time to put it all together - normally the part of a project that tests my patience the most! This time it went very smoothly, as all the difficult construction was already done on the base, all I had to do was slide the assembly into the case, secure it with the bolts and fit the knobs.
The back cover of the radio was missing so I made a new one from an old picture frame, painting it the same cream colour.
Step 7: Radio Times
This was a really fun project to build, it was good to keep things fairly simple and focus on making it as cleanly as possible. At times I was tempted to add in a microphone for Alexa integration, and even seriously considered building in a Chromecast Audio (for my favourite new-time podcasts in the style of old-time radio) but I'm glad I kept it simple and I'm thrilled with the result.
It's now installed on a speaker in the corner of the living room, lighting up and speaking occasionally just as I'd hoped. The only slight downside is that the cream & brown translucent dial makes it harder to show off the brilliant colour range of the Blinkt! It's pretty obvious for sunset notifications (orange) and text messages (purple) but the weather ones are a bit samey - I just need to experiment with different RGB colour codes I think!
If you like this project and want to see more you can check out my website for in-progress project updates at bit.ly/OldTechNewSpec, join in on Twitter @OldTechNewSpec or subscribe to the growing YouTube channel at bit.ly/oldtechtube - give some of your Old Tech a New Spec!
Second Prize in the
IoT Builders Contest