the shop has a "days without an accident" sign that miles, jonas, and i kept updating by hand. instead of doing that forever, we cut out the white hole in the sign and dropped in a 4-digit 7-segment display so it could count up on its own.
how it works
a 7-segment digit needs each of its seven bars driven individually, and a multi-digit display can only light one digit at a time. the code drives each digit fast enough that they all look lit at once, showing the running day count.
partway through, mr. christy suggested using a driver and miles suggested syncing over wifi, so i rebuilt around a 74HC4511 (a common-cathode 7-segment decoder/driver) wired with help from a japanese writeup i found, plus an rtc. that way the counter can pause on weekends instead of counting days the shop isn't open.
the build
- cut the existing sign so the 7-segment display could drop into the white hole
- first draft was direct-drive: digit pins + 7 bar pins, with a lookup table for 0-9
- hit an int overflow once the count passed 33, fixed by moving the timer to
unsigned long - added all four digits and a "blank" entry to the lookup table so leading digits stay dark (and bright)
- moved to a 74HC4511 decoder/driver to cut the pin count
- added an rtc + wifi time sync to handle weekends and stop the counter at the right times
status
the driver + 7-segment wiring was proven working, and the code has been rewritten to drive each digit. hooking the time library up to the counter so it updates and pauses at the right times was the last step left.