I recently adapted my 2 channel temperature datalogger to record temperatures in my household heating system. I wasn't satisfied with reading back a file from the SD card in order to analyse the data; I wanted a near real-time graph in Excel, on my PC. I could have used gobetwino - see my previous post, but it is a bit tortuous.
I invested in an Ethernet Shield and added a webserver to my data logger. Each time a web client requests data, the SD card file is opened and the data streamed out to the web client. In between client requests, the SD card file continues to be updated, so each time the client makes a request, there is more data to send to the client..........eventually, this causes timing problems which get progressively worse. However, fo my purposes, that doesn't matter.
My next step was to get this into Excel using a web query; I am using Office 2003 on a W7 PC; it was no problem, once I understood that my data had to be served out to the client in an HTML table structure........I now know a bit more raw HTML than I did before!
Once the data is flowing to the web client on the PC and being queried automatically by Excel, it is a simple matter to display a graph which is updated regularly.
Of course, all of this was happening on my desk, with the Ethernet shield connected by cable to an ethernet switch on my home network. The final step was to take the Arduino rig and a PSU to the remote location and set it up. I forgot to say that the basic datalogger includes an LCD display which shows elapsed time and the 2 temperature readings, so I can see that it is working. I then plugged in a Netgear powerline adapter nearby and connected the shield up to it. I ran back to my PC and started the web browser, connecting to my server - and there it was, working happily over my house wiring!
The bones my sketch are as follows:
1 Simon Monk's Timer library is used to generate 1 second and 15 second events.
2 The 1 second event maintains a digital clock, displayed on the LCD.
3 The 15 second event controls the analog reads to measure the temperatures, which are written, separated by semicolons, along with the current time, to the SD card file
4. Every time the main Loop of the sketch is executed, the timer events are checked and updated; then the web server listens for a client request. If no request is waiting, the lopp goes round again.
5. If a client request has been received, the SD card file is opened and the data read out and sent to the client as cells in a 3 column, N rows table.
Part of the webserver/client initialisation process sets the client to automatically request a data refresh - in my case, every 30 seconds.
The Excell Web query refreshes itself every minute (shortest interval).
Most of the code is taken directly or adapted from example code published in support of the Arduino standard libraries.
The only piece of genuinely original code is that which reads the data from the SD card file, parses it into the 3 data items and then packages them up as cells in an HTML table.
I will be happy to publish the sketch, or any part of it, if anyone is interested