I just bought these today but it seems red over rides the other colors when you try to hook them up in combination. Is that because I just have one resistor on the common anode? Here is the data sheet since I know you guys love data sheets.
https://cdn-shop.adafruit.com/datasheets/FLR-100WAS-RGB.pdf
You need a resistor on each cathode. I hope the part is still OK.
You need a resistor on each cathode. I hope the part is still OK.
Or multiplex them one colour at a time
You also may PWM the LEDs and strobe them at the same time minimising the current consumption
Use of individual r's is an adequate solution, but if you want real
control drive each LED with a current source. You will have much
better control over temp and device to device variation due to
Vled threshold.
Regards, Dana.
It is shown on the datasheet. The red hogs all the current because it is a lower voltage diode and conducts at about 2V. The green conducts at about 3.2V and the blue conducts at about 3.4V. They all light when they have their own resistor.
I just bought these today but it seems red over rides the other colors when you try to hook them up in combination. Is that because I just have one resistor on the common anode?
A very big YES.
Do this:
You need a resistor on each cathode. I hope the part is still OK.
This is the simplest way to address the problem. (Oh - and as long as the current through the red LED has not exceeded the maximum allowed, then the part will be fine.)
Here's why:
It is shown on the datasheet. The red hogs all the current because it is a lower voltage diode and conducts at about 2V. The green conducts at about 3.2V and the blue conducts at about 3.4V. They all light when they have their own resistor.
Using the water analogy, your LEDs are a bit like waterfalls. The red ones are low in height, the green ones are much higher and the blue ones a bit higher again. By having one resistor, you are basically feeding all 3 waterfalls from the same pond. Once the water (voltage) gets high enough to pass over the red waterfall, that's where pretty much all the water goes. The green and blue ones are just too high and look like walls and the only water passing these is, more or less, seepage. By using one resistor for each LED, you are providing each waterfall with its own pond, so the ponds can be at different water levels and you get water flowing over each waterfall.
The other suggestions about multiplexing and constant current drivers are alternatives that require more circuitry and just a little more design effort than you might be capable of at this time.
Ok... let's say you are trying to use this tricolor common Anode LED with your Arduino.
So you check the Data Sheet and find the Vfwd for each color as follows: Red, 2v. Green, 3.2v. Blue, 3.4v.
The basic circuit is going to be like this:
+5V > LED common Anode, each LED Cathode > each resistor > each Arduino pin
And you will want the Arduino pin to go LOW to turn the LED ON (5v is the Source and the Arduino pin is the Sink, so a HIGH pin (+5V) will result in no current flow and a LOW pin is like the pin is grounded, so current flows.).
And you want, say, 10mA current through each separate color of the LED.
So you use Ohm's Law to calculate the resistor value for each Cathode. R=V/I so
(Vsupply - VfwdLED)/0.010 = (5 - 2)/0.010 = 300 ohms for RED LED
(5-3.2)/0.010 = 180 ohms for GREEN LED
(5-3.4)/0.010 = 160 ohms for BLUE LED
So these are the three resistor values to start with, to give 10 mA through each color LED. But does this result in "equal brightness" as perceived by the eyeball? So you may need to adjust the values to give equal perceptual brightness.
Now, if you use three of the Arduino's PWM pins for the LEDs, you can use analogWrite() statements to control the LED brightnesses by PWM and code, as in the Examples>Basic>FADE example sketch in the Arduino IDE. So you can essentially arrive at almost any final color from the 3-color LEDs in combination at different brightnesses. The UNO's PWM-capable pins are 3,5,6,9,10,11.
I put my 3-color LED inside a ping-pong ball, with its individual cathode resistors connected to PWM pins of the Arduino, and my sketch fades each LED at different rates, so the ping-pong ball fades through "all" colors. Makes a nice "mood light".
OP: The problem you'll find if you PWM with only a single resistor is that at times more than 1 LED can be on at the same time and you'll get the same problem as you posted.
E.G you want White so all 3 LEDS are on at the same time so red hogs all the current, as explained above.
Thus you would need to multiplex them.
https://en.wikipedia.org/wiki/MultiplexingIn this case it means to only turn on red, then turn it off, then only turn on green, then turn it off, then only turn on blue, then turn it off, and back to red and repeat......
When this is done very quickly it looks to your eye as if all three are on at the same time.
https://en.wikipedia.org/wiki/Persistence_of_visionHowever to control the colour + brightness you have to work out how much time each red, green and blue gets to create the balance you want.
Whilst multiplexing through a single resistor is a valid and correct answer at your level I strongly recommend three individual resistors (see above for value calculations) and not having to worry about multiplexing - crawl (three resistors) before you walk (IC) before you run (multiplex)
Just bear in mind that an arduino really can't multiplex and PWM at the same time nearly fast enough to eliminate flicker. Because of the "phantom array effect", you need a 2KHz PWM speed (not the 60Hz of moving images).