I’ve got a project I’m working on to measure room conditions:
temperature
humidity
pressure
I’d like to sample sensor used to collect these this once every 10 minutes.
I’m using a clock (RTC) and when it is an interval of 10 mins, it will run a for loop and grab the data.
I’d then like to store this data. I’m thinking either table or an array. But the lines (rows) will reach into the thousands as I need to store and retrieve the data only 1x / month
Questions:
Is it better to store as an array or a table?
Is there a difference between which is faster, or able to store decimals better?
I’ll but using an UNO board, and writing the data as it’s recorded to a microSD card on a shield.
If you want to store your data on an SD card I recommend you look into XML or JSON. Both are fairly easy to read as a human when you store simple data in it and have nice support to be read by all kinds of programming environments.
Have a look at GPX files which are created by GPS programs. They are based on XML
project_science:
I’m thinking either table or an array.
by table i assume you mean to capture a single measurement as a bundle of information.
the following shows how to define a new type, representing a measurement. it also shows how an array of such types can be defined, but you would most likely just write one instance of Data_t to the SD card, appending a record to the file on the card
You can use CSV, it has been used for more than 40 years and is still used in many applications.
UKHeliBob:
Why complicate things when a simple comma separated file is an easy format to write to and read from ?
I do not believe printing a couple of extra characters really complicates things. And the XML file format is more flexible and supports hierarchical data.
For instance you can change the way you store parameters and just continue using the same file. e.g.
21.5
70.7
You can easily store data at different intervals. In a table you would need to store empty values.
Additionally there are tools for XML validation and repair.
the XML file format is more flexible and supports hierarchical data.
True, but according to the OP all he wants to do is to store 3 items of data at intervals and he/she would be wise to also store the date/time of the reading. So, no hierarchy needed and a simple flat format that can be read and analysed by any spreadsheet program as well as host of database programs and is, of course, readable by humans too