Often with more “modern” complex protocols involving handshaking, token exchanges, and all the other hoops and whistles accompanying them, we forget how useful and powerful serial can be. In what might be a wonderful tribute to that, [Davide Gironi] created a simple AVR-powered 16-digit serial display.
It can display two numbers, and that’s it. A MAX7219 drives the display, and the brains are an ATmega8. It’s straightforward to send new values: a start byte, a CRC, the data to display, and an end byte. A CP2102 provides a UART to USB interface to connect to a host. An EEPROM helps it remember the last numbers shown. It supports positive, negative, and floating-point numbers.
This is a beautiful example of doing one thing and doing it well. The design is simple and allows it to be used for anything. You can show the current stock market price, the time for the next two trains for your commute, or whatever else you can think of. [Davide] included a schematic, code, and a 3d printed enclosure.
Perhaps the idea could be combined with a clever design for a single-motor seven-segment display.
Nice, but the EEPROM won’t last forever.
Anywhere from 100k to 1m writes or so, so it’ll probably be fine at least for a few years depending on how often it’s written. It’d be trivial to write a bit of code to “wear level” by spreading the writes out across the eeprom address space to extend that out a bit and even marking bad cells to be ignored.
Although the functionality of memorizing the data on the display in EEPROM is questionable. It’s true that it will not last forever, but let’s get real, nothing does, does it. But in many cases “pretty long” is good enough. The only question now is, what is long enough?
From the ATmega8 datasheet: “The EEPROM has an endurance of at least 100,000 write/erase cycles”.
Let’s say you write a new value to it every 10 seconds it will last for at least 12 days before it operates beyond specifications. But if you only write a new value to it once a day, the EEPROM will last for at least 273 years, that’s almost forever to me.
The real problem regarding the practical lifespan of this device is the USB connector standard, which seems to change every 5 years to a smaller connector.
It would detract from the simplicity of the project just a little, but an approach would be to keep the parameters in RAM and only write them out to EEPROM when an impending loss of power is sensed. The current consumption is deterministic with the worst case being all segments and possibly all decimal points lit. It only takes a few milliseconds to write to nonvolatile storage so a sufficiently sized bulk power capacitor and a comparator watching the capacitor voltage and tied to an interrupt input would get it done. If the processor used has an A/D input, then that could be used in the main loop to watch the power supply voltage and just branch to the save/power down subroutine.
No need to store to EEPROM each time a new value is sent. Only store the current value to EEPROM as power is going down, then it should last for decades. (Monitor the incoming unregulated supply with a 10ms ADC loop or as slowe as the hold up period of the smoothing caps allows.)
^This. I’ve used this method in the past with no noticeable issue yet.
We were typing at the same answer about then same time. Well stated.
Ann FRAM would be the best choice for that application.
The MAX7219 chips are great for learning how SPI works. Their protocol is quite simple and easy to understand from the datasheet. Plus you can get segment displays with one built in for dirt cheap. If you wanna learn about SPI they are an excellent way to do it.
In an intro to embedded programming class I proctored the lab for this is basically one of the lab segments, bit banging spi to control one of these led displays before moving on to setting up the actual spi peripheral to do the same thing. Students seemed to enjoy understanding the low level signalling and seeing their code have actual visual effect in controlling which leds lit up.
They need to make 7 segment LEDs with a built in serial converter, like they do with the 5050 type RGB LEDs.