The WalMart Atomic Clock

In the realm of first-world problems, your cheap wall clock doesn’t keep time, so you have to keep setting it. The answer? Of course, you connect it to NTP and synchronize the clock with an atomic time source. If you are familiar with how these generic quartz clock movements work, you can probably guess the first step is to gut the movement, leaving only the drive motor.

The motor is somewhat like a stepper motor. The ESP8266 processor can easily control the clock hands by sending pulses to the motor. The rest is simple network access and control. If the network time is ahead, the CPU gooses the clock a little. If it is behind, the CPU stalls the clock until it catches up.

If you’ve ever done a project like this, you know there is one major problem. At some point, the processor needs to know where the hands are now. On initial setup, you can force the issue. However, if the power goes out, it won’t work well. If the power goes out at, say, 8 AM and turns back on at 9 AM, the CPU will be happy to correct the time to agree with the NTP time. The problem is that the processor has no idea that the hands started at 8 AM, so the time will be off.

To combat this problem, the design uses an EERAM chip to store the current time. In the event of a power failure, the CPU knows where its hands are and can adjust accordingly.

While you usually use these movements to keep time, once you can control them, you can do any crazy thing you like. Or, even anything as artistic as you can dream up.

28 thoughts on “The WalMart Atomic Clock

  1. Nonsense.
    Why make an independently running clock dependent on variable factors?
    A stable connection to servers on the internet is not a given, it is not absolutely no guarantee of a reliable time display.

    1. Yeah, if you’re using an esp already why not throw in a GPS module and have the clock sync to the GPS clock. With the benefit of it also being able to automatically change timezone.

    2. You might not know that NTP servers are free to run at home, even if you are disconnected from the internet.

      You can even use GPS modules and small computers to get a VERY accurate time, no matter where you are or how long you go without internet connectivity.

  2. An advantage of cheap wall clocks is that they run on batteries.
    The major problem I see here is a USB cable dangling from this clock.
    With some more design effort, the author could have fixed this. There’s plenty of room for batteries.

    1. Batteries to run out 12 times per year…
      Let’s face it, the clock that is was before it was modded, was pretty good enough.
      But where’s the fun in that?
      Clock projects are never about time keeping, they are an excuse for a finished project to be on constant display. Which is one of the reasons I love projects like this.

      1. Indiana has 6 or 7 time zones listed under some linux installations I’ve come across. Little towns along the border in the northwest corner near Chicago are listed along side countries allover the world. Indiana has 2 time zones with 3 areas. For some time we didn’t change to DST leading to the phrase “what time is it in Indiana”, any way you look at it we are a temporal anomaly. Even current Windows time settings have our state singled out of the 4 time zones, a lot of us Hoosiers want off of DST so that Windows setting can be clicked on again.

        Any of the wacky clock projects I’ve seen here could have a Hoosier theme.

    1. 4 continental time zones plus Hawaii, Alaska, Guam, Samoa, etc.

      Continental states (like mentioned Indiana) had different time zones because they had hub/hubs/junctions between different railroad companies.

      US time zones were the huge compromise that drew on the more-or-less distinct state lines, which originally were another compromise – most, if not all, were drawn according to the railroad companies’ “territories”.

      So, in very real sense, just like Fahrenheit, we are stuck with the railroad legacies that refuse to go away. Just like the width of the original rail gauge (EU one, not the US one) that was based off the standard width of the roman roads, that were roughly equal to two horses’ butts.

      Same logic there, no logic whatsoever, we are just stuck with the legacy of the companies that no longer exist.

    1. Could have just taken out the module and replace it with this for €12,64.

      https://www.amazon.de/-/en/TFA-Dostmann-60-3518-01-Radio-Controlled-Clockwork/dp/B00TOBU9B6

      It also has some kind of interface, and you get two sets of hands for free with it, classical and modern.

      This is what I have done with every clock I have. Just have to take care to order the right diameter of the shaft, and the right length of the shaft.

      I guess this can be called a fun project, but I don’t really see the use. :/

          1. It’s a felony to broadcast radio signals outside of 2,4 GHz ISM band if you do not have a valid HAM license. Anyone can post AI slop on GitHub but DO NOT RUN IT unless you want to end up in a federal penitentiary serving a 10+ years sentence for radio piracy.

            Let me rephrase again if you don’t understand: IT’S ILLEGAL AND FORBIDDEN. DO NOT RUN.

          2. Regarding baltar’s somewhat strongly worded comment: technically correct but misses two important bits.

            1) A ham radio licence will not grant you the rights to transmit on the DCF77 (77kHz frequency). They only allow access to specific frequency ranges allocated to the amateur radio service.
            2) Even if it did, the wavelength of a signal at 77kHz is almost 4km or 2.8 miles. You would need a huge antenna and a lot of power to transmit any distance.

            The intended use case of the DCF77 ‘faker’ is probably that you’d disconnect the ferrite rod and inject a signal directly, or wind a couple of turns of wire around it and inject the signal into that.

            FCC Part 15 sets the power limit for transmissions on licensable frequencies – with either of the options I proposed, you won’t get anywhere near them.

            If you do manage to exceed the Part 15 limit by a decent margin, I know a few high-power transmitter manufacturers who’d be real interested in that technology – so long as it doesn’t involve power shards or somersloop.

            As usual the technical explanation is less sexy than the world-fall-down one but hey, it’s the internet, what can you do?

  3. I saw a project once, where they detected as the hands passed a certain point, by use of infrared sensors behind the face shining thru tiny holes, that would reflect off of the back of the hands as they passed. That would at least allow you to verify the time displayed is correct, once the hands reach that point.

    As for power loss, there is this thing called a “battery” that could keep the microcontroller going for quite a while. You could hide at least 2 or 3 16850 cells in the back of the clock.

    1. That’s a neat hack (detecting the hands’ positions). I was thinking “two gray code wheels rotating with the hands behind the dial”, which would be too complicated, as I’d have to design and build my own three-axle shaft (or two-axle for hour and minute hands only).

      Makes me think perhaps flip clocks were simpler to read off of. One could mark the flips with binary code (or gray code) dots and read those with some kind of 8-bit sensor with IR.

      Something like that.

      1. Most of these cheap battery powered wall clocks have a little knob or something on the back for setting the time. Said knob is always connected directly to the clockwork, so all you need is to set the clock to 12:00 and attach your encoder to it.

        1. That’s exactly how the ~100-year old electric clocks in the factory/offices/schools worked; it was assumed that they mostly slow down, so at the top of the hour there would be a jolt forcing the minute hand to 12 and the seconds hand to 60. Sometimes there would be an audible whistle, too, but it was not related.

          Radio signals emitting beep at the top of the hour is kind of sort of legacy of the electric clocks, though, the nationwide need is no longer there. Still, the audio signals are tuned to certain frequencies/frequency, so I am pretty sure some clocks out there still react to these signals, probably legacy punch clocks. BBC World News still transmits the top of the hour signals, and so do some of the US stations, though, not many that I am aware of.

          Regardless, most of these inventions were for the analog clocks that were not tied to the electric grid’s 50/60 Hz, which kind of made electric clocks sync mostly obsolete, as the mains-powered clock now would be mostly on time. As usual with any of these, a power loss would leave them off – that problem was never reliably solved, analog clocks still needed humans to set them to the correct time.

          I find it funny how 100-year old issues resurfaced with the cheap analog clocks, and how solving these issues came full circle to the idea that humans are still needed to tend to the clocks, lest one figures out how to auto-set them.

          I still remember when we had this ~weekly routine of “resetting clocks/watches” whilst listening to the radio signals, and radio-set clocks were something quite exotic, ie, I’ve heard they existed, but never seen one in person.

  4. The one DCF77 clock I took apart uses an infrared LED + photo diode to detect if the handles are in one of, IIRC, 3 specific positions (LED shines through holes in the gears). Since it knows how many steps it took to get from one of these positions to the next, it knows on the second position on which of the three it is. In my case the LED had to be replaced to stop the clock from endlessly trying to find one of the positions.

Leave a Reply to JureCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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