Demystifying 4 pin RGB LEDS (Radio Shack 276-0028)

 by Dain Unicorn
Featured
Arduino4pLED02.JPG
RGB LEDs are fairly useful in projects allowing for a wide range of color from a single unit.  However they can be a pain in the neck to work with and they too often come with little or no documentation.  I searched for some time to find a common resource on them and this Instructable is an attempt to pool the fruits of that search into one place.

But first, a word about diodes.  What is a diode?  It is the electronic equivalent of a one-way valve.  They have a flow direction, and if inserted backwards do not work.  They prevent the voltage from flowing through, except in the direction of their flow.  The first diodes were used as rectifiers in decoding radio signal modulation.  For more on the history of the Diode, your welcome to check them out on Wikipedia http://en.wikipedia.org/wiki/Diode

Whats that have to do with LEDs you ask?  Well LEDs are by nature diodes.  It is in their name -- Light Emitting Diode.  This means that if you cross connect the Anode (+) and the Cathode (-), nothing happens and your circuit fails.  Usually resulting in nothing more than an open circuit as voltage cannot flow.   For more on the history of the Light Emitting Diode, or LED, you can go here on Wikipedia http://en.wikipedia.org/wiki/Light_emitting_diode

Four pin RGD LEDs are a little different.  They share a common Anode, but three separate Cathodes, one for Red, one for Green, and one for Blue.  If your not careful you can pass current through conflicting parts and cause a spectacular failure complete with a snap, a pop, a whiff of ozone, and plastic shrapnel flying all over your workspace.

This is usually caused by the omission of a current limiting resistor to the circuit (yes, I'm guilt of this).  Incidentally, this sort of failure is not covered by Radio Shack's warranty.

The LED in this project was purchased at a local Radio Shack and has the following part number, 276-0028
 
Remove these adsRemove these ads by Signing Up

Step 1: The Pinout

Arduino4pLED03.JPG
One of the most annoying part of these little gems is the lack of a pinout diagram that was useful.

While looking at the photo, you will notice that the four pins are three different lengths.  Also there is a flat side of the housing on the left side.  With the flat side to the left, as in the photo, the pins are:  RED Cathode (medium length pin), Common Anode (longest pin), , BLUE Cathode (shortest length pin on the inside), and GREEN Cathode (shortest length pin on the outside).  This is not how I would have designed the unit as I think it would be easier to keep up with it if were Red-Green-Blue, but that's logic for you.

A quick look at the datasheet screen-printed on the package indicates that the different Cathodes use different current levels.  2.0V to 2.6V max at 50ma for the Red, and 3.5V to 4.0V at 30ma for the Green and Blue.  Its important to note this when calculating what resistor(s) are necessary for your project.
SamGammond says: Dec 19, 2012. 9:09 AM
The resistor sets the total resistance in the circuit path. This is what determines the amount of current running through the circuit (simple Ohm's law -> V = I x R -> I = V / R).

Resistance of any diode from anode (+) to cathode (-) is essentially zero.

An example: 5 V across a 220 ohm resistor.
current = voltage / resistance -> I = 5 V / 220 ohms = 22.7 mA

So it doesn't matter where the resistor is in the circuit path; the total circuit resistance would be the same so the amount of current running through the LED is the same.

Now with no resistor in the path and just a voltage source connected to the LED.
current = voltage / resistance -> I = 5 V / 0 ohms = infinite amps
of course there's no infinite current, but your voltage source (battery etc.) will put out it's max current... so as he said... no resistor.. LED goes "pop"

Sam
Lonely Assassin says: Dec 14, 2012. 10:30 AM
I'm kind of new to electronics, so I may be wrong, but I do have a theory. Could it be possible that the red is overpowering the blue and the green because of the common resistor serving all 3 colours rather than appropriate sized resistors for each? Because of the different forward voltages and currents (2.0V-2.6V@50mA Red/3.5V-4.0V@30mA Green and Blue) I believe you should add more resistance to the red. What if you were to add a resistor (I'd estimate around 22 ohms) between the output on the Arduino and the red leg of the LED? Let me know if you try this out and if it solves the problem. I'd be interested in knowing how far off I am.
mattmahn says: Jul 1, 2012. 12:33 PM
It works both ways because the current is dropped before it reaches the power source and LED again, completing the circuit.
Think of it as a Snake game, where the head is the first electron. The electron leaves the anode of the power source and flows through the LED not yet illuminating it because the circuit is incomplete. The "head" continues into the resistor which drops the current/voltage to a safe level for the entire [series] circuit; then continues to the anode of the power source, completing the circuit and illuminating the LED.

Disclaimer: I'm subscribing to the actual movements of electrons (from negative to positive), not conventional
adammary says: Apr 13, 2012. 2:18 PM
Hi,
Not all the pins must be connected to PWM pins right? I mean if I want to leave the red light on and vary just the blue and green light, i can just connect the pin corresponding to the red light to a non PWM-pin?
Dain Unicorn (author) in reply to adammaryApr 14, 2012. 7:56 PM
No, if your happy with the output at full intensity, then by all means connect the Red Cathode to a digital pin and simply use digitalWrite(RedPin, HIGH);
CheesePatrol says: Mar 20, 2012. 7:40 PM
Thanks! This came in very handy on a project I'm working on
facklere says: Feb 25, 2012. 6:34 PM
My knowledge of electronics is extremely limited, so I could be completely wrong, but I believe the placement of a resistor after the LED works because it still limits the flow of current through the circuit. If the lead after the LED is disconnected, opening the circuit, the LED can not blow out because current is not flowing through the circuit. In the same way, if you limit the amount of current flowing after the LED, it will also limit the amount flowing through it. Again, could be totally wrong on this. Anyone know if it's right?
mpilchfamily says: Feb 21, 2012. 4:58 AM
You may want to reread and relabel everything. In your image you have the pins labeled wrong. The longest pin is your common Anode. Your last paragraph in step 1 then mixes up the Anode and Cathode again.

In your final hookup your using a single 220 ohm resistor on the Common Anode. While this works to keep the LED from burning out it doesn't balance your colors. As you mentioned the individual colors in the RGB have different forward voltages and current. I cover this in my 6 Button LED controller i posted a couple of weeks ago. 
http://www.instructables.com/id/6-button-RGB-controller/

So if you want each color to have the same brightness you will need a different resistor for each of the Cathodes.This way when all 3 colors are full on you have the LED shining white. Otherwise your have a greenish blue hew to the light. That is why your blending effect looked a little off. 
Dain Unicorn (author) in reply to mpilchfamilyFeb 21, 2012. 7:24 AM
Thank you!

I originally thought it was a common Cathode model, and started writing that way. When I discovered I was wrong, the instructable was almost finished and I thought I had fixed the inconsistencies. I've linked to you and your project in the 4th step because your right, designing a circuit with resistors to bring the voltage in line would help blend things better, but as you can see I tried to keep things at the simplest level and still demonstrate the LEDs abilities.
mpilchfamily in reply to Dain UnicornFeb 21, 2012. 9:16 AM
I struggled with the same thing when i was working on my project a couple of years ago. Had a big discussion about it all on the Arduino Forums. At first i was using separate red, green and blue LEDs to make my sketch. I then went to Radio shack to get an RGB. I ran into all sorts of problems when i switch to the RGB. My sketch was originally controlling the LEDS through the Anode. So getting an RGB with common Anode forced me to reverse the logic of the code. So the complications of the LED change and my limited coding knowledge made things difficult. Here is the link to the thread.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1263501476
pcooper2 in reply to mpilchfamilyFeb 22, 2012. 1:37 PM
You can also reverse the logic by using external inverting Darlington pair drivers in common-emitter configuration. That way, the Arduino code doesn't need to be changed, and the external drivers can be easily replaced in case of electrical damage, without risking the microprocessor chip.
Dain Unicorn (author) in reply to pcooper2Feb 22, 2012. 6:01 PM
In a production piece I would most assuredly like a level or two of safety between the micro controller and the business end of things. I'll look into external inverting Darlington pair drivers, as I have an upcoming project that they may prove useful for.

Thank you
matt.e.jenkins says: Feb 22, 2012. 1:39 PM
I wish i had this a while ago. I used one in a project and it was tricky figuring it out. Thanks for this.
Dain Unicorn (author) in reply to matt.e.jenkinsFeb 22, 2012. 5:59 PM
Your welcome.

Knowledge shared is knowledge squared, knowledge hoarded is knowledge doom to be forgotten.
dwbechtel says: Feb 22, 2012. 11:11 AM
Actually, you supply power to the Common Anode and pull each Cathode to ground.
Dain Unicorn (author) in reply to dwbechtelFeb 22, 2012. 12:49 PM
You are correct, and that is what happens, I simply stated it a different way.
maxhirez says: Feb 22, 2012. 8:17 AM
Thanks Dain! I got a load of these in an eBay lot and was starting to wonder if they'd ever have a use on my workbench other than sacrificial lambs...
pcooper2 says: Feb 21, 2012. 7:45 AM
The lack of proper documentation is a RadioShack hallmark; it has been so for decades. If the package includes the manufacturer's name and part number, one is well advised to go to the manufacturer's Web site and get a PDF copy of the specification sheet, which will include a package diagram with pinout, and often includes test circuits and even application hints. That's how electronics design engineers do it. It's much easier these days, as one doesn't need to get physical copies of the companies' data books.

Other good sources of PDF data sheets are industrial distributors, such as Digi-Key Corporation (www.digikey.com) in Thief River Falls, Minnesota and Mouser Electronics (www.mouser.com) in Mansfield, Texas. In the days of printed data books, the distributors would also supply all the documentation that engineers needed. Today they do it in the form of freely downloadable PDF files. As a matter of fact, as long as you're at the Digi-Key site, set up an account and place an order. RadioShack has a reputation of selling manufacturing seconds -- slightly out-of-spec parts that are considered "hobby grade". If you have a real, serious project, you might as well buy the real, in-spec parts from a reputable distributor. Digi-Key started out as a small outfit catering to the small buyer, and even though they've gotten big, they still fill small orders with no question. In my work as a design engineer in industry, I've often used them when I needed to quickly get parts for a prototype.
Dain Unicorn (author) in reply to pcooper2Feb 21, 2012. 8:26 AM
For what it is, A toy store that stocks components, Radio Shack isn't bad. Expect any more than that, and that's when you get disappointed. I guess I remember the days when Rafio Shack seemed to only hire people that knew which end of the tube went where. Yes, those days are long gone sadly.

I agree it's not the best resource, but many hobbists seem to start there. My 'day job' has me going there for my projects because as an Over-The-Road Trucker, waiting three plus weeks to get home for an order isn't always ideal.

Thank you for the links, I'll be sure to check them out.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!