Smart phones have taken the place of a lot of different devices especially as they get more and more powerful. GPS, music and video player, email, and of course a phone are all functions tied up in these general-purpose devices. Another casualty of the smart phone revolution is the humble bedside alarm clock as its radio, alarm, and timekeeping functionalities are also provided by modern devices. [zst123] has a sentimental attachment to the one he used in the 00s, though, and set about restoring it to its former glory.
Most of the issue with the clock involved drift with the timekeeping circuitry. Since it wasn’t accurately keeping the time anymore, losing around 10 minutes a day, the goal to save it was to use NTP to get the current time and a microcontroller to make the correction automatically. Rather than replace everything in the clock except the display, [zst123] is using the existing circuit board and adding an ESP8266 to grab the time from the Internet. A custom driver board reads the current time displayed on the clock directly from the display itself and then the ESP8266 can adjust it by using the existing buttons through a relay wired in parallel.
Using the existing circuitry was certainly a challenge especially since the display was multiplexed, but the LM8562 that came with these clock radios is a common and well-documented chip for driving displays like this, giving [zst123] a leg up over something unlabeled or proprietary. Using NTP is certainly a reliable and straightforward way of getting the current time too but there are a few other options for projects like these like using GPS or even a radio signal.
I’d have thought a clock of that age was using a mains frequency counter to keep time. They shouldn’t wander.
The input circuitry probably “misses” some cycles. Also, if the clock no longer detects cycles it will switch to a 900 Hz RC oscillator. This feature is normally used to keep time using a 9V battery in case of a power outage (in this case the clock keeps time but nothing is displayed as display multiplexing is done by the mains frequency using a transformer with center tapped secondary)
I have a few that are old enough that the electrolytic caps have dried out, and were having similar issues. Replacing the caps restored them to their former level of performance. It’s amazing how much ripple those old MOS circuits will tolerate.
@dudefromthenorth said: “I’d have thought a clock of that age was using a mains frequency counter to keep time. They shouldn’t wander.”
The mains line frequency (e.g. 50 or 60 Hz) might not be as stable as you think, unless you keep a long-term moving average either computed and/or via a Phase-Locked Loop (PLL). This is especially true outside of the United States, Canada, United Kingdom, European Union, Australia, and Japan, currently the countries where Time Error Correction (TEC) is employed.[1][2][3] This may or may not matter to you. If your clocks do not display seconds (a seconds-challenged clock), and you are fine with that, then so be it. Personnaly, clocks that omit displaying seconds drive me crazy, I do not even consider them to be real clocks!
* References:
1. Utility frequency – Stability
https://en.wikipedia.org/wiki/Utility_frequency#Stability
2. 60 Hz AC Mains Frequency Accuracy Measurement [Scroll to the bottom of the page and look at the 70-day FREQUENCY DATA graph that uses samples that are ten-minute moving averaged.]
http://www.leapsecond.com/pages/mains/
3. FNET (Frequency monitoring Network) – Oak Ridge National Laboratory & University of Tennessee at Knoxville
https://fnetpublic.utk.edu/
https://en.wikipedia.org/wiki/FNET
I non-destructively added GPS to a Heathkit clock: https://www.galacticstudios.org/heathkit-clock-hack/
I still run a 1970’s cube digital clock radio, it was $1 at a garage sale. Stone reliable.
Line frequency is run through a one transistor phase-shift oscillator as AC REF for the clock IC, MM5316 or Sanyo LM8361. It debounces and filters any mains hash.
On power fail, the osc and IC are powered by a 9V battery, the VFD filaments go out so no drain there. But the alarm does not work – once I had a power outage during the time I was supposed to wake up, no alarm beep or radio at all and I was late. DST is a hassle to (re)set the time twice a year.
I had to laugh, no sign of a battery in this MCU version. It would not wake you up if there is a power outage. Sorry, boss.
Just don’t carry it around. Someone rebuilt a clock without putting it in a housing and ended up getting swarmed by police over possible bomb threat.
Some of those clock chips or modules were not muxed because it causes radio interference and they were put in clock radios back when AM still mattered. AM is very hard to put in a phone or any moderen small digital product.
I would have made the time signal GPS or WWVB and get sent in the time base pin. One wire, and ground.
Trump wanted to kill WWV & B and the bean counters want to stop keeping the grid frequency corrected to such good standards as it has been. So we all may need to mod up our clocks someday. I have a foot wide LED clock which I saved form a quick mart dumpster with the ads overlaid for a well known cigarette brand. When the campaign ended, it got trashed for time, times N for a national ad campaign. The two set buttons were junk and dirty, but it worked for a live event where there were no visible clocks or TV’s for Y2K. We partied!
The provided project sketch has no NTP code. ICK. I use the ESP8266 NTP library and it’s great for 2 years now, once you figure out how to set location. Loss of WiFi it does drift quite a bit. But DST it auto-adjusts nicely.
Just wondering if it would have been easier to remove power from the chip to get to a known time of 12am and then adjusted the time from there? If you thought about this is there any reason this wasn’t done? Also it made me think of this earlier hack https://hackaday.com/2009/07/24/adding-rds-decoding-to-a-vintage-radio/.
p.s. cool hack