PDA

View Full Version : RGB controller



Campeck
01-25-2010, 05:52 AM
I have tried at times in the past to control an RGB led with the basic stamp 2.

My goal was to have the colors fade in and out, basically the typical RGB led application.
well hooking the RGB led to the output pins and trying to program the fading does not work, since the BS2 can only do one PWM at a time. and cycling through the colors quickly was just too slow.

But after reading the analog and digital parallax book the last circuit they have you build finally gave me an answer.
using a capacitor resistor network and charging it to a certain voltage with the pwm command, and then using a 741 opamp as a buffer I can set the desired voltage and then move to the next color, and do the same. Then using the Opamp output to control the current through a transistor I can use highpower LEDs.

There is one remaining question though. I have set the circuit up with a 70mA red led and use a 100 ohm resistor to control the base of a 2n3904 NPN transistor. The opamp swings to 5v since its using a 12v supply. So at 5v and 100 ohm should put 50mA on the base of the transistor which should be more than enough to put the transistor into saturation. and with 70mA of current going from Collector to Emitter should give me a CE voltage drop of .1v but the minimum drop I measure is .8v...

whats going on? I'll draw up a schematic.

Post Edited (Campeck) : 1/24/2010 10:03:52 PM GMT

jeff2.0
01-25-2010, 10:40 AM
The transistor can't handle 70ma going through it?
Try a normal LED and see if that works.

Campeck
01-25-2010, 05:29 PM
well Its alright. I hooked up the green and blue LED and the red was way too bright so I did away with the resistor and limited It to 20mA which is the max the green and blue can handle.

video:

www.youtube.com/watch?v=ASHEzlgiUKU (http://www.youtube.com/watch?v=ASHEzlgiUKU)

Post Edited (Campeck) : 1/25/2010 9:52:34 AM GMT