“A friend at work (Martha Edburg*) writes on her whiteboard the number of days until she can retire. A manager asked if I could make a sign or some kind of display that would automatically count down the time for her. At first I thought, eh, too much work. But the more I thought about it, the more I thought it would be a cool project. MERC was born! Well, the idea was born.
This Instructables is titled “Nearly-Autonomous Retirement Countdown Display”, but I have actually been referring to it as MERC. Martha Edburg Retirement Countdown. I also use the term MER; for example, the MER date. I just thought “Nearly-Autonomous” makes a better title for this Instructables.
Why “nearly” autonomous? Firstly, it needs power from an outside source to operate. Secondly, the RTC (Real-Time Clock) has a backup battery that needs to be replaced every year or two or so. Other than those exceptions, MERC will always calculate and display time until retirement without outside intervention. The RTC keeps the current date/time and the MER date is hard-coded. No external input is needed. If power is removed, the RTC continues to keep time. When power is applied, it will continually display the remaining time to retirement.
*This name may or may not have been changed to protect order in the universe and is totally fictitious. Any similarity to a real person (living, dead, or living dead) is entirely coincidental.
I was originally thinking to count down the days. Eh, changes too slowly, too boring. Hours, Minutes? Better. Nay, let’s go for seconds! It’s going to be lots of seconds. Seconds from when? Well, seconds from the current date to the MER date. If the MER date changes, things could get complicated. So, I picked a point in time and called that time zero. That point is the beginning of 2020. Yeah, I know 2020 wasn’t a great year, but I wanted a multiple of 4 (for leap year calculations) and it had to be before now and before the MER date. So, the first second of 2020 it is! Well, I guess it would be the 0th second? Whatever. So the time to retirement (to be displayed) will be the MER date (in seconds from 2020) minus the current date (in seconds from 2020). Seems pretty simple. Ha!
Need to calculate the number of seconds from the beginning of 2020 to the MER date. This will be a constant.
Let’s use a MER date of August 31, 2024*.
First, calculate the number of seconds in the full years:
2020: 31,622,400 secs (leap) +
2021: 31,536,000 +
2022: 31,536,000 +
2023: 31,536,000 = 126,230,400 secs
And for the partial year 2024:
January through August, except for the last day in August because that is a partial day.
(31 + 29 + 31 + 30 + 31 + 30 + 31 + 30) = 243 full days * 86,400 = 20,995,200 + 126,230,400 = 147,225,600 secs.
Aug 31 at 5 PM, +17 hours * 3600 = 61,200 seconds.
Add all that up and we get 147,286,800 seconds total from beginning of 2020 to the MER date. This is going to have to be a long integer.
This was fairly easy to calculate one-time with a fixed date. It gets more complicated when calculating the current seconds from 2020 because of leap years and different number of days in different months.
Do I really need to be this accurate? No, not really. But I want to. And, I am not adjusting for daylight saving time (DST). MERC just stays with PST. So, it can be 3600 seconds off. But an accurate 3600 seconds! Good enough for retirement-planning purposes.
*This date may or may not have been changed to protect Martha’s privacy.
- Optrex DMC-20434 LCD (or similar), ~$10
- Arduino (I used an Uno, only because that is what I had), $22.95
- RTC (Real-Time Clock), $22.50
- 10 KΩ pot (I used a 10-turn I had, but any trim pot is fine), $1.25
- Pushbutton, $1.50
- 100 nF caps, <$1
- Enclosure, $5.35
- Wall wart, 9 V, $12.00
- Miscellaneous nuts, bolts, wire, etc.
- And, of course, the usual electronics tools.”