Go Down

Topic: Data logging, collecting and sending them once a day (Read 2923 times) previous topic - next topic

timtailors

Dec 04, 2019, 11:28 pm Last Edit: Dec 05, 2019, 12:04 am by timtailors
Hi,
I'm struggling how to handle and collect data. I have an environment sensor that records 3 different values (integer, 2x floats) every 10 minutes.
I need now an option to send it only once and therefore somehow store it in a variable/array.
How would you do that?
(I'm looking more for a concept but an example would be also welcome of course)

MarkT

You could record each reading to EEPROM, its about 10 bytes a reading, Uno EEPROM is only 1k bytes though (Mega has 4k of EEPROM, more reasonable).

If you record onto EEPROM you can recover from power outages.

EEPROM has a limited write life per byte, but if you only record each byte once a day that's not an issue.

You'll need some way to determine time in order to be able to know when to send (especially if power outages are likely).

You also need someway to ensure you don't send out out-of-date readings - this suggests recording date as well as time alongside each reading.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Nick_Pyner

#2
Dec 05, 2019, 01:23 am Last Edit: Dec 05, 2019, 01:24 am by Nick_Pyner
It is not hard to record all that on an SD. You may use the date as a filename with a new file created at midnight. God only knows how you would arrange to send the data but it is easy to receive it on demand. I just send the date, or dates, and not necessarily today's, and the DumpFile facility does it all - via Bluetooth.

wvmarle

10 bytes/10 mins = 6 * 10 * 24 = 1440 bytes/day. Doesn't work with EEPROM indeed.

SD card is an option; external EEPROM as well (a 24LC256 offers 32 kB of EEPROM and costs around 0.6 USD a piece, read over I2C).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

timtailors

Thanks a lot for your thoughts. For me it would be sufficient to store it only in the ram, in a variable, array or so but I dont know how to handle it. Which structure do I need that can increase etc

wvmarle

To keep it all in memory, you have to create a sufficiently large array.

Code: [Select]

struct Datapoint {
  float floatValue1;
  float floatValue2;
  int intValue;
};

Datapoint logData[240]; // A 1,440 byte array, leaving you with <600 bytes of RAM for other things.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

gilshultz

 Have you considered FRAM (Feroresemot Random Access Memory)  It's similar to Static random-access memory, only with a ferroelectric layer instead of a dielectric layer. This gives it stable handling (the bytes you write are non-volatile) with dynamic responsiveness (you can write them very fast!). Some of the advantages I see in FRAM are high speed reading and writing, non-volatile storage (it remembers its contents without needing power or battery backup), virtually unlimited read / write cycles - you can't wear it out unlike some other types of non-volatile memory. To get started  try this link: https://www.adafruit.com/product/1897  There board has a write enable input so you can lock it down and read it on another machine without worry about trashing the date. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil


Go Up