I am pretty new to the Arduino, but am trying.
I am constructing a water tank meter for my RV with a 1602 LCD display. I am familiar with some of the published hardware setups and Sketches for such a job. I’m using an UNO but will probably adopt a NANO for the final circuit.
The 12V pump circuit is usually off until water is required and then the circuit is manually turned on.
Basically, I start with the tank full and each time the tap is turned on (which activates the pump), water flow is measured (YFS201 flowmeter), calculations done and remaining water volume stored in EEPROM. Subsequent uses (e.g. 10 minutes or weeks later) see the remaining volume as the start point for the calculations.
I have one issue I am grappling with. At the end of each water usage period (i.e. when the tap is on) I have the arithmetic done for the remaining water in the tank. This figure updates the new balance in EEPROM for the next time that calculations are done. With the limit to EEPROM writing, I delay writing until after water ceases to be used. If the power is manually switched off to the Arduino before the value is written to memory (i.e. a human failure in switching the circuit off rather than the pump), the system fails because next time a starting value for the balance of water is incorrect. I hope this is clear?
SO, I am looking at how I might delay the power off to the Arduino to ensure calculations are completed and the correct figure stored. This will only be for a brief time.
I don’t want to have the circuit powered permanently. I am aware that in my DashCam, a capacitor stores sufficient power to enable writing of files before all power is lost. Is this a viable way to handle my situation with the Arduino? Or, is a rechargeable battery a way to go? Despite searching, I haven’t yet found an applicable answer.
I would appreciate any comments and suggestions from people who have dealt with a similar situation.
Thanks in advance folks.