I need to make a more than 70 years countdown in seconds, i could turn off and turn on without loosing count. ( then i'd like to link it with sensors )
The main question is : Can arduino uno handle this ?
For now i have 10 seven segments common cathode displays / 2 Max7219 chips, and i roughly understood why i should use these to link the displays and have a clean signal
but i'm still far away from being able to do it by myself.
Can you help me learn to do this ?
Can arduino uno handle this ?
Yes, that's only
~2 billion seconds so a 32-bit variable will hold that easily.
i could turn off and turn on without loosing count.
Save the counter in EEPROM, either every second (I assume this isn't really going to run for 70 years, you may need to do some, wear levelling) or just before you shut down.
But you don't need it to keep counting while turned off do you? It can start form where it left off.
Put a battery backed RTC on it, can check the displayed time left against the actual current time & adjust accordingly.
Then all you need to store is the end date. Replace the battery every few years.
70 years * 365.25 days/year * 24 hr/day * 60 minutes/hr * 60 seconds/hr = 2,209,032,000 seconds
Guess that is 10 digits.
Pluse there will be some leap seconds in there too.
Assuming we make it past the end of the Mayan calendar. Or the next rapture. Or ...
Thank you very much for your answers.
First excuse me, I was not very clear. The idea is to have it running for a little more than 70 years, but when it's off i just want it to remember when it stops and start at the last knew count when i turn it back on.
So is real time clock necessary ? i guess i'll need a independent battery device anyway.
The next steps are :
1- getting the 10 diplays, the 2 max7219, the memory device, and the arduino mounted correctly together. I'll try to do it by myself but if you can give me any advice or link or help, it will be welcome.
2- put the right countdown program in the arduino.
3- link the two sensors that can pause the countdown when they are both activated.
I'll share my progessions with you
If i make any mistake in my steps feel free to warn me, i only wish to learn.
You might invest some time in sleep modes of the Arduino as only once per second the clock needs to be adjusted.
The rest of the time it can sleep.
So your battery will last longer (you might use some super capacitor)
Whatever - I would niot find watching 2,000,000,000 count down 1 second at a time is not very interesting to see tho.
it might show the 2 billion numbers in random order without using one twice (and still change one digit at the time) don't know if that is possible mathemagically?
it might show the 2 billion numbers in random order without using one twice
And that's more
interesting how? :)
You could make bets on the next number for a beer !
with the normal sequence that would be too easy (although after a few beers ...;)
What would happen when it got to zero?
I don't think it ever will - like our national debt ...
Why 70 years? It might be more interesting if it were counting down to something.
did you ever find a solution to counting up to such a large number?
i looked i to the problem too. specifically only using the eeprom to store the counter.
but the limits are how often you can toggle a bit = 100K times.
i looked in to balanced gray code, which would turn your counter number in to a bit series. this series of bits will use all the bits equally often.
the problem so far is balanced gray code can not be generated with a simple formula, like regular gray code can.
for balanced gray code you need to store a transition sequence that is basically as long as you counter.
in my case that would be 2^21 x 4 bits. so too big to be stored in the progmem.