# RGB LED resistor question

Hello, I bought some RGB LED’s, 10mm diffused common anode, and would like to know if I’m right about which resistor to use (I’m new to this).

The chart says:
If 100mA typical forward voltage for the red is 2.
If 100mA typical forward voltage for green/blue is 3.2.

Does this mean I need a 33ohm resistor for the red, and 18ohm resistors for green/blue?

Well, with a 5V source:
(5V - 2V)/0.1A = 30 ohm
(5V - 3.2V)/.1A = 18 ohm

Power dissipated by the resistor, P = (I^2) x R = .1A*.1A*30ohm = 300mW, and 180mW

100mA LEDs I imagine will get warm, P = I*V = 0.1 x 2V = 200mW and 320mW
If all 3 LEDs are on then Ptotal = 0.2W + 0.32W + 0.32W = 0.84W

Is that “100mA” some sort of peak figure?
Also, an Arduino output pin isn’t good for 100mA.

And will need a low Rds N-channel MOSFET to sink current thru the LED, such AOI514, that an Arduino pin can control:
http://www.digikey.com/product-search/en?keywords=aoi514

Not sure, I bought these off Ebay. There's a chart with information on them on that page. I've seen pretty much the same led's in tutorials online and they say to use 270ohm resistors for all 3 colors, which seems wrong since usually the red requires a different voltage from what I read.

I need to use 7 of these for my project, will it be a problem for the Arduino?

I think that I would go with <= 20mA (each element.)
270 ohm would not be a bad value (yielding 10mA or so each.)

Nooffswitch:
Not sure, I bought these off Ebay.

Those are 0.5W LEDs so if you want to drive them at anything approaching full brightness you need to use a constant current supply for each colour.

I need to use 7 of these for my project, will it be a problem for the Arduino?

Yes it will be a problem unless you get the correct drivers. Even if you only run them at 20mA that means you would be sourcing 0.42A from the pins which is over twice the absolute limit. If you were to run each at 100mA then you need 2.1A of current.

If I use an external power supply, rather then drawing power from the Arduino, would it be a problem to do what is in the included image, except I'd link another 4 LED's in the same fashion.

This sketch is what I currently have and the code is just cycling though a few colors which is working great so far, but I don't want to damage the arduino somehow.

Diagram

Nooffswitch:
If I use an external power supply, rather then drawing power from the Arduino, would it be a problem to do what is in the included image, except I'd link another 4 LED's in the same fashion.

Total disaster!

You are drawing your power from the Arduino (which is to say you are drawing power from the ground side of the Arduino, but it makes no difference - this is precisely the same as supplying a heavy duty 5V supply to the Arduino and having it power the anodes of a number of LEDs).

Nooffswitch:
This sketch is what I currently have and the code is just cycling though a few colours which is working great so far, but I don't want to damage the Arduino somehow.

You need to use transistors - or preferably, the FETS suggested - to switch the power to your LEDs if you are using PWM. If you did not need the PWM, a TPIC6A595 would be rather useful. As the forum software chose to wipe my previous version of this answer, I think I will leave it at that!

Hi, going by that diagram, your Arduino is probably ok at the moment. The pin connected to the red leds is sinking over 30mA, which is more than most people would recommend for long term use, but less than the 40mA max rating. But if you added one more led that would exceed the max.

Also, your external power supply is not needed for the circuit in your diagram as it stands. All the current is flowing through the atmega chip anyway, and it is less than 100mA in total, so could be provided by the Arduino's 5V pin.

These are interesting leds. I have not seen them before. Can't see anything like it at Farnell.com, but available from lots of vendors in far east on ebay, aliexpress etc. I saw one page that implied that single colour versions contained 5 led elements. If these were connected in parallel and drew 20mA each, that would explain the 100mA total draw. But it's hard to imagine the rgb version contains 15 led elements in a 10mm package.

At a total draw of 300mA, a 10mm plastic package would get pretty warm, as CrossRoads said. I wonder what temperature those Vf are measured at?

Paul

If I were to use the MOSFETS CrossRoads recommended, would I need one for each of the 3 color pins for each LED (21 in total for 7 LED's)?

Is there another way to connect 7 of these LED's and power them safely that you guys can list?

What if I were to use the 595n shift register like this?

Or npn transistors like this? (which would be a lot cheaper then using MOSFETS)

Nooffswitch:
If I were to use the MOSFETS CrossRoads recommended, would I need one for each of the 3 colour pins for each LED (21 in total for 7 LED's)?

OK, now it is all about driving sufficient current to the LEDs. If the FETs are rated for the necessary current for all of the seven LEDs, then you only need three. If it is not quite enough, then you might need two (or more) FETs per colour. You have to do the calculations according to the device specifications.

Nooffswitch:
Is there another way to connect 7 of these LED's and power them safely that you guys can list?

I think we have worked through the options.

Nooffswitch:
What if I were to use the 595n shift register like this?

74HC595s are not rated for 100 mA per output - barely 20 mA and even that is asking a bit much. TPIC6B595s would be OK. But as I said, this does not allow you to use PWM.

Nooffswitch:
Or NPN transistors like this? (which would be a lot cheaper then using MOSFETS)

Ah! you see, there is a reason for specifying MOSFETs. They have much greater gain than (bipolar) transistors. If you used transistors capable of driving the current of your 7 LEDs (700 mA), they would require more current to drive than the Arduino can provide. You would need more transistors in cascade!

"TPIC6B595s would be OK. But as I said, this does not allow you to use PWM."
You can use shiftPWM with TPIC6B595, same as you can with 74HC595.
http://www.elcojacobs.com/shiftpwm/

Grrr, I hate the way the forum auto-adds stuff to what I typed!

What about using TLC5940’s? I ordered some about a week ago thinking they might come in handy. Would I be able to use it with these LED’s?

You can use shiftPWM with TPIC6B595, same as you can with 74HC595.
http://www.elcojacobs.com/shiftpwm/

Yes, well, I kind of know that, but it seems a lot more involved than using hardware, so I was avoiding the subject.

Grrr, I hate the way the forum auto-adds stuff to what I typed!

Funny, don't think that happens to me!

Nooffswitch:
What about using TLC5940's? I ordered some about a week ago thinking they might come in handy. Would I be able to use it with these LED's?

The 5940's outputs can sink up to 120mA each, assuming a 5V supply. However, power dissipation may be the issue there.

The 5940 will have to dissipate (5-2)*100 = 300mW for the red leds and (5-3.2)*100 = 180mW for each of green and blue. So that's 660mW per led. Plus something for itself.

The power dissipation of the DIP package version is around 2,500mW, assuming it stays below 25C.

So I think even 4 of your leds would overload the tlc chip.

But if you reduced the brightness, either by using less than the max current the leds allow, or using the tlc's built-in pwm/dimming, maybe you can keep the power dissipation low enough. But that kind of defeats the point of these high-brigtness leds...

Have a look at pages 3 and 15 of the data sheet and see what you think.

Paul

It seems the FET's method is probably the way to go, although seems a bit pricey to get 21 of them just to power a few LED's. I'm still curious as to how I could do it with less but different FETs, but this is all new to me and I'm out of my element.

I made another diagram but I'm not sure if it makes sense.

Why don't you try drawing "100mA" (or 50mA, or 70mA) through one and see how that goes? You may see that they're brighter than you "require" before you're anywhere near there.
You don't need a FET to do that, either - an NPN will do.

Nooffswitch:
It seems the FET's method is probably the way to go, although seems a bit pricey to get 21 of them just to power a few LED's.