About ten or so years ago while bumbling about the Internets, I came across a project wherein someone named MightyOhm had mold, findle and sputalated a wifi router into being an Internet radio. Since that time, I’d been toying with the idea of buying a Victrola phonograph player, stripping the guts out, stuffing a computer inside and making a music player.
There are a couple problems however.
I could never figure out what to do with the turntable part. Do I put a computer screen there instead? Vinyl is making a comeback, perhaps a modern turntable? Some sort of dock for a mobile phone or something?
What else should it do? Should it be a full-fledged media playing machine? Should it play movies? If so, how do you see the movies? A projector? Some kind of computer screen?
What about the interface? How do we choose what to listen to / watch / whatever else this thing is going to do?
What about the computer itself? Using a wifi router is cheap and clever and very very tricky, MightyOhm did some deep wizardry getting his project to work. Wizardry I’m not sure I’m up to. Small, single board x86 computers exist, but they’re not cheap, and are also finicky in their own ways.
So all these questions and choices kept me from really doing anything about this project other than occasionally saying to myself “Wouldn’t it be fun to....” and then stumbling over all the same old problems.
Then, about four months ago, I got a job at the library. The library were in the process building a Makerspace, which is exciting, and— hrmmm— I guess I don’t know what a— or they don’t know what— someone doesn’t know what a Makerspace is. My Makerspace has laser cutters and milling machines in it. Their Makerspace has sewing machines and paper crafts. It turns out that when you have the non-fiction collection a meter away, hot metal— moving fast, splashing coolant, and smoking— is in a word: bad. Also we don’t want people to be able to hurt themselves.
Three-ish months ago, my boss has a little chat with me, and says “You know something about this Raspberry Pi thing, come up with a little presentation you can do for the grand opening of the Makerspace.”
“Okay,” I think to myself, “Okay, I used one to build a phone that connects to a Google voice number over the Internets, which was super useful in Japan, but on the other hand, doesn’t make for that appealing of a visual. I could do a wifi router thing or a retro-gaming thing, but all of these are basically little plastic boxes with blinking lights. (Which, to be fair, is more or less the entirety of modern electronics.) I need something that has more look.”
About a week later I’m still stewing when a thought occurs: “That Wifi Radio Thingus.” All the old problems still exist, most are solvable, some are not, and some have been crushed mercilessly beneath Moore’s boots.
- Cabinet: Use an antique radio cabinet, answers about the user interface become very simple: “As much as possible, do it like the original did.”
- Turntable: We don’t have to figure out what the replace the turntable with, because the turntable is no longer a thing.
- Movies: Don’t need ’em! And we only have three months, so simpler is betterer.
- Technical Wizardry: Moore’s law saves us. The Raspberry Pi is nominally $35 and has way more compute than is actually needed for this project. It also has a huge userbase. Somebody, somewhere, has solved every problem I’ll run across, I just have to find out how.
Just like that, Heather and I are away onto the Craigslist, looking for an antique radio, preferably one with non-functional electronics, preferably with a cabinet in nice shape. Does such a thing even exist? Wouldn’t the cabinet be the first to go? Doesn’t— Oh, nevermind, Heather found one. Last week. Apparently she’s been looking at antiques. $100 O.B.O. I ring up and offer $70 cash on the nail. They call back, $70 they can do. Okay! We’re in business! Never-you-mind that I don’t have any cash. A quick trip to the bank and then off to see about buying an antique from someone we’ve never met from the Internet.
Half an hour later and we’re on our way home with a slightly battered cathedral style Philco radio. Which couldn’t be more steampunk if it tried.
First things first, haul the guts out and wipe them down with a damp cloth, this thing has accumulated eighty-ish years of dust. A little squint at the insides tells us it’s a “Chassis Type 44 Code 121”, a little bumbling on the Google and we learn that it probably dates from 1933. A little more Googling and we have the user’s manual, as well as a circuit diagram in all of its tube-y glory. It would be nice to re-use some of the tubes (They say tubes have a nice warm sound.) to build the audio amplifier part of this project, but I only have three months and taking a peek at the underside of the chassis has quashed that idea but good. It’s going to be hard enough to get a solid state amplifier built in time.
After that have a go with the knobs and discover that the tuning knob doesn’t work: the little rubber wheel that turns the dial has long since dried up and ceased to be. The band switch is kind of cool: this radio has four bands and by rotating the bottom-center knob, a rack and pinion mechanism pushes a little carriage with a light-bulb in it up and down to illuminate the correct range on the dial. On-Off-Volume knob has a satisfying click and smooth action as you turn it.
It’s important to note at this point that this entire project is about aesthetics. It would be quick and easy to slap a couple buttons onto the Raspberry Pi and plug in a set of powered speakers: done. Done, but not the feeling we are going for. We want, as much as possible, reproduce the experience from the days of yore.
So, let’s think about using the radio. It’s time to sit down and work out some goals.
The radio stations should be in consistent places on the dial, so if you tune to 31.4 you always get the same station. To do this we need to know, with fairly high accuracy, where the dial is positioned at any given time. There are a couple standard solutions to this problem.
Let’s see what is on hand that might work. Rooting around in my parts bin, I find a couple of stepper motors. A stepper gives a train of pulses when turned. Provided you turn it fast enough. Also they’re not so much pulses as sine waves. And at best you get 200 steps per revolution, which is way too low. And on and on, and the thing ends up being way to much hassle.
Optical encoders are another solution, but they’re also an incremental device; they tell you how far you’ve moved, but not where you are. For this project, I’m looking for the position of the dial, so they are less than helpful. You could get there with careful counting, provided you knew where you started, but it’s altogether easier to navigate by looking at road signs than counting the exact number of steps since you left home.
All of these choices suck. Fortunately, there is at least one more option: Magic— er— I mean the AS5601, which is packed full of magic. You just wave a magnet around near it, and it tells you, over a nice serial bus, what the angle of that magnet is. With a maximum resolution of twelve bits per revolution, that’s 0.0879°. For $5. Okay, it has its own flaws: it only comes in surface mount, for example. But compared to other options? P.F.M.
As you dial around on an analog radio, stations fade in and out gradually. The digital world is either on or off; analog is fuzzier. We want to mimic that fuzzy. With enough resolution, we can pretty easily tell when we are only close to a station and adjust the audio to produce appropriate fading.
The radio has gearing (well, friction drive) so that rotating the tuning knob does not turn the dial by the same amount, I think this gearing is essential to the effect of the great heavy dial.
The original radio had four bands; I’d like to keep all four if possible. The clunk-clunk-clunk of the band switch is nicely visceral.
It would be fun to take one of the bands and make a time machine out of it. Dial something in the 30’s and get jazz, Bing Crosby and Fred Astaire. Dial up the 50’s: dreamboats and petticoats. 70’s: Pink Floyd and Disco. 80’s: Madonna, U2, Queen. But, again, three months.
- I want it to be loud for two reasons:
- I am fed up with the dinky little powered speakers I’m currently using.
- So I can say: “This one goes to eleven.”
Okay, back to bashing on the radio. It’s now time to make an irreversible decision. Do I try to repair the radio, or do I start taking the guts to bits? On the one hand, it could be restored (It’s almost certainly non-functional as it is, the capacitors (condensers in those days.) will have all dried up and need to be replaced.) but, on the other hand, if I do restore it, what do I do with it? I’ve already got plans for the nice wooden box it came in. It also might be handy to scavenge some parts from the original, and I certainly can’t fix it if a few small but vitally important bits are part of another project.
Decision made. I don’t necessarily want to destroy the works, but I’m not going to take pains to save them either. I’m certainly going to cut off the power cord so it can’t be casually plugged in and, just as casually, kill someone. In fact, let’s do that now. —Snip— While I’m cutting things out, I carefully clip the two little wires going to the light-bulb behind the dial. If I power that up separately, I will be able to see what the radio looked like when it worked.
At this point I’m still hopeful that I’ll be able to use many of the mechanical bits from the original radio. The more I can steal, the less I have to invent. As previously mentioned, the tuning knob no longer turns the dial, it’ll need some work.
So, wire up the little lamp and take a look, How much can I save? The detents that latch the carriage into lighting each band are no longer aligned with the bands on the dial. Also, the dial no longer lines up with the hole in the front of the cabinet, the bottom-most band is half obscured by the case.
Unfortunately, it looks like I’m going to be building a fair bit. Dig out a set of calipers and start measuring the cabinet: three knobs across the bottom, the tuning knob in the center, a window above that allows the dial to be read. Positions and sizes of all these holes are sketched and noted. Fire up LibreCAD, and draft up the holes.
Time to sit down and do some thinking. The original dial had bands covering 180°, I can reasonably do ¾ of a circle; more room is more stations. After a couple measurements of the original and a little thinking I decide that 12:1 is a pretty good gear ratio knob-to-dial. How does one draft gears? There are a million places to learn about gears, ranging from a nice overview of useful things to More than you ever wanted to know (Why does everything have to be named pitch?) and also this guy, who has done all the things out of wood. LibreCAD doesn’t draw gears, but Inkscape does. A little tinker, a little export / import, and we’re off to the printer.
The library has a couple of 3D printers, so I can definitely custom make parts. I’ve done some printing, but I don’t know what sort of tolerance these printers have. No one at the library knows. So we make a guess and have a couple gears printed, so we can measure and see how close they come out.
Upon further reflection, they don’t need to be all that tight, as long as I’m careful to design with an abundance of slop, the parts can all be a little out of whack. Of course, by the time I work this out, the gears have already been printed, Oh-Ah.
I really wanted to reproduce the band light carriage mechanism from the original radio. Unfortunately, getting the detents to have the right stiffness, being able to detect where the carriage is, and the fact that this thing has to be ready to go in three months meant that multiple LEDs was just easier all round.
I know the hole is 1½ inches tall, exactly how wide can I make each band and still have clearance between each of them and also the edge of the hole? Will they still be big enough to read, or do I need to drop down to three bands to get acceptable spacing? Math, math, math. It should work, I hope.
About now I definitely need to order parts. Over the last couple months I’ve been building a shopping cart at Mouser: spare LEDs and wire and such-like. Add the AS5601. We also need some LEDs to light the dial. The original was a little light-bulb, so what colour of LED do I order to match? We’ll try “warm white” and amber. I have red on hand and don’t like the look. I do a little research and find a promising audio amplifier, the TPA3122D2. Always order two of everything, unless there is a decent price break at 100. $200 later and things are on the way.
Since we’re using a Hall effect sensor to determine the position of the dial, we’ll need to order some magnets. And, since they’re cheap, we’ll order spares. (Also, I love tiny, powerful magnets. I’m scared of big powerful magnets.)
Now, I don’t have a soldering iron at this point. I left the last one I had in Japan. That was the second time I'd sworn a solemn oath that I was never again buying a cheap soldering iron. This time I would spend the money. I’ve used and enjoyed Weller and read good things about Hakko. When I went to order, Weller won on price (and has a nice knob), so Weller it was.
While I’m poking around in the underbelly of this thing, I pause for a moment on the On-Off-Volume switch. Prodding around with a multimeter reveals that it’s about a quarter megaohm and, also, the switch doesn’t seem to work. Can I order a new one? I cannot, at least not with the same long knob shaft. I can find something that will work, provided I can figure a way to extend the potentiometer shaft to the knob, how hard can that be? Ordered.
Because it was the 1930’s it was hard to make permanent magnets of any strength. The original speaker is therefore a somewhat complicated contraption with a field coil to produce the static magnetic field and a voice coil to move the speaker cone. “Of course,” said the engineers, “that field coil represents a lot of useful copper, just a sitting there. Why not make it do some other useful work? We could use it as the filter-choke in the power supply.” That has side effects; any noise on the incoming power comes directly out the speaker. “Okay, we’ll fix that with another coil wired up to pickup the noise from the field coil and feed it backwards through the voice coil, nicely canceling the hum we just introduced.” It really is this rube-goldberg mess. Read all about it in nauseating detail.
So, rather than deal with that nightmare, I am just going to order a brand spanking new speaker off Amazon. It turns out to be impossible to order an 8 inch speaker from Amazon and not have it arrive bent. I tried. Twice.
How many power rails will this thing have? Five volts for the Pi. 3.3 volts for the dial reader. Twelve volts for the audio amplifier. Too damn many. I can’t get away from 3.3 volts because the Pi’s GPIO is all 3.3 volt. I’m stuck with at least twelve volts because anything less doesn’t drive the speaker loud enough. I could do away with the five volt rail if I’m willing to bypass the Pi's regulator and chance the wifi card not working. Bad options all round.
So we get on flea-bay and, turns out, twelve volt power bricks can be had for $10, and buck regulators are a buck. (Hah! Electronics geek pun; is there no depth to which I will not sink? There is not.) Order those.
Now that all that stuff is in the post (mostly from China), it’s time to take a look at the new dial. We are going to want to achieve a look somewhat like the original, but if we can make it look good and be more legible, that’s all the better. Since there are no hard and fast rules about what numbers we’ll be putting on the dial (Not like these are actual frequencies, or we’d just have 2.4GHz all around the dial), positioning stations is going to be a little ethereal. Let’s put some markers down. Unicode is full of fun little symbols. A few of them scattered around the dial will give us some anchor points to make finding things a little easier, not to mention add flavor.
Conveniently, for problems like “What font should I use?” or “Which symbols should be on the dial?” I have Heather. Who loves fonts. (It was an ordeal to keep the number of fonts on this blog down to a reasonable number.) She heads off to 1001fonts.com and finds Coventry Garden which has delightfully art deco numbers.
The other thing we need for this project is a collection of stations to scatter around the dial. I send Heather off to Shoutcast, and soon have more new-age and world music than I know what to do with. Quote: “I don’t know what language it is, but this is cool!”
Wait, we’re actualy going to build something?
I have a Raspberry Pi on hand, and with only a little jiggery-pokery, it can be persuaded to make music. The radio only has one speaker, so we’ll have to down-mix the stereo coming out of the Pi. (Combine the left and right audio channels.) It’s probably possible to do that trick in software, but in the end to do it in hardware amounts to a couple resistors. Of course, if we’re going to the trouble of building hardware, I should dig out an op-amp and build a pre-amp.
Dig out a breadboard, and start fussing around with fiddly little wires. I can now make my dinky little powered speakers loud. Overdriven, even. Pull the volume knob off the old radio and wire that in, and we have some control. It’s nice to be able to watch television and actually hear it.
In a week or so, the magnets and parts from Mouser show up. A little 3D work and I have a socket and magnet holder to test the dial reader. Go read about interfacing the i2c bus from the Pi. Solder that little surface mount part to a breakout board. Whip up a little Python. Bingo bango bongo! I get a number that tells me what angle the magnet is at.
A little more Python and we have a pseudo-radio. Turn the knobby and it snaps to the next channel. A little more Python and it fades in and out as you tune nearer and farther from the station. This is fun, but currently way too sensitive to actually use. 4° just about covers the entire range where a station is audible. I think it’ll be better when we get the gearing in place.
Time to get that audio amplifier working, I breadboard it out and spend a couple days trying to figure out why it doesn’t want to go. Some increasingly fruitless Googling and the best I can come up with is “Layout matters, it probably won’t work on breadboard.” Fine. It doesn’t take too much thrashing around before it makes sense to just order a little class D amplifier board that has already got the layout right. Couple bucks on Amazon; I just hope it gets here in time.
While we’re on the subject of audio, I finally decide what to use the spare knob for. I decide to make it and aux-in. Plug any audio source into it at the radio becomes a powered speaker. Super clever? No. Useful? Yes. I also throw out the pre-amp. It’s a useful piece, but at this point I don’t think I have time to debug it, and I have enough gain to be 11-loud.
We’re making progress! What’s next? The band-wave switch. I really wanted to make a little carriage that slides up and down like the original had, but after printing up a mockup of the detent mechanism, I don’t think I can get it to work. Let’s get the band lights working. Trying our new warm white LEDs reveals they have a disappointing bluish hue. Not the look we want. However, the amber ones work a treat. It’s not a perfect match, but it looks nice. We want the LEDs to have a somewhat diffuse glow, so a touch with some sand paper and they are no longer water clear, more like frosted glass. Getting them wired to the Pi is pretty simple too. The Pi has a library that makes bit-banging the GPIO painless. Four transistors, a current limiting resistor, some wire-wrap wire, and we’ve got blinkenlights.
The switch I ended up with is one of the few things about the radio I’m not completely happy with. In the end, I probably should have just bought a four-position rotary switch. But I didn’t. I 3D printed a semi-circle with little magnet holes around the rim. 50¢ or so each for 10 magnets, about 50¢ each for four hall effect switches. $6 or $7 for the whole thing? Could have just bought one for that. It does have delightful cogging action, that nice clunk-clunk-clunk, and it has no physical contacts, so it should last forever.
At this point I’ve got models of all the various bits of this contraption, now I need a framework to hold them all together. Time is really getting short by this point, so there’s less artistry than I would have liked. Write a little macro that generates straight segments between points, and it’s all down to plugging in a list of shaft positions, picking places for bolts, and trying really hard to ensure that no two things are trying to occupy the same space at the same time.
As I’m doing all this 3D printing, people at the library are wondering what I’m up to. Because I’m kind of an ornery cuss, I decide it’s going to be a secret until the actual day of. I got lots of guesses that it would be a clock, and I can see why.
Okay, mechanical is pretty well sorted, electrical is just down to connecting all the bits, and I’ve got a brand new soldering iron. Have I mentioned how much nicer it is to solder with a temperature controlled soldering iron? It’s better. I’ve not drawn up a circuit diagram, but I have connected and tested all the pieces, so it’s just a matter of getting everything connected at the same time. I have to spend a little time here to monkey with the band switch to figure out how to detect all four positions. In theory two bits is enough. two bits means two sensors. However I hadn’t really planned this piece out and end up using four sensors in the end. I’ve got them on hand, can afford the I/O pins, and am in a hurry.
Time is getting very tight now; hurry hurry little dragon, hurry hurry. I have to anchor the radio guts to the inside of the cabinet somehow. Using the original bolt holes seems the most elegant. Set the insides into place and measure how much tweaking needs done: ⅛ inch too low. A couple holes there, add sockets for the legs built into the bottom of the radio, bump it up to compensate for the ⅛ inch; I consider building a socket for the Raspberry Pi into this base plate, but time and tides are upon us. Fast, Cheap, Good; pick two. At this point: fast. Fast above all else. Get it printed. Go go go. Off the printer and the sockets for the feet are tight, file the feet down a little and it works nicely. Stuff it in and bolt it down. Hardware all in order.
- The software comes together nicely. In the end it’s five pages that boil down to:
- Figure out where the radio is tuned to.
- Figure out what station is closest to that tuning.
- If we’re not playing that station, then play that station.
- Adjust the volume so the closer we are, the louder it plays.
- Do it again.
A week to go and we still haven’t actually put stations on the dial. Heather and I sit down and decide what each symbol should be. After that, roll the dice to determine where to put the rest. Spend an hour sweeping through the bands, making sure that there is enough distance between adjacent stations. Move this one there, spread these out a little, try to maintain stochasticity without clumping. Discover during this process that one of the streaming services plays pre-roll ads as you tune in. It’s not the end of the world, but it does mar the illusion to hear the same ad everytime you tune to a new station— so: pick new stations, re-roll the dice and redistribute them all over again. More time lost, but I think that takes care of the last of our problems.
The day dawns and guess who’s nervious? Me. That’s who. Public speaking is not my strong suit. Nevertheless, here we go. Pack all the things. Pack up the radio. Pack up the bill of materials. Pack up the station list. Pack up a printout of the program that runs the thing. Haul it all to the library, up to the 3rd floor; wait for a table, then set up. It’s not long before I start getting questions. Next thing I know, it’s two hours later. Time to clean up, declare success, and go home.
Learning and Mistakes
As I mentioned, the bandswitch would have been faster and cheaper to just order rather than trying to build my own. I knew I couldn’t possibly order a carriage and that got me locked into the mindset of building one. When the carriage turned infeasable, I was still set on building the solution.
Right now, the Raspberry Pi, buck converter, and audio amplifier are all floating around loose. It would have been better to print sockets into the base plate for them, and perhaps I’ll revisit the base plate at another time.
I had hoped that I’d be able to take the radio apart and put it back together again to show off the insides. Sadly, I overlooked a detail and the dial does not maintain indexing through a disassembly / reassembly cycle. I have a plan for next time. In a similar vein, bolt heads take up space. It’s important to remember that.
I didn’t add up power requirements, so I have overspeced the powersupply by a fair bit. On the other hand, I didn’t have to worry about power. On the subject of power, it might be nice to add a battery to this project, but that doesn’t seem useful while it remains a wifi-only radio.
It would have been fun to make it mixed mode; take a band and make it recieve actual radio. An RTL-SDR dongle can be made to tune FM and rtl_fm is light enough to run on the Pi. If you want to do AM or shortwave, the kitting up gets a little more expensive. How would the software work for this? Dunno, didn’t flesh it out as part of this project.
I didn’t end up building the time machine into a band for a couple reasons: It was getting very late in the game by the time we got to placing stations on the dial, and I wanted a good mix over the rest of the dial. Segregate out the decade by decade music and you’re left with NPR, talk radio, and world music.
All in all, it was quite a fun project, and the time pressure kept feature creep from getting out of hand. Would I do things differently next time? Of course, but it came out looking nice and works quite well.