EEPROM endurance in energy meter


I am designing an energy meter for electricity billing purposes by converting an analogue energy meter and counting the number of pulses given by the analogue meter's LED. Since power may be cut off any time, the number of pulses has to be stored in non-volatile memory. I saw the data sheets of Atmel EEPROM AT24C0X and inbuilt EEPROMS of ATmega328 and PIC16F877A, and found all have READ/WRITE endurance of maximum 1000000.

In this context, how is the problem of EEPROM life endurance tackled in commercial energy meters?

Best Answer

I would not write every event to EEPROM. Most of the time you will have power, so keep the live count in RAM.

The amount of energy it takes to save the live value from RAM to EEPROM is pretty minimal. Use a capacitor to store enough energy to run the micro long enough after power fail is detected to copy the live data into EEPROM, then shut down cleanly. You should only need a few 10s of ms at most, maybe just a few ms. You also need to be able to detect power fail early enough so that there is still energy in the cap to perform the clean shutdown sequence. This should not be hard though.

For example, let's say the micro requires 20 mA at 3.3 V (that is actually quite high for this kind of application) and that shutdown takes 20 ms. That's (20 mA)(3.3 V)(20 ms) = 1.3 mJ. A 470 µF cap charged to 12 V holds 34 mJ, for example. Let's say you normally keep the cap charged to 12 V, and detect power fail when it gets down to 11 V. At that point it has 28 mJ left. To get 2 more mJ out only requires draining it to 10.6 V.

These are just numbers I pulled out of the air as example. A 470 µF 16 V cap wouldn't be a big deal to add to the device, but even that is clearly more than necessary in this case. The point is to show this method is quite feasible.