Lifetime of EEPROM?

I want to keep some data safe in case the power goes out, so I've been using the EEPROM library to write it out every minute or so.

Yes, I know the right answer is to monitor my power and write if it starts to fail.

I'm just wondering - am I going to damage the EEPROM/have it fail prematurely if I write to it so often? How many write cycles can it take?

The guarantee is 100,000 writes.

So that will be 69 days.

Can you make sure you only write if it changes? Or does it change all the time?

From memory the EEPROM is committed in "pages" of 4 bytes, so you could considerably extend the life by working your way through the EEPROM.

Keep address 0 as the "current page number". Then every 100,000 writes, go to a new page (go up at least 4 bytes) and update the current page number. Of course you would need to store the "current write count" somewhere, so that would be part of the page info. If you changed pages every 65535 writes you would only need 2 bytes for the write count (unsigned int).

Read the datasheet for sure.

Typically 100,000 endurance cycles minimum. My experience is that they go into the millions.

dhenry: Read the datasheet for sure.

Typically 100,000 endurance cycles minimum. My experience is that they go into the millions.

I dunno...I've killed one.

Luckily it only destroys individual bytes. If you can spread your writes across the whole EEPROM ("wear levelling") it will last an awful lot longer.