Converting a $3.88 analog clock from Walmart into a ESP8266-based Wi-Fi clock
github.com
github.com
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.
So the way this works seems to be this: It's an SRAM and an EEPROM in one little package along with a controller that talks with each, with a little capacitor (this clock uses 4.7uf) placed nearby.
The SRAM part does all of the normal SRAM stuff: It doesn't wear out from reading/writing, and as long as it has power it retains the data it holds.
The EEPROM does all the normal EEPROM stuff: It stores data forever (on the timescale of an individual human, anyway), but has somewhat-limited write cycles.
The controller: When it detects a low voltage, it goes "oh shit!" and immediately dumps the contents of the SRAM into EEPROM. This saves on EEPROM write cycles: If there are no power events, the EEPROM is never written at all.
Meanwhile, the capacitor: It provides the power for the chip to perform this EEPROM write when an "oh shit!" event occurs.
When power comes back, the EEPROM's data is copied back to SRAM.
---
Downsides? This 47L04 only holds 4 kilobits. Upsides? For hobbyist projects and limited production runs, spending $1 to solve a problem is ~nothing. :)
(Hey Dang. Can we get a ban button? There's a few people here that are impossible to conduct rational discourse with. My sanity would improve if they were simply gone from my view.)
An extra UI element or two should be enough. Maybe with sticky options for collapse-by-default or hide-by-default at the top of each HN comment section.
And the list of usernames can be stored and edited in the purveyor's HN bio (in plain text, like a monster), so that it works automatically across devices.
Use this as you like.
An alternative would be a supercapacitor and a voltage divider connected to the ADC pin of the microcontroller. When the 5V rail dies, the supercapacitor can hold 3.3V for a few seconds while you write everything to the EEPROM.
https://www.digikey.com/en/products/detail/microchip-technol...
And, at least with Digikey, you can feel like you actually get the real part vs. some low end clone knockoff.
It's as if people have never had shipping itemized before.
The only reason aliexpress shopping is cheap is because the rest of the world foots the bill. Unless somebody has finally removed China's "Developing Country" status thats gotten them essentially free international parcel service for the best part of 100 years.
I buy small parts with "Choice" shipping on AliExpress sometimes, because it's cheap and [usually] quick and they take care of all of that pesky tariff and customs business in ways that never have an opportunity to surprise me.
For years now, the shipping process has worked like this for me: They gather it up on their end and send the stuff on a cargo plane to a sort that is at or near JFK airport in New York.
If the order includes things from several different sellers, then at some point they generally get combined into one bag.
From there, they just mail it -- using regular, domestic USPS service. It shows up in my mailbox on my porch in Ohio a few days later.
Although it certainly was a thing I've experienced in the past, at no point does the process I've described exploit the "Developing County" loophole. They just send things to the other side of the world (at their expense), and then pay the post office the same way as anyone else does to bring it to my door.
It's not the same, what you described is Direct Entry (somewhere around page 25, linked below). Apparently the Terminal Dues system has been massively changed in the 5 years since I last looked- but it still appears unfavorable to USPS and US sellers, while favoring high volume foreign shippers.
https://www.gao.gov/assets/gao-18-112.pdf
As for how aliexpress delivers stuff, since the tarrifs: 1) no-name last mile. 2) USPS last mile, and USPS the entire way.
I don't know if any are associated with "Choice", Paid store shipping, and/or free store shipping.
Since I normally buy from aliexpress to avoid the insane 200-800% markups amazon/ebay/walmart/etc dropshippers demand the $5-$10 in shipping doesnt factor in.
As a consumer, here's how AliExpress Choice shipping functions for me: Like buying a widget from a shop downtown, the price is the price.
I don't see what anyone will pay (or has paid) for duties or tariffs or fees or delivery, I don't have any idea what the markup is at any level, and I don't know what GAO table they or anyone else used to get it to happen. That's outside of my purvey.
With this method: Same as with the shop downtown, I'm not importing anything myself; I don't see any customs forms or declarations at all. AliExpress handles all of that business, not me.
I can peek behind the curtain a bit and see some aspects of how things move from place to place as physical entities using the tracking data that they provide. And that's about it, until it eventually shows up inside of my mailbox -- and then I can have a nice gander at the labels and see that it was sent with USPS domestic postage.
This process doesn't (can't, AFAICT) abuse my nation's postal system, and I like that aspect quite a lot.
The downsides are cost and availability: There may be a dozen or more sellers offering seemingly-identical widgets on AliExpress, but maybe only one or two (if any) that ship that particular widget Choice. Like Prime, it can actually end up costing a bit more than other methods.
But it's fast, still cheap in absolute terms, and there's zero BS on my end so I like those parts, too.
https://www.digikey.com/en/products/detail/microchip-technol...
I'd prefer even the SOIC version which is $0.69 if I'm soldering it:
https://www.digikey.com/en/products/detail/microchip-technol...
but the author used the DIP in a holder/socket on the perfboard.
Particularly I like that I can get those large enough to stick a ring buffer from debug out on them as well and get crash logs from embedded systems despite the debug uart not being tethered to a dev machine.
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/
Days spent modifying cheap electronics is absolutely encouraged.
My most precious resource is free time. I never have anywhere near enough.
It is absolutely not worth $5 for me to spend another 15 minutes trying to find a cheaper price
There are UK and Japan clocks that work similarly, but use national time sources. There are G-Shock watches which synchronize from multiple sources. While running on solar power. Those keep accurate time with no maintenance. That's an impressive achievement.
YMMV depending upon location. I've never gotten a WWVB clock to work in North Carolina. On the East Coast, the signal maybe sorta works for a few hours overnight:
https://tf.nist.gov/tf-cgi/wwvbmonitor_e.cgi
T̶h̶e̶y̶ ̶a̶l̶s̶o̶ ̶d̶o̶n̶'̶t̶ ̶t̶r̶a̶n̶s̶i̶t̶i̶o̶n̶ ̶D̶S̶T̶ ̶a̶u̶t̶o̶m̶a̶t̶i̶c̶a̶l̶l̶y̶,̶ ̶s̶o̶ ̶y̶o̶u̶'̶r̶e̶ ̶p̶u̶l̶l̶i̶n̶g̶ ̶t̶h̶e̶m̶ ̶o̶f̶f̶ ̶t̶h̶e̶ ̶w̶a̶l̶l̶ ̶t̶w̶i̶c̶e̶ ̶a̶ ̶y̶e̶a̶r̶ ̶u̶n̶l̶e̶s̶s̶ ̶y̶o̶u̶'̶r̶e̶ ̶i̶n̶ ̶o̶n̶e̶ ̶o̶f̶ ̶t̶h̶e̶ ̶r̶a̶r̶e̶ ̶U̶S̶ ̶l̶o̶c̶a̶t̶i̶o̶n̶s̶ ̶t̶h̶a̶t̶ ̶d̶o̶n̶'̶t̶ ̶a̶d̶h̶e̶r̶e̶ ̶t̶o̶ ̶t̶h̶e̶ ̶D̶S̶T̶ ̶s̶i̶l̶l̶i̶n̶e̶s̶s̶. Edit: My bad, they can switch in/out of DST automatically, at least when they can work at all.
> The DST status bits indicate United States daylight saving time rules.
I think that most WWVB clocks just don't have the size to have an omni-directional antenna.
Meanwhile, the WiFi NTP clock I purchased just works, like I always hoped the WWVB clocks would have.
I'm not sure how much it really matters though.
Now if only I could turn off the clocks on my oven and microwave...
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.
That's pretty genius for many ADHD-type folks. Only problem is a modern household has many clocks in view, so you'd need to commit to just not setting them.
Easy enough for wifi enabled ones: a UDP broadcast to discover other clocks on the network, then sync how you will.
For non-wifi-enabled clocks, perhaps something like a CH572 would do the trick: a $0.20 RISC-V microcontroller with BLE support that all the clocks in the same vicinity could use to talk to each other.
You could really mess with your neighbors if they had the same clocks and you were within range...
Yeah, the main problem with this project is you have to find a silent 3.88 analog clock to attach it to.
Last cheap clock i've tried was silent on half the circle and kinda buzzy on the other half. It had seconds so that meant the ambient noise changed every 30 seconds...
Oh wait. Maybe I should open it up and remove the seconds needle. Time for a totally analog project!
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.
I’m not saying these things matter much in this context.
The clock will still be far more accurate than purely mechanical version. And, re-synchronizing it is as trivial as turning the knob, just as you would for the all mechanical mechanism.
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
I think the reason why it took so long is a combination of snobbishness (its not "mechanical" enough) and cost of manufacture. I assume that most of the tooling has been lost, and it required a lot of work to re-learn how to make from scratch.
But accutrons wern't that cheap when they launched, so I think they are within 50% of their original price, judging by my half arsed inflation calculations.
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.
Your Seiko is a radio clock. It’s probably got a crystal or some other normal timekeeping gadget, and the external WWV signal is decoded to properly set it.
“Atomic Clocks” are marketed to ignorant consumers who blithely use the term when the only external source is a radio station. The Stratum Zero clock may be atomic, but the caesium is not to be found on your nightstand.
No caesium atoms would be found in your Seiko, bro.
If you know more than someone else, that's great! By all means, share some of what you know, so the rest of us can learn. Just please do it without putdowns.
https://hn.algolia.com/?dateRange=all&page=0&prefix=true&sor...
https://www.walmart.com/ip/Mainstays-Basic-Indoor-8-78-Black...
Members of Walmart+ often see different "final" prices due to exclusive discounts, rewards (Walmart Rewards), or waived shipping/delivery fees that aren't available to guest users. Walmart uses AI to offer personalized promotions. You might see a "Rollback" or a "Just for You" offer on an item you’ve viewed multiple times or purchased previously, effectively changing the price for you specifically via a targeted discount. Like many e-commerce giants, Walmart may also offer "first-time app user" discounts or "win-back" coupons to specific customer segments.
Git history shows it was published more than 2 years ago.
Those signals are just weird mess of coils, switches and resistors.
ESP32 clock speed may also be a contributing factor.
But did not improve much, except variable names are now less esoteric.
[0] - https://www.nist.gov/pml/time-and-frequency-division/time-di...
The receivers are inexpensive ($5-$10 for the kind of accuracy that's useful here) and it's not hard to parse the NMEA strings and PPS they output into a spooky-accurate internal clock. It only takes a few connections and an antenna to integrate GPS into an MCU like an ESP (or an SBC like a Raspberry Pi or a whatever).
Like, really: The hardware is ridiculously easy.
The only difficult part is the code. But as we can see from this posting, the clock-driving bits are already written and are available for use.
Just graft in the GPS parts instead of the NTP parts, add your DST/location rules if you really must (hint: that part is harder than it sounds), and send it.
(And if the code still seems arduous, then remember: This is the kind of work that a reasonably-focused person who is armed with a decent bot can put together over a cup of coffee or two, even if they don't speak C. It may be popular here to poo-poo the bot here, but it's completely OK to get some help. Don't let pride get in the way of having fun, learning things, and building neat stuff.
The tailor doesn't lament the invention of the cotton gin.)
My current house, with low-E windows, aluminum siding, and a metal roof? It passionately hates everything about GPS.
But in more-typical (stick-framed, asphalt shingled, vinyl-sided, US-ish) houses? I haven't had any trouble with my very inexpensive u-blox (or perhaps clone) GPS board, a presumed-decent GPS antenna that we were throwing away at work, and dainty little [IIRC] u.FL to SMA adapter to connect the antenna with. (I put this all together just to play with making a GPS-backed, low-stratum NTP server -- which was a much more-rewarding process than it had any right to be.)
It was bizarrely good, in fact: While it certainly saw more birds and presumably had better accuracy when sitting in a window, I had real trouble getting it to cease to operate. It seemed to lock on well-enough to provide time and PPS until I put the antenna into a windowless closet.
That said: The antenna that came with this cheap receiver was trash -- at best, 1/10. It was hard to make it work even outdoors on a clear day. I eventually got sick of looking at that part and binned it.
That gives you another weekend project, and you can reuse your DIY NTP wall clock!
If I am interpreting their request correctly, they want a wall clock that knows where it is -- and also knows what localtime is in that position on the globe.
GPS (plus some hairy lookup tables) can accomplish that.
It has automatic timezone. The article also explains why it isn't as simple as it seems
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...
There was a kerfuffle a few years back about the funding for the station being cut, but luckily that did not come to be.
I had a Casio wave ceptor (one with analog hands which it doesn't look like they sell anymore; I should have kept it). Anyway, looking at a model that's currently available (WV-200R, but there are 2 other models available), its manual says it gets signals from "Germany (Mainflingen), England (Anthorn), United States (Fort Collins), [and] Japan."
I was curious so I looked those up:
Mainflingen DCF77 77.5 kHz
Anthorn 60 kHz
Fort Collins WWVB 60 kHz
Japan looks like they have Mount Otakayoda 40 kHz, and Mount Hagane 60 kHz.
There are also some other countries that have time broadcasts (e.g. France. Anywhere else?) but not that that watch uses.
Casio brands watches that receive all 6 stations as multiband-6, and older ones that don't have the Chinese signal as multiband-5.
The analog display, chronograph watches like WVQ-M410-7AJF are delightful ; you can switch to timer mode and the main hands show the time ticking down (yes, they move counter-clockwise), and then switch back to normal timekeeping mode and the hands will move around the dial to set to the correct time again. Obviously at great expense to battery life, but it's solar powered. Unfortunately it's Japanese Domestic Market only, so you need to order it from a place like discovery mall japan. (The WVQ has a flimsy plastic - if you're willing to pay a lot more you could spring for the OCWS7000E ). Citizen has some GPS set watches.
Radio time signals used by watches and wall clocks are all in the 60-77.6 Khz range, probably best suited to small receivers and low power - other radio time signals are higher frequency. In the US, WWVH broadcasts at 2.5MHz, 5Mhz, 10Mhz and 15Mhz.
I know this because when my mother was visiting the US over a decade ago, she found a clock she felt was aesthetically perfect for her psychology practice room at her house.
Twice a year the clock changes its time to be 10 hours (or thereabouts) behind, no doubt due to daylight savings change over.
So she has to readjust the time whenever this happens which she says she doesn’t really mind.
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.
It feels like in 2026 this should be something default and assumable, but alas, it is not.
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...
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.
The point is to have fun and learn something, not really to solve a problem in a practical sense. The radio controlled clocks are extremely unreliable where I live.
https://en.wikipedia.org/wiki/Radio_clock#List_of_radio_time...
Obviously it defeats the purpose a bit if I need to move my clock to a different wall and wait 12-24 hours for it to set itself.
Our office manager bought some US tuned radio wall clocks, and every now and then they would jump 8 hours forward. I assume it was down to solar weather making propagation changes (https://en.wikipedia.org/wiki/Sporadic_E_propagation)
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.
It doesn't seem to be hammering the NTP server 30 times a second.
>Ten times each second the ESP8266 compares the time displayed on the analog clock to the actual time retrieved from an NTP server.
Not sure where I got 30 from. Dyslexia between reading and commenting.
Except it wasn't a repeater so much as it was a MITM fake, with an rpi connected to an sdr-like system to generate a fake WWVB (iirc?) based off an NTP clock.
Legality was technically questionable, but since the signal didn't really leave the site perimeter (or even the building, really), I think it was ok.
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
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.
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.
The advantage is that smart devices might have Matter support already. People with Matter devices will have border routers, which are perfect place for running NTP and broadcasting time.
Radio controlled ("atomic") clocks get their signal from WWVB, a long-wave station in Colorado. Its signal is just a carrier and data is encoded via pulse-width modulation and phase modulation. People have built local, low-powered WWVB transmitters to sync their watches and so forth in areas where WWVB is hard or impossible to receive. It's not a good idea to build one of these unless you REALLy know what you're doing because radio signals can travel farther than you expect, and the FCC takes a rather dim view of intentionally broadcasting your own signal (to any distance) without a license to do so.
There are weak wwvb simulators out there as phone apps and such that depend on using EMI to sync your clock. Like the old AM radio bus noise music hack. https://github.com/kangtastic/timestation?tab=readme-ov-file...