Page 1 of 1

Water Flow Gauge

Posted: Thu May 30, 2013 4:05 am
by Harnam
Hello Everyone !
Greetings!!!

I just finished uploading the Water Flow Gauge sketch in my Arduino UNO
Everything works fine and it is a great project. But I have a question :?:
What if power failure occurs and after restoration of power, everything goes to ZERO.

I am wondering how to restore the Values of Reset Button A and B so that it remembers
its counter last readings before the power failure.

It has to be <eeprom.h>
but how to do it, Can anyone help to solve this function ????

Harnam

Re: Water Flow Gauge

Posted: Thu May 30, 2013 4:24 am
by angusgr
Hi Harnam,

A good challenge to explore!

Perhaps take a look at the EEPromWriteAnything Arduino example which shows a technique to read and write values longer than a byte (like the 'unsigned long' values stored in the water flow sketch). The example there should give you some ideas about how to go about it:

http://playground.arduino.cc/Code/EEPROMWriteAnything

Bear in mind the EEPROM only supports a finite number of writes (100,000 is all that's guaranteed) before it wears out, so you'll need to make a decision about how often to update the value - for instance if you save a different value every second then you'll hit the write limit in just over a day, if you save every minute then a bit over two months, every hour then close to twelve years, etc.

One thing you can do is make sure you don't write a new value if it hasn't changed from the old value (assuming the water flow doesn't change much.)

Other forum peeps might have some other inventive ideas on how to save the values.

- Angus

Re: Water Flow Gauge

Posted: Mon Sep 25, 2017 4:42 pm
by AllanGH
Perhaps, a means of sensing the presence of mains voltage, the cessation of which instigates a "saveState" call to write the desired values to eeprom or SRAM, with a power-up routine to recover said values? In this case, a LiPo battery or super-capacitor could be used to provide the "operational inertia" to achieve the writes before the whole thing goes down.

Re: Water Flow Gauge

Posted: Thu Jan 04, 2018 8:22 am
by sameer23
I can be more happy for the free jigsaw puzzles online and it is basic jigsaw puzzles.