Hi everybody,
I'm sure this question has been asked several times, but I didn't find a direct answer.
I want to measure the power consumption of a device over time. I have already programmed my ArduinoUno to read values from sensors, now I need to store data somewhere in order to read it later on a computer and perform some statistics.
I read sensors values about every 20ms across one month period. I'd like to produce one single file like a csv:
SD card is definitely the way to go. Also are you saying that file-size is an issue? If so you should not use a cvs then instead what you could do is use packed bits binary data. Are you using 10-bit ADC readings? If so instead of storing each reading as two bytes you can fit 4 readings in 5 bytes. There are multiple ways to do this however the easiest way in my opinion is to.
Store the LSBs (bits 7-0) for 4 readings then store the MSBs (9-8) for the 4 readings.
You could also
Store the MSBs (bits 9-2) for 4 readings then store the LSBs (1-0) for the 4 readings.
I think storing the LSBs first then the MSBs is the best option.
You could then convert it to a cvs on your computer using a simple script. If you can't do that for yourself I could write one. It would take only a few minutes to write.
Thanks a lot to both of you, I believe your solutions fit perfectly in what I need. @Mr_arduino thanks for the trick, clever idea, and programming it is not an issue (the script to convert fileformat is quite straightforward).