Delaying power-off to an Arduino after power is turned off

Folks,
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.
Dave

Maybe something like the TPL5110 or TPL5111 and only give the user an 'on' button so you decide when to power off the Arduino. This can also be battery backed to powering off from the wall switch the Arduino keeps going until it ready to power down.
Combine this with something like the Adafruit Feather MCU's that have battery management/charging & connector to simplify the design.

transparu:
I don’t want to have the circuit powered permanently.
...
Despite searching, I haven't yet found an applicable answer.

Then you have done yourself out of the answer.

You have - it appears - a vehicle with a large battery. There are measure you can take to have the current consumption of the Arduino reduced to a few milliamps.

Thanks for such speedy responses gents.

I had not seen those Adafruit modules - but what a great solution! I am impressed.

I had heard about modification of an Arduino but hadn't followed it up maybe because I didn't fancy soldering/unsoldering a regulator, but that too looks like a doable solution, having now read more about it.

Incidentally, yes, I have a pair of house batteries in my vehicle. Perhaps I am being a little too precious about minimising current draw. I've tried to keep "standby" battery usage to an absolute minimum as the vehicle can sit for quite a while between use/charging.

You fellows have offered useful solutions- though more importantly, improved my education.

Thanks again.

Dave