Arduino odometer's value storage ideas needed..

I am trying to make an odometer for my motorcycle..The making is not that hard but the challenge is to store the Km traveled when I shut of ignition and pull off the key or disconnect the vehicle's battery..

I do not want to use the inbuilt atmega328 EEPROM as I want to write to the EEPROM every time there is a change in Km reading, so I rather want to use an external EEPROM as it will much cheaper and save the Atmega's life....
Will that be a good idea or I can do something else..??

Why not use the on board EEPROM? It's supposed to be good for 100,000 cycles I believe and you're only going to write on it once per kilometer. If you expect the motorcycle to last longer than 100,000 km, you can move the odometer reading down the EEPROM say, every 50,000km and record its current location in the first two bytes of EEPROM. Then you'd be good for over 12 million kilometers.

The "data logger shield" lets you write to a SD card, which can be replaced and/or read from other computers.

However, if you write the Km setting only every 5 minutes, then 100,000 writes (the rated life of the eeprom) is 500,000 minutes, which is over 8,000 hours of runtime. That may be sufficient for your needs. Or not.

External serial EEPROM accessed via I2C is another possibility if you really don't want to use internal.
Use 2 bytes/address locations to store your mileage that is up to 65,535 kM. Or 4 bytes if need to use a long.
Or use the 4th byte of the long to represent other stuff as well, and 3 bytes to get you to 16,777,xxx kM.

Joy:
so I rather want to use an external EEPROM as it will much cheaper and save the Atmega's life....
Will that be a good idea or I can do something else..??

Any external hardware is going to add cost above and beyond the cost of the Arduino itself, so it will only be more expensive. Wildbill offered up a perfectly viable solution to get millions of miles worth of use out of the built in EEPROM. Seems like the cheapest option to me.

Just write to the internal EEPROM, as mentioned say 50000 writes to location 0/1 then move on to 2/3 etc.


Rob