In my workroom, I got about 24 degrees C and a 'light measurement' of about 400 - remember that while the temperature sensor gives an 'absolute' reading in C or F, the light sensor is not precise and can only really give rough readings.

Once you've verified that the sensors are wired up correctly & running its time to get to the logging!

/************** if you have a DS1307 uncomment this line **************/
//RTC_DS1307 RTC; // define the Real Time Clock object
/************** if you have a PCF8523 uncomment this line **************/
//RTC_PCF8523 RTC; // define the Real Time Clock object
/**********************************************************************/

/************** if you have a DS1307 uncomment this line **************/
//RTC_DS1307 RTC; // define the Real Time Clock object
/************** if you have a PCF8523 uncomment this line **************/
//RTC_PCF8523 RTC; // define the Real Time Clock object
/**********************************************************************/

Upload the sketch to your Arduino. We'll now test it out while still 'tethered' to the computer

While the Arduno is still connected, blinking and powered, place your hand over the photocell for a few seconds, then shine a flashlight on it. You should also squeeze the temp sensor with your fingers to heat it up

Plotting with a spreadsheet

When you're ready to check out the data, unplug the Arduino and put the SD card into your computer's card reader. You'll see a at least one and perhaps a couple files, one for each time the logger ended up running

The quickest way to look at the data is using something like OpenOffice or Excel, where you can open the .csv file and have it imported directly into the spreadsheet

You can then perform some graphing by selecting the columns of data

Clicking the Chart button and using Lines (we think they are the best for such graphs)

Setting the First Column as label

Which will generate this graph

You can see pretty clearly how I shaded the sensor and then shone a flashlight on it.

You can make the graph display both with different axes (since the change in temperature is a different set of units. Select the temp line (red), right-click and choose Format Data Series. In the Options tab, Align data series to Secondary Y-axis.

Or you can make another graph with only the temp data

Now you can see clearly how I warmed up the sensor by holding it between my fingers

Using Gnuplot

Gnuplot is an free (but not open source?), ultra-powerful plotting program. Its also a real pain to use! But if you can't afford a professional math/plotting package such as Mathematica or Matlab, Gnuplot can do a lot!

We're not good enough to provide a full tutorial on gnuplot, here are a few links we found handy. Google will definitely help you find even more tutorials and links. Mucking about is the best teacher, too!

We found the following commands executed in order will generate a nice graph of this data, be sure to put LOGTEST.CSV in the same directory as wgnuplot.exe (or if you know how to reference directories, you can put it elsewhere)

set xlabel "Time" # set the lower X-axis label to 'time'
set xtics rotate by -270 # have the time-marks on their side
set ylabel "Light level (qualitative)" # set the left Y-axis label
set ytics nomirror # tics only on left side
set y2label "Temperature in Fahrenheit" # set the right Y-axis label
set y2tics border # put tics no right side
set key box top left # legend box
set key box linestyle 0
set xdata time # the x-axis is time
set format x "%H:%M:%S" # display as time
set timefmt "%s" # but read in as 'unix timestamp'
plot "LOGTEST.CSV" using 2:4 with lines title "Light levels"
replot "LOGTEST.CSV" using 2:5 axes x1y2 with lines title "Temperature (F)"

set xlabel "Time" # set the lower X-axis label to 'time'
set xtics rotate by -270 # have the time-marks on their side
set ylabel "Light level (qualitative)" # set the left Y-axis label
set ytics nomirror # tics only on left side
set y2label "Temperature in Fahrenheit" # set the right Y-axis label
set y2tics border # put tics no right side
set key box top left # legend box
set key box linestyle 0
set xdata time # the x-axis is time
set format x "%H:%M:%S" # display as time
set timefmt "%s" # but read in as 'unix timestamp'
plot "LOGTEST.CSV" using 2:4 with lines title "Light levels"
replot "LOGTEST.CSV" using 2:5 axes x1y2 with lines title "Temperature (F)"

Which makes this:

Note the cool double-sided y-axis scales! You can zoom in on stuff pretty easily too.

Other plotters

Portable logging

Of course, having a datalogger thats chained to a desktop computer isn't that handy. We can make a portable logger with the addition of a battery pack. The cheapest way to get a good amount of power is to use 6 AA batteries. I made one here with rechargables and a 6xAA battery holder. It ran the Arduino logging once a second for 18.5 hours. If you use alkalines you could easily get 24 hours or more.

Fridge logging

With my portable logger ready, its time to do some Fridge Loggin'! Both were placed in the fridge, in the center of the middle shelf.

You can see in the middle and end the temp and light levels are very high because the logger was outside the fridge. The green line is the temperature so you can see the temperature slowly rising and then the compressor kicking in every half hour or so. The red lines indicate when the door was opened. This night was a more insominac one than normal!

Zooming into the plot at about 12:40AM, we can see how the temperature climbs whenever the door is open, even in a few seconds it can climb 4 degrees very quickly!

Conclusion!

OK that was a detailed project but its a good one to test your datalogging abilities, especially since its harder to fix bugs in the field. In general, we suggest trying other sensors and testing them at home if possible. Its also a good idea to log more data than you need, and use a software program to filter anything you dont need. For example, we dont use the VCC log but if you're having strange sensor behavior, it may give you clues if your battery life is affecting it.

OUT OF STOCK NOTIFICATION

YOUR NAME

YOUR EMAIL

You have been successfully subscribed to the Notification List for this product and will therefore receive an e-mail from us when it is back in stock!

For security reasons, an e-mail has been sent to you acknowledging your subscription. Please remember that this subscription will not result in you receiving any e-mail from us about anything other than the restocking of this item.

If, for any reason, you would like to unsubscribe from the Notification List for this product you will find details of how to do so in the e-mail that has just been sent to you!