So we've talked a lot about LEDs and likehow does an LED work on a semiconductor level.
We've talked about some of the pros andcons of the LEDs.
And we've also talked about how anindividual LED can be dimmed whether through PWM or through analogcurrent control.
So, we've discussed all of these things beforebut now we want to talk about RGB LEDs and how to use them to producedifferent colors.
An RGB LED is basically an LED packagethat can produce almost any color.
This is great because it can be used in alot of different applications such as outdoor decoration lighting, stage lighting designs(and) home decoration lighting.
LED display matri- matrices.
They're really cool.
So you can use them in a lotof different ways.
RGB LED literally stands forRed Green Blue.
The way you get all of these different colors is bymaking either the red, the green, the blue, brighter or dimmer (or) however you needto get the exact color you want.
In my mind I think of like, when I'm lookingover the design guys' shoulders and I see on their screen there's thiswheel and it just shows all the rainbow of the color in different areasand then they just kind of choose what they want from that to getthe color they want.
You can do the exact same thingwith an RGB color.
Only thing you need to do with this RGB LEDis to set the intensity of each leg to combine them together to getthe color output that you want.
In this case, we're using pulse widthmodulation to adjust that intensity individually and the trick here is that our eyeswill see that combination of colors instead of the individual colors because theLEDs are very close to each other inside.
When I say the LEDs that's the funny thing.
So an RGB LED is actually simply three LEDs that share either common cathodeor common anode.
As you can see here, there are four leadsand one goes to the red LED, one goes to the green, one goes to the blue and then in this particular one, it's acommon cathode.
If you look inside, you can see that thelongest lead is actually connected to the base there, it's the biggest pieceof the structure inside so literally an RGB LED is three LEDs stucktogether in one particular package.
And that makes it really easy becausethen you don't have to put three LEDs together and hope that that's good enough and itmakes it a little bit more space-saving and having a common cathode or anodeif you get one of those is really really helpful.
Briefly, the difference between acommon anode vs.
a common cathode is that in a common anode, the anode pin of the internal LED are all connected to the external anodepin which I don't have an example of that here but to control each color, you need toapply a low signal or ground to the red, green and blue pinsand then connect the anode pin to the positive terminal of the power supply3 volts, 5 volts or whatever.
In this case with a common cathode, you have the cathode pin of the internal LEDs are all connected to a single pinand so to control each color, you need to supply a high signal, Vccor VDD to the red, green and blue pins and then connect the anode pin to thenegative terminal of the power supply.
And that is actually what I have here.
So let's look at this really quick.
This is my demonstration.
All of this, theway it's set up and the code on the Arduino is on our website and JB put this tutorialtogether so thank you very much JB.
What I have going on right here is, I have somepotentiometers, some trimmers right here that are sending a signal, basicallyan analog signal, to the ADC of my Arduino.
And the ADC is measuring that voltage andthen based on that, on the voltage that i'm giving it, it's changing the duty cycle ofthe pulse width modulated signal to the RGB LED.
I actually went one of the few thingsI've done right in my life.
I have done the red, green and blue tocontrol each one of these colors and that's also associated over herewith the trimmers.
This being cathode, it is going to be positivevoltage right here to the red, green and blue.
And then your common cathode rightthere, that is going to ground.
So I'm just going to show howthis is done really quick.
You can go over to the red and veryeasily change it and you get red.
Very nice! Change that over to green and then blue.
Now this is pretty straightforward where itgets complicated and gets interesting is that you can make combinations, again colors are not my strong points so as I was messing with this, I'm sure mykids in elementary school know this but I had forgotten red and greenmake yellow.
So you can change the green if you wantit to be a little bit more red get a bit more of a sunset glowthere and maybe even throw in a bit of blue I don't know what's gonna happen.
That's kind of violet.
But as you adjust these, you get basicallywhatever color you want.
So we can turn off the red completely andpull it up and get a greenish blue color right there and again it's one of those thingswhere it's however you need to change it to get the color you want and when youset this up and you're getting those values and deciding what you need to do, make sure that you take into account the different resistors you have hereso I'm basically doing a big no-no right here and all of my resistorsare the same even though the red has a much smaller forwardvoltage drop than the blue and the green.
So when you are calculating out whatthe duty cycle is to get the exact colors you need, make surethat you're also taking into account the resistor value right there or elseyou're not gonna get the same brightness and you're not going toget the same shade you need.
So not only the duty cycle is taken intoaccount here, of the pulse width modulation, but also the resistor values that youhave on each one of these pins.
And although I am controlling thisspecifically with the trimmers, it's something where if you knowexactly the colors you want, you can go and see alright I know thatI need to have 20% duty cycle on this 70% duty cycle on this andmaybe 100% duty cycle on that to get the color I want and then you canjust hard code that into your Arduino or into whatever logic board you haveand it will produce the color you need.
So, RGBs are really simple.
I mean all it is, is 3 LEDs that share a common cathode or a commonanode.
They're very simple.
The code as you'll see on our websitefor this Arduino is very simple to do even this where you can control it.
They're fantastic to use and whatever project you want to do again whetherthat's some small little cube that you're gonna put on your desk or you're doingsome cool lighting in your house.
They're fun to use, they're easy andthey're really cheap.
I mean it's crazy how cheap LEDs havegotten so highly recommend on your next project putting something inthere where you can make it a little bit brighter, shinier and getexactly what you want.
Hope you found this interestingand useful.
If you did, leave us a like andsubscribe to our channel.
We'll catch you next time.