I am just looking a little further in to data logging, I building an aquarium controller and will measure multiple temperatures, ph and maybe a few other things as my project grows...
Basically I want to know if its possible and how I would go about navigating through data that I log, and logging multiple things?
Background: I am using a netduino standard and a sparkfun microSD shield and a gain span wifi module. (Not the N+)
I also want to store user variables on to the sd that can be used to reset the device if the power is disonnected.
Eventually I plan on having the data upload to an SQL database, but it will always write to the sd as a backup, then reconcile the server when the connection is restored. Perhaps keeping a week of backup on the SD, so the navigation will come in to select all records that are older that 1 week and delete them. I just about have my head around databases but I don't really understand how data is held on the sd?
This is the code I have used to write to the sd so far in testing:
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; using SecretLabs.NETMF.IO; using System.IO; namespace SDCardTest { public class Program { public static void Main() { StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D8); using (var filestream = new FileStream(@"SD\dontpanic.txt", FileMode.Create)) { StreamWriter streamWriter = new StreamWriter(filestream); streamWriter.WriteLine("This is a test of the SD card support on the netduino...This is only a test..."); streamWriter.Close(); } using (var filestream = new FileStream(@"SD\dontpanic.txt", FileMode.Open)) { StreamReader reader = new StreamReader(filestream); Debug.Print(reader.ReadToEnd()); reader.Close(); } StorageDevice.Unmount("SD"); } } }
Thanks in advance for the help, also how would I go about having this as a background process, I am totally new to multi-threading and still don't understand it much, but I guess this project is going to end up with a lot of processes occuring symultaneously. I've seen OMAR's example but could do with understanding how I could apply it to a situation like data logging while other things like readings are being taken and decisions made to turn things on and off at the same time, along with pwm lighting control and fan control etc.
Andy