Converting a $3.88 analog clock from Walmart into a ESP8266-based Wi-Fi clock

346 points - today at 4:26 PM

Source

Comments

teraflop today at 5:04 PM
Cool project!

The most interesting part, IMO, is the "SRAM with EEPROM backup" chip. It allows you to persistently save the clock hands' positions every time they're moved, without burning through the limited write endurance of a plain old EEPROM. And it costs less than $1 in single quantities. That's a useful product to know about.

riskable today at 5:13 PM
I want to see someone convert one of those cheap projection clocks like this: https://www.homedepot.com/p/La-Crosse-Technology-5-in-Color-...

The red projection is just the right brightness (at night) but it sucks that it's not wifi-enabled so you can't just get it to NTP sync (or hook up a GPS receiver). The projector part of the clock is a separate device that's attached to it via a ribbon cable. I would reverse engineer it myself but I haven't got the time.

Ideally, I'd want a matrix of LEDs projected on to the ceiling so I could get more info than just the time. Such clocks exist but they're super duper expensive! Example: https://buyfrixos.com/

sowbug today at 5:07 PM
If you like this but don't want to get your hands as dirty, have a look at the Crazy Clock: https://www.tindie.com/products/nsayer/crazy-clock/

I got one for my daughter. The erratic ticking eventually became a distraction when she was studying, so we have retired it for now. But we got a lot of amusement out of it.

freedomben today at 5:42 PM
Hell yeah, this is some badass hackery, and the type of stuff I love seeing on HN. In the last decade or so as more and more stuff becomes locked down and hacker unfriendly, I've found myself longing for simple things I can hack on. If I ever get to a point where I don't have to work for a living, one of the things I'd like to do is build everything from little gadgets up to major appliances that are simple, reliable, and hackable for people who want to. It pains me that my appliances have full computers driving them but I can't get access to them. Kudos for this awesome work and phenomenal write-up!
tanvach today at 10:23 PM
Related - we have an atomic Seiko wall clock expecting to have the time automatically adjusted by the WWVB LF atomic clock broadcast. Turns out, the signal is very weak where we now live. Manually setting the time on these atomic clocks is a HUGE pain (beware!).

Turns out it's possible to emulate the atomic clock signal quite easily with a Raspberry Pi, or in my case I put together Arduino code that can emulate atomic clock broadcasts from around the world using an ESP32 module using NTP servers: https://github.com/tanvach/clocksync

The history of these atomic clock broadcast signals and their differences in different countries is quite fascinating.

timonoko today at 6:37 PM
On that note: Converting €0 scrap into €400 video editing deck. https://www.youtube.com/shorts/KlWYC6mzVkQ

https://github.com/timonoko/Jogwheel

staplung today at 7:35 PM
This is cool but it seems like it would be liable to drift. I.e. it "knows" the correct time but doesn't have any way to figure out that it's been driving the movement fast or slow by some number of milliseconds. Eventually, that will pile up to the point that it's not any better than running the thing off of batteries.

As the author points out, the cheap quartz mechanism has no way of reporting the position of the hands (other than the hands themselves) and that you have to set the PULSETIME constant by the right number of milliseconds. If you're off by even a millisecond, that's going to accumulate quick enough that it would make a difference over even a single day, wouldn't it?

EDIT: as some have pointed out, the Lavet stepper theoretically accounts for this in that it steps exactly one tick after so many oscillations. That number of oscillations does not change so that's all you need to get right.

However, that basically just kicks the can down the road a bit in that if each step is not exactly 1/60th of a circle or bits wear down or get sticky or you have analog noise in there you will presumably still have a source of biased drift that you won't be able to detect. But maybe those affects are small enough that they don't matter for a wall clock.

KaiserPro today at 8:25 PM
If your budget is a bit more, and you want to hear a massive clunk every 30 seconds rather than a soft tick and you want to drive 2' (60cm) hands, then you might want this: https://waitingtrain.blogspot.com/2015/05/a-large-gents-turr...

The smaller ones look the same but are less beefy.

I used one to make this clock:

https://www.secretbatcave.co.uk/projects/electromechanical-c...

Which instead of using a well disciplined time source, uses a tuning fork and 74xx logic to drive it

montroser today at 6:13 PM
What I really want is one of these powered by gps. The time already comes for free in the signal, and from your location you can derive the time zone. That way DST is accounted for automatically, but you don't have to set up and rely on wifi. This would be truly zero-config and always correct.
debbiedowner today at 5:39 PM
How different is this to something you can buy like: https://www.amazon.com/ihreesy-Movement-Mechanism-Silent-Rep... ?
cbdevidal today at 8:45 PM
I’ve wanted to do this because there’s a zillion cool clocks out there that use a similar movement. I’d also wanted to make it battery powered which means doing NTP update only once per day (or less). Doubt that is realistic, tho.

Maybe embed Hall sensors and detect when the hands are in a certain position and when all three line up wake the ESP32, do an NTP update, tick it forward to where it should be, then go to sleep. Probably still use too much power, especially the Halls.

avidiax today at 5:14 PM
How does this keep track with DST?

Looking at the code [1], it looks like if the actual time is 1 hour ahead of the displayed time, then we get 10 pulses per second to leap forward. Otherwise, the clock stops running for an hour to fall back.

https://github.com/jim11662418/ESP8266_WiFi_Analog_Clock/blo...

ortichic today at 5:42 PM
Sorry if this is a dumb question, but do you guys not have radio controlled clocks outside of Europe? If I got it right, the only purpose of this project is to always display the correct time. Radio controlled clocks do exactly that. They are cheaper than the one ESP board, and run years on a single AA battery. No WiFi, tinkering, setup, or cables necessary
teekert today at 8:36 PM
On this topic. Do WiFi signals contain time (unencrypted)? If so why does my oven not pull time from the air and needs adjustment every 2 months? If not, why are APs not defacto time beacons for all sorts of non-smart appliances (and clocks)?
js2 today at 5:48 PM
This is great. I spent years looking for an affordable battery-powered WiFi clock that syncs via NTP since where I am, the WWVB clocks never pick up the radio signal.

I never considered making my own. Anyway, about two years ago this option popped up on Amazon. I've been happy with it:

https://www.amazon.com/OCEST-Wall-Clock-12Inch-Auto/dp/B0DJS...

I'm guessing internally it's not much different than the DIY clock in this submission.

Dachande663 today at 5:16 PM
I'm currently making something similar but using a BKA30D-R5 (a dual stepper motor used in car dashboards) and a hall sensor to zero the hands.
ChuckMcM today at 7:15 PM
Pretty awesome. The only thing I would change is to put a USB battery between the usb wall power and the D1 mini. That way for power outages of < a couple of days or so you're clock will be fine.
amelius today at 7:44 PM
What's the best way to periodically get time and date if your customers are big businesses with hostile IT departments?
retired today at 6:05 PM
I’m curious how long it takes for the hands to drift to the point where the time difference is perceivable. Luckily the 30 millisecond pulse time is configurable.
accrual today at 6:02 PM
It'd be interesting to see the logs or data on how the physical movement falls out of sync. It probably even correlates with temperature and humidity.
rballpug today at 6:31 PM
Keeping time in terms of hash-sigs that are in 64 bit architecture instance.
dheera today at 5:17 PM
Some years ago I made a ESP-based clock that used 60 LEDs in a circle that project RGB shadows via a cone at the center. I used the same WeMos D1 Mini board.

https://github.com/dheera/shadow-clock/

MrVitaliy today at 5:33 PM
Cute, but the original clock used to run on AA battery that needs a replacement every two years or so, and now it needs a power supply. Or some big battery recharge/replacement every few hours maybe days.
greenie_beans today at 6:59 PM
lol i just bought this same clock cuz it was cheap and had no tech except the clock
cyberax today at 6:28 PM
I was looking at the way they did the position sync. And they didn't :(

OK, here's how I'd do it: add small magnets at the bottom of the clock hands, and use the ESP's built-in Hall effect sensor to detect them. You can distinguish between hands using the magnetic field orientation.

SoftTalker today at 6:17 PM
Now do a old fashioned mechanical pendulum clock. You'd probably need some kind of worm gear drive to move the pendulum bob up and down.
gambiting today at 5:48 PM
That is very cool.

As for the problem of detecting the current position of hands - Casio solved in in watches with their Tough Movement mechanism, where there is a tiny tiny hole in the dial with a sensor behind it - the watch will check if the hands are over it when expected, and if not, automatically adjust - so even if a watch suffers a major impact that might move the hands, they will re-allign themselves. Such a clever and simple solution.

kotaKat today at 4:57 PM
Of note, having recently shopped at Walmart for a self-setting alarm clock (what I once knew to be “atomic”):

Apparently the entity today known as Sharp sells “AccuSet(tm)” branded clocks that “automatically set time”… but they’re just factory pre-set with a button cell and they include a slider on the bottom to set a timezone offset (only for US timezones). If you’re lucky, the clock’s battery is still good and the clock “set itself” out of the box several minutes late.

If you’re unlucky - surprise, you get to manually set the time anyways.

https://www.amazon.com/Sharp-Digital-Alarm-AccuSet-Automatic...

PlatoIsADisease today at 7:41 PM
I'm mostly interested in what goes wrong.

I've made enough of these projects to know that ~75% need modifications that were not anticipated. For instance, I made a freezer temp sensor to php email for cases where the freezer stops working... but when I opened the freezer, it would send an email. I needed to sample for 30 minutes or something.

Maybe this was simple and you will be part of the 25% that work perfect and need 0 updating.

diimdeep today at 7:28 PM
I've tried similar project, as it turns out it is surprisingly hard to reliably move second's hand and not wobble in place, you need to drive quartz motor so precisely to make gears move.

Post don't go into detail about schematic, but resistors and diodes around motor is to properly drive motor and protection from Inductive kickback (Flyback) https://www.microtype.io/blog/h-bridge-circuit-design

j45 today at 7:03 PM
Keeping the clock analog was clutch.
albertsikkema today at 5:02 PM
Great idea!
Spivak today at 5:08 PM
If you want a pure software solution get yourself an old atomic clock and https://github.com/jj1bdx/WWV play some tunes to set the time.
DesiLurker today at 5:01 PM
makes me wonder what if I just wanted to sync with nfc every once in a while. wifi seems overkill for this. maybe it could be done much cheaper with nfc sync witha phone twice a year?
greenail today at 8:00 PM
you can buy dual coaxial shaft steppers ( X40 ) for car instrument panels open them and remove the hard stops. A very small magnet and 2 hall sensors gets you end stops.