So I've been dabbling with my arduino a few days now and I have it doing some cool things (In my opinion!).
Overall my project aim is;
To log various sensors
To actuate Devices and alarms based upon those readings
To graph and display those sensors against time on a TFT LCD shield
To output the same graphs/data to a webserver or some more complicated piece of software for better analysis etc..
Now I understand that this is a large project and I certainly aim to get their gradually.
So far I am;
Taking temperature readings, displaying those on a 16x2 LCD while also writing them onto a SDcard and sending them to the serial monitor (alongside a readout of the SD cards current - so I could check it was working how I wanted). Currently I am doing all that within the loop function, I have just read the simultaneous sticky thread and I think the next step would be to break it down into smaller functions and then call those from the loop. As currently I would like to time stamp the data, but am waiting on my shield that has a battery function so I can have a constant clock going.
So I have a few questions for you guys;
Does getting used to calling in smaller defined functions sound like a good next step?
Is it actually possible to display a simple graph on a TFT LCD shield? - I have found this; https://www.arduino.cc/en/Tutorial/TFTGraph - But I would like to have axis, is this feasible?
Is it actually possible to display a simple graph on a TFT LCD shield? - I have found this; https://www.arduino.cc/en/Tutorial/TFTGraph - But I would like to have axis, is this feasible?
Sure, but I imagine you'll have to write your own code to draw them.
In that link I see mention of ' TFTscreen.line' and 'TFTscreen.background' - so I imagine with a bit of learning how that library works you should be able to do anything you like...
I made snake on a SPI screen - it can be frustrating learning the SPI commands and the obscure ways they get around things like non power of 2 parameters and weird modulus hoohah, but that TFT class looks like it does it for you.
It doesn't take much to do rather better than what is in that link. The pic shows a two-speed graph, i.e. after the first six minutes the x-axis changed to 30 minutes, re-drawing the first six minutes on a compressed scale. This was done using the Henning Karlsen library, but it wasn't chosen specifically for the purpose and I imagine other libraries would do it OK. I believe they are all much the same. The LCD is 400 pixels wide, and was chosen for the job, as it updates at five second intervals. Larger displays connect to Arduino via a shield. It is advisable to get the display, shield and library all from the same place.
A quick'n'dirty option is to send the data to your phone via bluetooth. Bluetooth Graphics Terminal is God's gift to Arduino dataloggers. The programming to do this is just a couple of extra lines over what you send to serial monitor. Some other guy did all the real work.
As for timestamping, the simplest approach is to use an RTC module. This will have is own battery. I have never heard of a shield with a battery function. It doesn't sound such a good idea. You only need a clock for timestamping local backup. If you send the data to a local terminal, Excel, or Internet host, anything except serial monitor, the timestamping can be done at the other end.
Thanks Robin, that link looks fantastic and definitely something worth reading.
Generally, I suck at sitting down and learning something and then trying to implement what I learn, so I typically start how you described. I am good at bending stuff and seeing how others do something and tweaking it for my end goal, i'm very much a do-er. But that only gets you so far and the next step is definitely to take a more planned approach. Currently its been like;
Lets Sense temperature!
OOOO! lets send that back serially!
OOOO! lets write it to an SD card!
Thanks for the info about the TFT stuff guys, I was pretty sure it would be feasible, I just didn't want it to be more complicated than something like sending the data to a computer and sending back the graph to display. As if it is going to be one of my next steps it still needs to remain relatively simple. Maybe i'll start with a Non-axis'd display but use something like 2 Pixels per reading and then if I am reading every 10 minutes I can simply know the timescale roughly.
As for timestamping; that's what I meant, I've ordered a datalogging shield that has a battery slot and a SD slot.
I would just like to point out that powering the Arduino continuously may be a pain, even if you have a battery.
While you are testing, you will ofter reset the Arduino, then you will have to reset the timestamp.
On the other hand, you cound use a cheap RTC module that has a built-in battery.