by teraflop · 9mo ago · 0 comments
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. :)
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.
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.
(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.)
Use this as you like.
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.