I'm soon going to start a small project and I'm completely new to the Arduino, I didn't even buy one yet…
I will try to build something for my electric scooter. It will collect some data and display it on a lcd screen while driving. It needs to remember some data between every time I drive, so I need to save things on the built in EEPROM, as I understand it. I also understand that there is a limit how many times I can write to the EEPROM, so I thought that just saving all data every time I shut the scooter off would be a good idea. That would probably be twice a day or something like that.
The battery of my electric scooter (60 V, 40 Ah) is removable, so every day I take it out and recharge it inside my apartment, leaving the scooter and the Arduino without any kind of power. The scooter is equipped with a DC/DC converter for 12 V, which I will use to power the Arduino.
I think I will go for the Arduino One, I don't know if that's a good idea, but it seems to fulfil the other needs of my project.
So what I need to know now, is probably something like the following:
When the power is off, is the Arduino immediately dead or is there still some time to write to the EEPROM?
Is there a way for an Arduino program to see the voltage of the power connection?
What is the most common or easy approach for solving this problem?
Is it generally a bad idea to just cut the power off the Arduino without running some kind of shut down function first?
The idea that first comes to my mind is to just power the Arduino with a capacitor that is charged through a diode (and maybe a serial resistor) by the DC/DC converter and also connect the output of the DC/DC converter to an input of the Arduino. If the voltage from the DC/DC converter is low, the Arduino should save all the important data to the EEPROM. Since the Arduino should work fine from 7 VDC (right?), I don't think the capacitor needs to be very big to keep it running until all data (probably less than 20 bytes) is saved.
Any good advice about this? I want to keep the project as simple as possible, the fewer external components, the better.