EEPROM Overwrite

Hello,

I am doing a project for my thesis that requires counting the fatigue cycle limit of a specimen. I have everything set up correctly, and can successfully view the data I need in the Serial Monitor. I have been saving the necessary data to EEPROM so that I do not have to leave my computer connected to the system. I can view the data that was just saved in the EEPROM in the same code as well. The problem I am having is that when I power up my Arduino by connecting it to my computer my program resets the counters I need to view to zero. I have a separate code that will read EEPROM data. I was wondering if it is possible to plug my Arduino into my computer, and instead of it immediately start executing code allow me to upload new code (i.e. the EEPROM reading code I have) so that I can view the last data saved to the Arduino before I plug it into my laptop? I am using Arduino Uno by the way. Should I include the code?

Thank you in advance

Why not have one code that saves in EEPROM when the value changes, AND checks for serial data. If there is serial data, read it and store it. When the end of packet marker arrives, see if the stored data is a command to dump the value that is stored in EEPROM.

Better, to save you killing your EEPROM, would be to save the data to SD card. Each time your program starts, it can check the files on the SD card (maybe name them numerically) and start a new unique file (maybe last file + 1) to store the data in. Then it's just a case of popping the SD card into your computer and opening the files in whatever program you want - Excel, for example (store the data as CSV).

You can store much more data as well that way.

You could implement a command line interface via the Serial port that provides commands to download the stored results, and start capturing a new set of results. Alternatively, you could connect some hardware switches so that you push a button to write the current results to the serial port, and push another button to start a new recording.

Providing a connection to the PC so that the results can be downloaded in real time seems like a better solution to me, but it does mean either leaving the Arduino connected, or adding a wireless interface.

Thank you for your suggestions. I think I may go the SD card route, as that seems like it will be the easiest way for me to store and read a large amount of data. I agree that the best scenario would be for me to leave my computer connected to the device so I can read in real time, but that is not possible for my needs. Our life cycle tests will involve pressurizing and de-pressurizing flexible matrix composite actuators. We expect these fatigue tests to last for multiple days up to weeks, so I can't really sit there at my computer for that long (plus I will need my computer for other things).

Thanks so much for your help. Does anyone have any suggestions for an SD card writer or reader I could order? I am an aerospace engineer, so I would like to use something that is easy to use without needing too in-depth of an understanding of how the hardware works. (I.E. it took me a lot of effort to get the EEPROM to store things in the correct address since as my data got to higher numbers I had to account for more space being needed to save the number; I would prefer something I could just write to without worrying about hardware details (like writing data to a file in C++)).

All you should need to know: SD - Arduino Reference

majenko:
All you should need to know: SD - Arduino Reference

Awesome, thank you.