Ardunio Project: LightMeter

Project Description

This project aims to measure the level of light at a sensor and record that to a file along with a time the measurement was taken. The output data should give us an idea of the cycle of light over the course of a day or week or however long the data is collected for.

The set up consists of a bread-board Ardunio (from a MintDuino kit), and a PC running a small C# data collection app. The Arduino has a Photoresistor connected to an analog input. The Ardunio pulls the value from the input about once a second then checks the Serial line for any incoming data. If there is any (matters not what the data is) it writes back the value from the light sensor to the serial line. The Ardunio is connected to a PC via a USB cable and an FTDI USB connection.

The set up consists of a bread-board Ardunio (from a MintDuino kit), and a PC running a small C# data collection app. The Arduino has a Photoresistor connected to an analog input. The Ardunio pulls the value from the input about once a second then checks the Serial line for any incoming data. If there is any (matters not what the data is) it writes back the value from the light sensor to the serial line. The Ardunio is connected to a PC via a USB cable and an FTDI USB connection.

On the PC side I have a small C# console application running that periodically (currently about every 10 seconds) sends a byte of data across the serial line to the Ardunio setup to trigger the value to be sent back. When data is sent back it is written to a file along with the immediate date and time. This file is in the form of the date with time, a comma, then the value and a new line. For most people this is a CSV file.

Since the data file is written to and the output flushed for each sample, it constantly has all up to date data. It is now possible to copy the file off and work on it without interrupting the data logger. From this file I loaded the data into OpenOffice.org's Calc (like Excel but FOSS) so I could generate a graph.

Results

Here is a sample graph such as is described above.

Sample Graph of light levels

On this graph you can see the general cycle of day and night. You can see where when I started data collection on May 1st that the sky had some clouds from the way the light levels dropped but came back very rapidly. This would be from the shadows caused by the clouds. Later you can see the light levels drop as sunset approaches. After a while you can see the sensor bottoms out of it's range when it is dark enough. Eventually around 5:20 AM on May 2nd you can see that light levels are beginning to rise again during dawn.

You can see that the first part of the day has reduced light readings. Around noon on the 2nd the light readings grew some as the side of the house that has the light sensor came into direct sunlight.

Results Part 2: Live Data

2011-05-03: OK so I took some more time and built some of what I mentioned in the "Taking it further" section. I now have the data being logged to a database and viewable online. The next Step of course is to not just display a table of values but to melodramatically generate a graph like you see above.

This also opens up a nice way to have some aggregate data and other analysis. I will likely put up some of that in the coming days.

Problems and Limitations

As all projects in this stage go, there are some issues:

Taking it further

This project is fairly simple in its current form. It can easily be modified to expand the functionality. Here are some ideas I've come up with: