A component of the automation system I'm building is the ability to measure light intensity, specifically the incident light on my car's dashboard. I use a touchscreen netbook and a Labjack U3-HV to create this windows based automation system.
Here is how I achieved the software reading of real world lighting levels.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: The Hardware Setup.
I used a standard cadmium sulphide photocell and 4.1kohm resistor to form a voltage divider. The free end of the resistor is connected to 0Volt and the free end of the photocell is tied to 5Volt. Across the resistor the voltage is proportional to the temperature reading. i.e. Light Level rises and Voltage across the resistor rises. The junction of the resistor and photocell I connected to analog input AIN2.
Step 2: Getting Sample Data.
I set two different thresholds. The higher threshold in for the park lights to turn on or off. The lower one of for the main headlights.
I used the back light of my bench power supply to give me the levels I needed.
To set these thresholds I had sufficient light on the photocell to simulate to light intensity I wanted to cause switching.
Step 3: Implementing in Flowstone.
Using the thresholds from the previous step, here is how I implemented it in Flowstone. The last pic is a screenshot of the prototype software I'm developing for the embedded system.
In the lights section I have a real time display of the light intensity.
Now with any photocell and fixed resistor, reliable switching of lights can be made. I hope you found this instructable useful.