I've got a project that is moving along nicely for monitoring sensor values and taking actions. I am wanting to do some basic logging. before I get into needs - I am really only looking for advice on resources I should check out - or general approach that is best - not so much the actual code/techniques.
here is what I am trying to do on an Mega board -
data in - temp, light values, future data 1, future data 2
Actions - turn this on based on logic, turn that on based on logic, etc.
I am using an RTC and have 24hr clock available -
my logging goals - make a rolling 24 hours of data of interest - so per value -
temp - hr 1 - value 50F, hr 2, value 55f, .......hr 16 value 70f, hr 20 value 69.....etc
same for other input values - mark the peak per the 1 hr period, and log.
other log items - log in the same 24 hr window - when things trigger (output actions) within the 1 hr range period.
I have read (but not experimented) that the raspberry pie is better at logging. I have also seen that there is an external data logging board available for the arduino ( an SD card).
I am not sure - on approach and given my simple needs - if any of those routes are needed. I am wondering if I could create an array - or an array of arrays (martix?) where I can per each hour in a 24 hr period, per value- store the data I want - then recall that in a display program for a rolling 24 hour graphic.
say no more than 10 vars to track at peak - each must have a unique value per hr/per 24 hr period - so 240 data points. is that OK to store in the mega, or does this warrant the SD data card? if i am going to spend on the SD card - should I use a PI (i'd like to do other stuff on data monitoring if available) - and is there a better format/approach to storing logged data than an array?
FullOfBadIdeas:
getting the feeling you arent reading my post aarg. have you ever done data logging? if not - give those that have a chance to talk about approach.
I have a feeling you haven't read the sticky posts at the top of the forum.
FullOfBadIdeas:
I have read (but not experimented) that the raspberry pie is better at logging.
This may be true but this is an Arduino forum and, while your code is apparently a secret, there is nothing in what you have said to suggest that what you want to do is beyond the ability of the Mega you already have in hand. Indeed, it is capable of a lot more that anything you are currently talking about. Further, if you can attend to the setup daily, possibly weekly, Mega should be able to store your data in an array - no SD slot needed. If you do need one, they cost about $2, which doesn't seem to be a compelling reason for getting a PI.
Why not post specific questions about the problems that you are facing? There aren't really any "logging" resources anywhere. It's just a synthesis of standard programming techniques applied to a defined problem.
An SD card has the advantage that you can remove it and easily read your data with almost any computer. But you gave no details about your system's connectivity (or lack of)... you can also log to a computer over serial if that connection is present. Or for a small log you can use EEPROM and periodically bulk upload it via serial before it overflows.
well thanks all, I guess. "approach" seems a foreign concept here.
-my "secret" code does no logging now - so nothing to post
-I have googled and searched for example how to log, dont find much in way of examples -
-I do find the SD card that everyone mentions - that only solves a local storage problem, not an approach problem.
-I also get, once I have an "approach" I will be creating data, and can put small data in small places, and use comm to put bigger data in bigger places.
I am not looking for cookie cutter code, but basic "here is a good way to go about systematically capturing data, such that it works nicely with data/log storage and recall abilities"
without any examples to go on, I am sure I can eventually create a method that is ok, just trying not to re-create the wheel if one already exists.
so - a value - myTemp. its checked every 10 seconds. I want to record the highest temp per each hour, then store the peak temp per each hour in a rolling 24 hr period.
-use a function to check for peak temp each hour (simple <> comparison of current against old - store the peak - use RTC to only compare for peak during a 1 hour period).
-create an array - for the peak temp, 24 slots big - int peakTemp [24 slots long] - one slot per each hour of the day
-can use the RTC hour value as an index to move the pointer in the data array
-then use a pointer that points to it - for storing and recall. if I want to see hour 5, pointer is at 5, that shows data at position 5.
FullOfBadIdeas:
I have googled and searched for example how to log, dont find much in way of examples
Get an ESP based Arduino (WeMos, NodeMCU, etc).
Then you don't need a RTC or SD card, and you can retrieve the log on your WiFi network. This guide has a DS18B20 temp logger and time off the internet (almost at the end).
Leo..