Constantly writing to and reading from EEPROM

Hi there, I want my Arduino Uno to be able to be controlled from 2 sources - buttons on its electrical circuit and via MODBUS from a PC. I use some variables and my program writes and reads values from EEPROM in a loop, my only worry (despite of if it is an efficient way of exchanging data) is - could writing/reading data in such manner kill my EEPROM? :slight_smile:

Maybe.

Reading from EEPROM is basically unlimited.

Writing does have a limit. It's only guaranteed to work for 10,000 writes. If you have a very simple (fast) loop then you can exceed this limit in only a few minutes. This isn't a hard limit and most chips will be able to do a lot more writes but if you're getting close to this it's a signal that something is wrong with your approach.

Look at the EEPROMEX library. The write functions in that library actually check if the value being written is different to the one already in the EEPROM so it doesn't waste a write cycle. This may be useful to your application.

Inside your fast loop, don't write to the EEPROM. Only make writes when the data changes. If its something that changes more than once per second, then why are you writing to EEPROM? If it's data you need to log, then write it to an SD card or some other data logger.

I'm fairly sure an SD card will have the same WRITE limitations as an EEPROM. I don't know any SD cards that use Battery RAM, most are flash.

don't know how much variables you want to store in EEPROM, but by spreading it over the whole range of available addresses your application might take longer before EEPROM fails. Yes extra admin is needed to find the latest value .

(hint: add millis() timestamp too)