Interactivity & Installation

Friday, November 6, 2009

Using a light sensor to alter states of a LED

By changing the intensity of light received by the tiny light sensor, the LED blinking rate can be manipulated. As seen in example 6a, it looks pretty straight forward...



I did not get it to work yesterday wondering if it was a bad sensor. I talked to an engineer and showed him the circuit. He quickly spotted an error, I had put the sensor on the other half of the breadboard... oops...

Example 6b as shown below, the change of the original code was subtle, modified the code:
analogWrite(LED, val/2) and produced a more dramatic result.



* updated on Nov 29 as followed...
Since the effect was rather subtle, I replaced the original light sensor with a larger 12mm one to give it a try. The modified code did not work properly... ??? Change back to the original code worked a little better... The result did not make much sense...

Upon trying back & forth with the 2 sensors and various codes, the size of the sensor seems to contribute little to the test results. The sensor is in fact sensitive to light from various directions, not just on the top portion. Thus, the larger the sensor, the harder to control bounced light from around; yet deliver unpredicted results. Video below use a black box to block direct light & bounced light, the original and modified code with either one of sensors finally all work properly.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home