Midnight Angel, won't you say you will? -- Pat Benetar, Shadows of the Night

I Made a Thing! Clock Radio Project

This is a GE 7-4680A clock radio. There’s nothing much that’s special about it. They pop up on eBay a few times a year for prices in the $25-$45 range. I have no idea when it dates to; its date markings are in some kind of code. I know they were produced at least as early as 1982, probably much earlier. It has an AM-FM radio and TV audio tuner that’s backlit with a small incandescent bulb. Its single monaural speaker has a nice warm tone. I don’t know what it is about old speakers. They don’t sound perfect, but they tend to always sound fine. Modern speakers either sound great or sound like shit, with nothing in-between. Setting the time is limited to two buttons, one of which advances the clock slowly, the other advances it quickly. If you miss, you have to go all the way around 24 hours to try again. It has no battery backup, and has to be reset after even the briefest of power outages.

Click to Enhugen

One very much like this one sat on my mom’s nightstand as far back as I can remember, up until some time in the early ’90s, when she got a new one, then it sat on my headboard for the rest of the ’90s and then it went off with me when I moved out. It had what I’d always assumed was a little fresnel in the clear front panel over the dot that lit up to indicate PM. Turns out that was actually a cigarette burn.

By 2016, a couple of the LEDs were dimming and the front panel was loose. There was a short in the time-setting buttons so that if you pushed them, there was a chance it would just instantly jump ahead 78 minutes. So I started looking for a replacement on eBay, and ended up buying two. Some time in 2017, I dropped the water tank from my CPAP machine on it and the alarm started buzzing and never stopped. That’s why the one in the picture there is not the one I grew up with.

I have an unreasoning nostalgia for this model of clock, though it’s certainly not anything useful or modern. So since I had both a fully functional replacement clock and also a spare, I decided to build a thing.

You’ll recall that a few months ago, I gave Dylan a small network-connected music player I’d built. And part of that project was coming up with a quasi-standardized way to put together a Raspberry Pi Zero W-based network connected music player. So I reckoned, why not take that, and make a clock.

Three Texas Instruments CDB4543B BCD-to-7-Segment Latch/Decoder/Driver chips

So that’s what I did. I had a go at using the original display panel, since it was a much better fit. But it’s weird ’70s LED technology with a 20v forward voltage drop. Where the hell was I going to get 20 volts to drive that? And then I burned one of the lights out trying to figure out the pinouts. The driver chip for the LED had a number on it that led me nowhere, so I was shooting in the dark for how to make it work; the display itself had a 20-pin ribbon cable that had become stiff and fragile with age. There were more lights on the panel than the clock actually used, including a colon for separating hour and minutes. None of the pins seemed to work it.

So instead, I got four 7-segment modules and hot glued them into a frame made of styrofoam, cut to size. The displays had a little decimal dot in the corners, so by turning the first one upside down, I got the AM/PM dot for free.

To drive them, I wired up three BCD-to-7-segment decoders, connecting their output pins to resistors and then to the LEDs. Now, the BCD input is four pins, so it wasn’t practical to wire each chip to its own set of pins on the Raspberry Pi. But the chips I used have a latch, which means I could use the same four pins to connect all three chips, with one pin for each chip to select which one was unlatched. The code’s pretty simple: set the pins for the first digit, cycle the latch, rinse, repeat. The fourth digit and the AM/PM indicator I controlled from two more pins on the pi, connected to transistors.

I wanted to make the setup dimmable. For that, I built a PWM module out of a 555 timer, driving it from the radio’s dimmer switch. I just used trial and error to find a good capacitor for it. It was kinda neat watching the LEDs strobe when I had the capacitance too high. For the directly-connected LEDs, dimming was easy; I just attached the PWM output, the LED, and the IO pin on the Pi to the three pins of the transistor. When the IO pin goes high, it lets the 5 volts from the PWM through to the LED, lighting it up to a brightness determined by the position of the dimmer.

For the three displays controlled by the BCD-to-7-segment decoders, I took advantage of the fact that the decoder had a blanking pin. Hooking the PWM to that effectively works as a dimmer, cutting the signal to the LED for a fraction of each cycle. I found it a little remarkable that this method led to all four digits having the same brightness. At least, once I had the right kind of transistors to make the dimmer work in the same direction for the fourth digit as for the others (For obvious reasons, my first try led to the digits disagreeing about which direction was “brighter”).

So I had a working, dimmable clock. Halfway there. The next half was to make it a working radio. After gutting the ancient radio parts (and discovering the rather lovely way the tuner worked – the dial was connected by fishing line to the mechanical rod that showed what you were tuned to and also to a wheel on the bottom of the chassis that turned the actual tuner on the circuit board), I mounted my pi and hooked up the audio bonnet to the built-in speaker. It didn’t seem to put out much volume. I tried adding an amplifier, but I couldn’t get it to sound good, so I gave up. Turned out not to be a big deal since once the case was together, the sound was fine. But there was still the matter of volume. Of course, I could just do everything in software, but I liked the idea of being able to physically control the volume. The radio’s original volume dial is mechanically connected to an audio taper. I tried just passing the audio signal through it, but it didn’t give me usable volume control – basically just went straight from mute to full-blast. After trying and failing to build an analogue-to-digital converter from scratch (in principle, you can do it by measuring how long it takes a capacitor to discharge), I just bought an ADC and wired it to the volume dial. A program on the pi polls the ADC, and then does a bunch of math to convert the value into a percentage. Since an audio taper is logarithmic, this involved me guessing at constants until I found that raising 0.5 to the ADC reading gave me a number in the range -0.3 to 13.5, and how far into that range the result was approximated what percentage of the dial’s travel it had turned, so then it’s just simple math to turn it into a number between 0 and 100 and tell the software mixer to set the volume to that. But also, the signal from the ADC is pretty noisy, so I added a lot of averaging and threshholding to keep it from constantly jumping the volume up and down.

Since I already had all the code to do it, I also added a temperature and humidity sensor, and then I did nothing for about 8 months because I was stymied by putting it all together.

But then Sunday night, I decided enough was enough, and if I didn’t get this sorted soon, I never would. So I just hot-glued the last few pieces into place and shoved hard until everything fit.

So close…

It’s not perfect. The LEDs aren’t quite the right size and don’t look quite as nice. They’re quite a bit brighter than the original, and it would’ve looked nicer if I had a dark red translucent mask to put in front of the LEDs to make them less visible when they’re off. I also twisted one of them a little putting it in, so there’s a slight problem with the alignment. Even worse, the pin for the lower half of the high digit came loose so only half of the ‘1’ lights up from 10 to 12. The buttons don’t do anything other than the dimmer. I had hoped to make them work as controls for the music player, but I came to a point where I just had to stop and produce something functional.

More concerning is the possibility that the SD card in the pi is going bad, since pulling that out requires disassembling everything. But it does work. And it sounds good. And – get this – it sets the time all by itself, adjusting for daylight saving and getting the right time from the internet after a power outage.

Also, it weighs basically nothing now and uses barely any electricity. So in all, I’m pretty pleased with myself, and am giving serious thought to an even more ambitious clock..

I have no idea how to actually build this, but I do know how to program it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.