I have a number of temperature sensors working correctly and to be displayed on an LCD screen.
I would also like to store all the temperature data and download it to a PC at a later time.
My initial thought was to simply store the data in a string variable ( just keep adding to it with a delimiter between records ), and have a button to Serial.print the string to the PC when connected. The software on the PC could then split the data to its required format.
However, I seem to recall somewhere that the Arduino will reset every time I connect the USB cable ( or is that when I open the serial Monitor to the board ), in which case I expect the data stored in my string is going to get wiped out.
So how do I do this : should I look at using a simple SD card & socket wired to the Arduino, and write the data to the SD card. A single button could then be used, after the Serial Monitor connection, to retreive the data from the SD file, and Serial.print to the PC ?
I do not (yet) want to have to lay out more capital on purchasing add-on shields.
should I look at using a simple SD card & socket wired to the Arduino, and write the data to the SD card. A single button could then be used, after the Serial Monitor connection, to retreive the data from the SD file, and Serial.print to the PC ?
This is the way to go. The amount of data that you can persist between restarts on a SD card far exceeds the amount of data you can store in SRAM or EEPROM.
You could also look into compressing the data you put into EEPROM.
Something simple like minute of the day that a temp changed and the new temp?
So in 2 bytes you could have 11 bits to represent the minute of the day, and 5 more bits for a temp from 0 to 31C, maybe offset by some amount such that 0 represents 20 C (68F) and 31 represents 51C (123.8F). Or scale the temp data by 2, or only take the temp every 5 minutes or something.
Or add a simple external serial EEPROM for vastly expanded storage.
8 pins, 6 wires for an SPI equipped part (+5,GND, SCK, MOSI, MISO, CS, couple of addres bits tied low)
I've made an SD logger recently, however, I'd go with the EEPROM option depending on how much data you will be storing, or alternatively, if you want to use SD...
Without buying a socket, etc. you could get creative and easily find ways to directly connect a set of 7-8 pins/wires to the contacts on the SD card (I once soldered pins/wires directly to an SD card; high temperature could damage the SD card, but I used very quick soldering).
In fact, if you're running your Arduino/Atmega-chip/circuit at 3.3 V, then you won't even need a signal voltage level shifter (which you would need if you're running things at 5V, because the SD card handles 3.3V signals)
Connect the wires to the voltage source, ground, and the four SPI connections on the Arduino, and you're set to go. (If you're running your microcontroller at 5 V, you need a level shifter, a very inexpensive chip.