Controlling 50+ RGB LEDS using Arduino

Alright so I've finally gotten all my parts to build my own RGB LED Strip. I am using the following schematic:

Only I am extending it for 50+. I have:

12v / 6A DC Power Supply
50 RGB LEDs (Datasheet - noodlehed.com)
470 and 510 1/2 Watt Resistors
3 NPN Transistors (Datasheet - HTTP 301 This page has been moved)

When I wire it all up, the RGB LED is so dim you can barely see it lit. I've got each color connected to Pins 4, 8 and 12 into the Base, the light wired up to the collector and the emitter to the ground.If I remove the transistors and directly connect the light to just the power supply, the light works perfectly and is as bright as can be, leading me to believe I'm not understanding something about these transistors and how to control them using the Arduino. To turn them on I am just using digitalWrite(pin, HIGH).

Also I do not have an base resistors for the transistors, I'm not sure if that could affect it. If I need the, can anyone tell me how to calculate the resistance required??

If anyone can explain to me why my LEDs are barely turning on that would be so helpful. I'm so close to being finished and this is all that's keeping me from it :frowning:

To elaborate since I forgot a little bit...I am just testing this with one LED currently. When that one LED is powered using my power supply, it is dim. When powered using the USB from the Arduino it is slightly brighter but not fully lit. This is confusing because shouldn't it be brighter with the higher voltage and current the power supply gives??

If any more information is needed please just ask and I'll be happy to answer!!

Are you running them from the 12V supply or from some unspecified 7.2 to 9V supply? That number is needed for calculating the current limiting resistors.

At 20 mA each * 50 LEDs you'll need 1A per color so 3A total. Or were you planning on running them closer to their absolute maximum rating: 50 mA.

The base resistors protect the Arduino from having too much current drawn. At 5V you want a resistor greater than 125 ohms so 200 is a good choice.

I am using the 12v 6A external power supply to power the LED. And yes, I calculated that 3A will be needed for 50 so I bought the 6A power supply. And for the base resistor, if it's 200 ohms at 5v, what would it be at the 12v??

I am only doing this with one LED so far so this is why it's confusing me why the light it dim. I could understand if my power supply wasn't strong enough for all 50 or the arduino couldn't power all them...but I've only tested this with one LED so far. The LED is not broken so it should be full strength like it is when I directly connect it to the power supply without the transistors =/

Just remembered too which could be useful. When the arduino is powered with a 9v battery the LED doesn't even turn on, but when powered through USB it's brighter, but still pretty dim. I know the USB supplies more current, but with only one LED this shouldn't make a difference =/

There is another problem here, the specs for the transistor you are using say that the gain ( basically collector current to base current ) can be as low as 19.

You want the transistor to switch hard on.

This means that to switch 1 amp it would need a base current of 52 mA, which is too much for the Arduino .

I would rather use a power mosfet which needs virtually no gate current, and acts as a less than 1 ohm resistor when on.

As to the illogical symptoms your test setup is displaying, are you sure you have the transistor wired correctly ? the base is on the left when you look at the writing side , with the legs downwards.

Yes, I'm sure I have it wired correctly, it's confusing the hell out of me too haha What you're saying makes sense that not enough current is being supplied to the transistor to turn it on. What is a MOSFET transistor? Does it work exactly the same way: base, collector, emitter...when base is supplied current it switches on? Would it be possible to use 6 of those transistors in total to make 3 Darlington pairs?? I'm new to using transistors so if any basic explanations could be given that would help so much.

I really appreciate the explanation regarding my transistors, very helpful in understanding them!!

Also if I do go for the MOSFET, what specs should I look for in handling 12V 6A? I'm assuming I'd need pretty good ones right?

I would go for a BUZ11 ( or equivalent ) , its way overkill, but was commonly used in TVs so should be available. It will stand 50 volts and pass 33 Amps !

An FET is like a voltage operated switch, but has drain, gate, and source in place of collector base and emitter.

You can Google it for the explanation.

Basically when you apply more than about 3 volts to the gate , the thing switches on and becomes a virtual short circuit ( 0.03 ohm ) between the drain and the source.

You wont need a heat sink, it wont get warm.

It is normal to put a 100 ohm or so resistor in series with the gate, ( Google it, its for protection of the gate ) but will work without it as there is basically no gate current drawn.

The pin connections are the same as the transistor you are using, so you can just swap it.

Wow thank you so much for your help! Last question now is which MOSFET to buy. I would definitely go with the BUZ11 but I can't find any that would arrive here before November 28th :frowning: I found similar ones and I'm wondering which would be best for allowing the Arduino to control the switching. I only need a max of 6A because thats the max of the power supply, so here are a few I found that could get here by Friday!!

http://www.datasheetcatalog.org/datasheet/fairchild/IRFBC40.pdf
http://www.irf.com/product-info/datasheets/data/irf630n.pdf (The NL model)
Intelligent Power and Sensing Technologies | onsemi

And out of those, will they work the same? Like supply 3v and it will switch?

Also, will MOSFET transistors allow me control PWM? I want to be able to fade between colors and control the brightness of each. Is this possible at all with any setup?? For example, analogWrite(led, 0) for off, analogWrite(led, 255) for on and analogWrite(led, 122) for half? This will allow color mixing and allow me to fade between colors and brightnesses!!

Thank you again for the help, it's been really useful in my understanding!!

Freumar:
Just remembered too which could be useful. When the arduino is powered with a 9v battery the LED doesn't even turn on, but when powered through USB it's brighter, but still pretty dim. I know the USB supplies more current, but with only one LED this shouldn't make a difference =/

Could it be that the Arduino ground is not connected to the LED ground? Without that connection it would be hard for the Arduino to get any current to the transistor.

I have the Arduino's Digital Output pins to the Base, the Power Supply's positive lead to the Anode of the LED and resistors in parallel to the RGB pins of the LED to the Collector then the Emitter is connected to the ground of the power supply. Do I need to connect anything else from the Arduino to the power supply? Should I connect the Emitter to both the Power Supply Ground and the Arduino Ground?? Or maybe just the Arduino ground? Won't this not allow a current through the circuit from the power supply?

Freumar:
Should I connect the Emitter to both the Power Supply Ground and the Arduino Ground??

YES! The Arduino can't supply Base-Emitter current unless the Emitter is connected to the Arduino Ground and the power supply can'y supply Collector-Emitter current unless the Emitter is connected to the power supply ground. Don't worry about connecting the grounds together.

Hahaha oh wow...That sound pretty basic that I missed...I am trying this right away and letting you know if that works!!

It works perfectly now with one LED!! Thanks for diagnosing that really simple mistake, you saved me so much frustration!! And I'm still interested in the MOSFET transistors. When I reach higher currents, the transistors I have will need a bigger current to switch on than the Arduino can supply correct? Is it still worthwhile to switch over to MOSFETs? They seem to be exactly what I'm looking for to do the switching! If so, which of those 3 seem to be the best-fit or is there another one that is recommended other than the BUZ11??

The last one has typical 3v threshold voltage, the first 2 look like 4 v so I would go for the last one.

Sorry I missed the grounds :slight_smile:

Check AWOLs signature !

Freumar:
When I reach higher currents, the transistors I have will need a bigger current to switch on than the Arduino can supply correct?

Even with less, the Arduino probably shouldn't be supplying the current...

Freumar:
Is it still worthwhile to switch over to MOSFETs?

Is it working? No need to switch...

When you get up to 3A , the MOSFETs will be a better way to go.
Where are you located?
I usually use digikey's search filter to find one.
What you want is:

  • N-channel mosfet
  • in stock
  • logic level
  • thru hole
    then sort by cost
    browse the resulting list, getting past the 1000 and 2000 qty prices, looking for Low Rds (down in the 10's of milliohms) and low Gate Capacitance (for fast switching) with the needed power handling and package style that's comfortable to work with.

For example:

If you can't order from digikey where you are, then look for those kinds of parameters in the parts from the source you can order from.
It needs to be Logic Level so the MOSFET turns on full with 4.5-5V. Otherwise, you will need some buffering in front of the MOSFET, the output of that buffer will need to able to go to 10-12V to turn a Standard MOSFET full on.

Wow thank you for all the help guys!! You all have been so helpful. As a final check, CrossRoads, would the example transistor you linked be fine for what I'm looking for? Is:

http://www.fairchildsemi.com/ds/MT/MTP3055V.pdf

just as good? I can have that transistor here by Friday off eBay which would be great!! If not I'll do some searching on DigiKey for a better one following your specifications.

And last, what resistor should go before the MOSFET? I feel like I ask this question too much but I want to make 100% sure I have everything correct before I begin building my LED strip!!

No, that is not a Logic Level MOSFET - all the switching times & currents are rated at 10V.
You want one with ratings at 4.5V.

The gate transistor is determined by the current flow you want out of the arduino.
Gate capacitance looks like a short to ground being charged up initially, or a fully charged cap being discharged.
If we limit the current to 35mA:
So 5V/35mA = 142.8 ohm, so a 150 ohm resistor would allow fast charging while not overstressing the IO pin.

Alright, thank you so much CrossRoads and everybody else for your information; it's all been incredibly helpful in my understanding of transistors. Hopefully the MOSFETS get here by the end of the week so I can build my circuits!! Everything works perfectly right now and waiting to get my MOSFETS and everything should be great.

Thanks again everybody!