Datalogging Assignment - February 28 2007

LM34 Temperature Sensor (F) + PHP by chris kucinski



Using PHP example #2 I decided to log temperature data overnight. I set up the LM34 (TO-92 package) outside my apartment through a window that faces due east and logged sensor data every 30 seconds from 1AM to 9AM (except that my computer went to sleep around 2:30AM and didn't log anything until I happened to wake up at 6AM and get things going again). I was hoping to get a good range of cold to warm as night became day.

The sensor was connected to my Arduino board with solid wire and so was able to position the sensor without it touching the window sill or panes without much effort. Although this might have had some benefit towards getting air temperature data while it was dark out, I doubt I was logging 'true' ambient temperature values as the sun rose since it was bright and sunny this morning and presumably warmed the air and the sensor. I wouldn't be surprised to learn the window and my building's exterior wall reflected some heat towards the sensor, skewing the values further. Assuming everything on my end was working correctly, I'm pretty amazed at how much fluctuation there is, even minute to minute.

Here is the setup:



View the temperature data I logged. After logging the data, I exported an Excel file from phpMyAdmin. In Excel, I converted the sensor values (0-1023) into degrees Fahrenheit using the formula found on the Sensor Workshop page dedicated to the LM34. This formula is:

Temp(F) = 5 * sensorValue * 100 / 1024
or
Temp(F) = sensorValue * 0.48828125

Then I graphed the data over time. The steep rise in temperature early on is due to bringing the temperature sensor inside to make some adjustments and it continued to log data.

Here is the temperature data without an average:







Here is the temperature data with a moving average weighted by 15 readings (black line):






I tried to log another sensor value (a TAOS TSL13S "Light to Voltage" sensor) along with the temperature data to compare the sunrise with the temperature, but I couldn't get it to work on the database side.