Radio-4-Matic - part 2 - hardware

posted in Electronics by Cargo Cult on Wednesday January 9 2013

Continuing this series on the hacked-together, time-travelling Radio-4-Matic, time for some hardware. This was going to have been a guide to dismembering an old, non-functional radio and rebuilding it from the ground up, using GPIO to read various buttons and controls, but ... I couldn't. So instead, here's a guide to modernising a glorious vintage radio in a minimally invasive, fully-reversible manner...

The first prototype for the Radio-4-Matic consisted of the Raspberry Pi, a 5V power supply, USB keyboard, ethernet cable and a cheap monitor with HDMI input. My two-line proof-of-concept audio delay script worked surprisingly well - although it had a tendency to cut out whenever get_iplayer lost connection. Some extra electronics from SparkFun resulted in a more independent, bedside version of the beast - albeit one which suffered from serious mains hum, and which needed an empty cardboard box (formerly containing pasta) to improve the speaker's acoustics.

High-grade engineering.

Such a botch-job could never be a permanent home for BBC Radio 4, obviously.

Some background: like many, I grew up in a house where there'd always be at least one radio switched on, permanently tuned to Radio 4. For us, it was a motley selection of Grundigs, Bushes and an ancient transistorised Cossor belonging to my dad. At some point in the past I'd acquired my grandfather's 1970s Roberts radio - a stylish design of chrome, wood, fake leather and glass. Using such an iconic British brand to surround some modern British electronics sounded like an eminently ridiculous idea - but transatlantic inquiries revealed nobody had the faintest idea where that particular radio had got to.

So, I resorted to eBay.

The plan was to remove the old electronics and drive the old speaker using the already-acquired modern amplifier. Plans brewed in my head, figuring out new GPIO idiocy to interface with the radio's newly liberated buttons and dials. HDMI, USB and ethernet ports on the back - a full-scale case-mod.

It turns out there's a surprising range of vintage radios on eBay, particularly the UK version. Many of which are selling for silly prices, or have sustained serious damage, or are modern DAB efforts that have been miscategorised by opportunistic sellers. Fortunately, I got a proper vintage Roberts R707 that (a) was cheap, (b) was in surprisingly good nick, and (c) had the seller offering transatlantic postage. Unfortunately, it was sold completely untested. But, given I was going to tear everything out and start again, that wouldn't matter, right?

Cue a pretty long pause as the radio winged its way across the Atlantic and the North American continent. The intertubes are way faster...

Transatlantic potato-box.

Arrival. One elderly radio, ready for disemboweling. Hang on, this thing looks in almost mint condition. Plenty of space inside to fit a Raspberry Pi without removing any existing systems. And it's got C-cell holders instead of cavernous voids for lantern batteries. A quick trip to Safeway for some new batteries surely won't hurt?

Roberts R707 FTW!

So, perhaps decades after it was last powered up, this vintage British radio took to the airwaves once again, this time in Seattle. VHF armed and ready, aerial extended to its impressively full length, we got tuning. Only to run slap bang into some dubstep.

Poor thing.

At which point I realised that, despite the awful noises the radio was making, it sounded fantastic. Almost terrifying, granny-humping bass - for something designed to live in a middle-class kitchen next to the Aga and relay The Archers, this sounded bloody good. It had to live. To tear out its transistors felt like sacrilege.

But how could it be subverted?

Opening the powered radio up for some exploratory surgery (this time tuned to some vintage Fallout 3 tunes courtesy of NPR), witnessing the frankly disgraceful soldering skills - I wondered about how best to sense its internal signals. Wait - that modern amplifier and speaker from earlier - I could quickly twist some extra wires on to its headphones connector, poke them into solder joints and perhaps listen to whatever was happening inside. That thick PCB trace with black wires leading into it, that's obviously ground - the volume control probably has some audio going through it ...

Music coming out of that tinny little speaker as well as the radio's more dignified effort. Bingo.

Tracing back across the PCBs, I soon located where the audio signals left the tuner circuitry and entered the switchboard on the top. By the looks of things, I'd be able to hijack at least one audio signal. But could I make the switches function?

At this point I reversed things - piping audio out from my laptop (Radiohead, appropriately enough) through some wires I could poke into the radio, tuned to a dead frequency. So, if I inject audio here... Radiohead coming out the radio's 1970s speaker, sounding startlingly good. Whatever the required specifications of this internal signal, the laptop's output was good enough.

Like brain surgery on a conscious patient, only not.

I soon discovered that the AM tuner was separate from the FM tuner, with both feeding their audio signals into that switchboard on the top of the radio. While it appeared that the AM tuner would be powered down when the FM tuner was active (and various different circuits would get switched in and out for AM's LW, MW and SW), the switchboard and amplifier would work just fine with an always-on audio signal apparently coming from the AM tuner. So, given the paranoid racism on MW, the screeching interference on SW and lack of radio signals on LW, the AM wire would get the snip and a headphone jack added in its place.

Entertainingly, it seems to apply some sort of low-pass filter when the LW button is engaged. So a high-fidelity input signal ends up with some authentic LW muffling. Awesome.

The terrible soldering has nothing to do with me!

Cue some quick surgery on a damaged headphones extension cable, extended with inappropriately thick wires and the join insulated with some off-brand Sellotape...

Like a primitive cochlear implant, only not.

... And then to solder this mess into the radio! 3.5mm headphone cable, tip and centre of jack connected to the AM audio in, shroud connected to ground. I may have promptly stabbed the leather-effect Rexine with the soldering iron. Oops. Luckily it healed suspiciously well.

The smell of ancient, melting solder was ... interesting.

Some vigorous testing connected to the laptop proved the amplifier was more than adequate for the task (Radio 4 being simulated with pre-recorded Just a Minute and I'm Sorry I Haven't A Clue), then it was time to emplace the Raspberry Pi - held in place by the batteries, back panel and cabling...

A new home for a well-travelled Pi.

Right now, there's a 5V power cable poking out the back - the photos above were taken when it was still connected to the intertubes via ethernet, but as of this evening the radio is properly a radio thanks to a handy little USB WiFi module. Setup was pretty easy, but I think I'm going to have to do some modding to this very-early Pi with the dodgy polyfuses. It's cut out a few times already...

Still, the all-important to-do list:

  • Add 12V power supply, so the radio's not permanently running off batteries. The radio's battery life seems great, but I do need to characterise current and voltage requirements before buying any potentially underpowered kit.
  • Attach DC-DC step-down power supply to 12V, for providing the Raspberry Pi with a nicely stable 5V. Component ordered!

Edit 2013-06-30: - I finally got round to making the whole thing run on mains power. Those batteries were finally deciding to get a bit faint...

When all this is done, I'll have a fully independent Raspberry Pi sealed inside a 1970s radio - the only clue to the radio's modified state being the Pi's activity LEDs gently visible through the air grille at the back. On VHF, it's still a conventional radio - but on any of the AM bands, it's a mysteriously intercontinental, time-travelling device. A fully-reversible hack - doing anything else to this magnificent old beast would have been cruel. It's hard to describe the audio quality, other than meaty - the tinny PWM-iness of the Pi's analogue-out has somehow combined with the chunky 1970s transistors to give something quite glorious. It's neither 'good' nor 'accurate', it's better than that...

Next up, the all-important software!

Radio-4-Matic - part 1 - introduction

posted in Electronics by Cargo Cult on Monday January 7 2013

So, there have been vague hintings at a Raspberry Pi project I've been building. It's been functional for a while in its time-travelling lunacy - but first, what the hell is it?

Something one encounters in these western United States of America is the lack of BBC Radio 4. Or rather, the lack of proper live Radio Four, the excellent iPlayer Radio providing invaluable on-demand capability. "But Adam," I hear you cry, "you can already listen to live BBC radio over the internet! Why can't you use that?"

It's 'talk radio', but completely different.

Timezones. It's live radio, but all the timing is wrong. Namely, the written-in-stone Radio 4 schedule must not, under any circumstances, be allowed to become misaligned from the rising and the setting of the sun. How could anything (or anyone) remotely British even think of operating normally if the Friday evening comedy gets broadcast on Friday morning, or if the Book at Bedtime arrives early in the evening? Or heaven forbid, if Woman's Hour escapes from its usual 10am ghetto?

So, short of removing both the North American continent and the Atlantic Ocean in order to make Seattle a suburb of Plymouth, we're going to have to take the existing internet radio streaming and add a timezone-busting delay. Oh, and then wrap the whole thing in a suitably middle-class casing complete with a Royal warrant of appointment. Luckily, we moved west of the Prime meridian, so we can get away without using actual time travel.

Cue the Radio-4-Matic.

Roberts R707

Outwardly, it looks like a typical old British radio, permanently tuned into Radio 4. At 6pm, it provides the Six O'Clock News. Only the 6pm is Seattle-time, not London-time. Waking up can be accompanied by the Today Programme. All very civilised.

Hardware-wise, it's an eBay-acquired 1970s Roberts transistor radio, containing a bog-standard 256MB Raspberry Pi running Raspbian (actually, this exact Pi helped Raspbian get going). The radio has been modified so that the LW, MW and SW buttons provide line-in audio from the Pi's analogue audio-out - VHF still operates as a conventional radio (currently tuned to NPR, no less). Purists may be relieved to hear that hardware modifications to this vintage radio involved snipping one racism-carrying wire from the AM tuner before soldering in two others. Should be completely reversible in about ten minutes, including time waiting for the soldering iron to heat up. I originally intended to replace everything except the speaker, but after discovering how easy it was to pipe in new audio, and how awesome it sounded, I simply didn't have the heart...

Opened up for some exploratory surgery...

Software-wise, it operates a slightly-illicit transatlantic SSH SOCKS tunnel, with the faintly-dodgy get_iplayer and rtmpdump grabbing the radio stream, piping data to ffmpeg for remuxing the AAC-compressed audio from FLV into ADTS. This gets stored on the Pi's SD card as timestamped .aac files, with the basically-ubiquitous mplayer used for playback, started with an appropriate delay - with all of the previous utilities marshalled together with a hideously hacky script written in ... PHP. Stop laughing. Non-blocking file IO and POSIX process management in a command-line program written in PHP? Ohyes! I'm going to rewrite in Python at some vague point in the future. But it's already super-resilient against any particular subsection choking, dying or getting stuck. It'll also probably cope with daylight-savings changes. Probably. It also doesn't record things unnecessarily, such as the World Service overnight.

Plenty of space for the Raspberry Pi to live in...

It's still rather hacked-together (I'm waiting for a USB WiFi dongle to arrive, along with a 12V power supply and a DC-to-DC step-down power supply, to remove all the wires hanging from the back) but it's most definitely functional, and useful. The end result will be a radio and nothing but a radio - except one with this magical eight-hour delay...

Roberts R707, connected to the intertubes!

I'll be documenting the precise hacks involved, both software and hardware - but for now, it's nice to actually describe this thing!

I'll also eventually get round to fully documenting the Timelapse-o-Tron™ one day, too...

Edit 2013-01-09: Now with part 2, hardware!

Edit 2013-01-11 (just): ... and part 3, software. Phew.

Edit 2013-01-12: ... and a surprise appearance on Radio 4 itself. Eek.

Edit 2013-06-30: ... a somewhat belated upgrade to make the whole thing run on mains electricity. Blinking heck batteries last a long time in 1970s hardware.

Sunday Things - urbex edition

posted in Links by Cargo Cult on Sunday January 6 2013

What would we do without intrepid photographers infiltrating abandoned buildings? Probably have to go infiltrating more of them ourselves, of course.

The science of corrosion.
Abandoned biological research laboratories - full set - a M. Anatole Lb has many many other sets on Flickr. Wow.
I was born in Sheffield, don't you know.
Sheffield Town Hall and Courts - full set - while a Mr. M D Allen has more Midlands-oriented rust, demolition and dereliction in yet more sets on Flickr.

I think it's some sort of hairdryer?
W Steel Corporation - full set - randompkguy Esq. brings us some more American corrosion in a wide range of sets. He was already mentioned in the very first Sunday Things, no less.

Bonus Someone's GPU Is Melting corner:

What is a Fluxion and should it Klax like that?

Hello, you either have plugins turned off or an old version of Macromedia's Flash Player. Get the latest Flash player.

OSSITY #4 - KLAXING FLUXION - MY BRAIN IS ALSO MELTING.

Sunday Things - end-of-the-year edition

posted in Links by Cargo Cult on Sunday December 30 2012

Last article of 2012! At this rate, I need to extend the archives to split things into separate years - fifty articles in just over six months? Not bad going...

Astronauts should cut down on the caffeine.

Hello, you either have plugins turned off or an old version of Macromedia's Flash Player. Get the latest Flash player.

Apollo 16 Lunar Rover, in stabilised video - any properly-executed Kubrickian moon-hoax would have taken an anachronistic Steadicam along too. Instead, we must rely on software. via
It's cold outside, no kind of atmosphere... I'm all alone, more or less.
Arctic Technology - brilliantly icy radio antennas, dishes and radomes courtesy of Christian Houge. See also: Barentsburg for some icy, Soviet, Svalbard coal-mining..

... and yet the Enterprise never made it to space.

Hello, you either have plugins turned off or an old version of Macromedia's Flash Player. Get the latest Flash player.

The Space Shuttle - narrated by William Shatner. An hour and twenty minutes of infrastructure and procedure constructed to launch the now-decommissioned Space Shuttles. I've found US governmental stuff to share a certain aesthetic - be it Amtrak, post offices or NASA...
My kind of holiday destination.
The Most Remote Workplace on Earth - the permanently-manned French-Italian Concordia station in Antarctica, over 3km above sea-level. Temperatures? Below -80ºC during winter. Next closest station? 600km away. And nights lasting months on end... See also.

Bonus Audio Extravaganza corner:

Sunday Things - post-apocalyptic, pre-Newtonmas edition

posted in Links by Cargo Cult on Sunday December 23 2012

So, the Mayan apocalypse turned out to be deeply disappointing - and the anniversary of the birth of Sir Isaac Newton isn't quite upon us. Ignoring calendrical differences for the latter, obviously. So what else do we have?

The Sunday Things.

I think I missed my train here...
Mayfield, the ghost station of Manchester - I used to regularly catch trains from Manchester Oxford Road and Manchester Piccadilly, but never knew there was an abandoned third station just nearby. I wish I'd gone exploring that city with a pre-digital camera... via Jason M.
At least one seat is allocated to a Dr. Strangelove.
Inside NASA's Mysterious Rubber Room - deep underneath the launch pads at Kennedy Space Centre lie some strange, disused remnants of the Apollo programme. Rubber-lined corridors and shock-proof blast-rooms, ready to withstand an exploding Saturn V rocket. See also: Mr. Scriptunas' Best Spaceflight Photos of 2012. via Gryn
Quite a ridiculously high polygon count.
Multi-gigapixel panorama of Mount Everest - by David Breashears. Almost too much to look at - an impossibly detailed alien landscape, lifeless except for the insect-like trails of climbers and their colourful detritus on some modern pilgrimage to the highest point on the planet. via

The mechanical meets the biological.
Robots at Work and Play - robots robots robots, robots robots. Robots robots robots? Robots! #35? Baby-faced firefighting segway. Freaky.
Egyptologists have also wondered about the empty sarcophagi at the hearts of the pyramids.
Zwentendorf Nuclear Power Station - near-fully-constructed power plant in Austria, never actually commissioned. flash-free images

Bonus Merry Christmas! corner:

What the Christmas message is all about...

Hello, you either have plugins turned off or an old version of Macromedia's Flash Player. Get the latest Flash player.

The Spirit of Christmas - lovingly told by Cyriak himself. Awww...