Saturday, August 18, 2012

And After 7 days I decided...let there be coloured light

Hey Everyone,

Well today is Saturday so that means more Micro Controller FUN TIME!
Today we will be playing with my RGB LED and using various sensors to control the color.

Lets first start just with the RGB LED. I've written a simple for loop that loops through each color separately once, while the other colors are set off. The color simply gets brighter as the value sent to the LED varies from 0 to 255.  Then I use the same scale but increase RED from 0-255, decrease GREEN from 255 to 0 and leave BLUE set to 255.  Lastly I set RED to 255, increase GREEN from 0-255 and decrease BLUE from 255 to 0. All this takes is 5 simple for loops.  Simple.

Next I decided to use my photoresistor to change the color.  I set RED to 255, GREEN to be dependent on the light level and blue to be 0. I scaled the output from the photoresistor to be within 0-255.  As you can see in this video, when I shine the light from my iPhone onto the photoresistor, the color changes. Because the sensor is less resistive under more brighter light, the color switches from yellowy green to red.  You can see in the video below that the response is very very quick, and quite sensitive to the light  on the sensor.


Next is a quick video showing the use of the soft potentiometer.  As you can see as I move my finger along the softpot, the color of the LED changes! HORRAY!!!



After that I thought, well lets see if we can use the temperature to control the light color.  Using the map function I was able to get this work quite well, at least I think so. Here it goes from blue when less than 18 Celsius degrees to red when more than 25 degrees Celsius. I could have just as easily mapped this to be very sensitive to small changes in color. Or even a easier, a threshold value, but I wanted to do a gradient.

Okay, so I think you get the message that you can control many variables with many other variables.  This will most definitely come in handy during my quest to build a time lapse device as I believe I may also build a high-speed shot set up, whereby a flash going off triggers my camera to take a picture.  People have used this to dramatic effect to capture pictures of slashes, balloons bursting.


Next we will be trying to convince Nicole's old Canon A520 to become a time-lapse camera using CHDK (Canon Hack) and the Arduino.

No comments:

Post a Comment