Hi Peter, can I use the Arduino Due for my needs, since it has an analog output that suits to my need of controlling solenoid valve?makelifeasy
Is there a way an integer will keep the count at SRAM for 30 days then auto-write to EEPROM when it reach this day and shall continue the cycle throughout the year, I agreed the EEPROM would last but how reliable the SRAM to handle the stored data for 365 days, if it is good enough for this length I would rather use SRAM for 365 days or for the whole duration of filter lifespan metering.Using SRAM would worry me about the power cycle, that I believe stored information might erase. One question, using UNO or other controller has feature to add Capacitor to delay the power shutdown to the board when there is a power failure? ...3) Can I add an external battery to UNO that would work as backup power in case of power failure?
The two most obvious solutions to me are:1. Use a capacitor to power the Arduino for a fraction of a second when power is lost, and add a mechanism to detect loss of incoming power. If you power a Uno from 12V via the barrel jack and you don't connect anything that takes much current to the +5V pin or the output pins, then a 2200uF capacitor connected between Vin and ground will power the Uno for about a quarter of a second, which is way more than you need to save important data to EEPROM. You can detect impending loss of power using an Arduino input pin.
2. Save data to EEPROM just occasionally, and use wear-levelling to lengthen the life of the EEPROM. For example, if your data along with a 1-bit flag fits in 8 bytes, and you have 1K of EEPROM available, then you can write a different 8 cells each time. When you reach the end of the 1K, you flip the flag and start from the beginning again. When reading the data back, you use the flag to find the most recent data. This increases the number of times you can save the data in this example from 100k to (1K/8) * 100K which is more than 12 million. If you save data to EEPROM once a minute, that gives you 22 years before you reach the 100K rated life.
If you use a RTC - Real Time Clock - module, they have a small piece of SRAM which is battery-backed-up by the lithium battery (with a lifetime of years, longer if it is actually continuously powered) that runs the clock function. And they are really cheap!There you have it! It doesn't care how often you write; it is battery backed and essentially specifically designed to be immune to power failure, and you get a Real Time Clock to keep track of the time as well if that is of value to you.
But I'm not seeing any battery on the PCB of UNO, do you mean it is external option?