I have a Honda generator that gets quite a bit of use and I want to build an hour meter to keep track of oil change intervals. It will be powered by the generator's 12 volt output and should read the running total from eeprom at startup and write to eeprom on shutdown. I can monitor the input voltage to trigger the write but I think I need a capacitor somewhere to give the circuit a few extra seconds of life to do the write.
Where would the capacitor go and how big should it be?
Thanks for reading.
diode to capacitor, capacitor to step-down regulator, then as the voltage drops between 12V and 7 or so the
regulator can still regulate. Find out how long it takes to write the EEPROM (depends on how many
bytes), multiply by the current drain of the Arduino during this, give the total charge.
If the voltage drop at the capacitor allowed is 12-7V = 5V, then the min. capacitance needed is charge/5.
So if 25ms are needed at 100mA, thats 2.5mC of charge, which means 500µF capacitance or more. Check
the actual figures for your set-up, this is a made up example.
The diode is needed to prevent the capacitor discharging back through the generator.
By 'step down regulator' I presume you mean the buck converter I will be using to power the circuit?
And what about updating the EEPROM every minute or so, possibly using some wear leveling?
Or add an FRAM chip to your circuit. SRAM access speeds, EEPROM nonvolatility, Trillion write capability (10^14 writes).
Write as often as you want, power hold up not needed.
Thanks all, for the good advice. I'm partial to Smajdalf's idea because of its KISS principal simplicity. Typically, hour meters on machinery measure to tenths. If I write every six minutes the 100,000 write life of the eeprom is good for 10,000 hours. My generator should last so long!
You can buy an hour meter for less than $10 from EBay
If you use a nonvolatile memory written blindly (either EEPROM or FRAM) you must consider what will happen when the power fails in the middle of the write (or communication). Your program needs to have some means to discover a badly written byte and recovering.