Connecting many RGB LEDs to same PWM pins?

Halo, I want to be able to color a glass plate using a lot off RGB Leds, for now it is okay if the entire plate is the same color.
(In the end it should be wireless using the Xbee, but lets start with the basics)

I can make 1 LED dim and change color, but I need more light than 1 LED.

  1. What kind off LEDs should I use? I read that it is not possible to connect thos 4 Pins RGB LEDs (with commen cathode) in series, so is it better to get a bunch off Red, Green and Blue ones?

  2. I know my Arduino can only power so many LEDs, so how do I go arround and connect them together using a second power source?

  3. An idea I was thinking off PWM-ing a transistor for this, would it work? what transistor would you recommend me?

  4. Isn't PWM-ing a pin and recieving DATA from the PC interfering with eachother? perhaps different ways, like using the 555.

Any other tips/hint are also welcome, thank you for your time, I am a newbee, so keep it simple.

Use 3 PWM pins, hook up a transistor to each and then attach all the LED's leads to the appropriate pins in parallel. So all the red leads go to the same pin, etc...
You cant do it in series because they are common cathode. Just ground the cathode pin on all the LEDs.
AFAIK your standard transistor would be fine.

How many are you thinking of having?
Powering the Arduino off USB gives you a limit of about 8 RGB LEDs when they are all displaying white (so ~24 LEDs total). You could probably have a few more than that.
How I know is because when I used 8 RGB LEDs displaying white with a LCD attached, everything dimmed slightly.
You can just use a 9 - 12v plug pack and that will power a lot of LEDs. No need for a second power source.

PWM while receiving data is fine. Both are done in hardware not software.

:slight_smile: Thnx for the sweet help on explaining this.
Ehh.. (getting my Electronics for Dummies book), lets say I do this for 4pin RGB LEDs.

For 1 PWM pin:

So, I get 1 transistor that can handle enough power to use for my LEDs

Put the PWM pin off the Arduino to Basis/Gate.
Put a decent power suply to the Emitter/Source.
Put My LEDs to the Collector/Drain.

And than do this also for 2 other pins....

Than I simple hook all the Red pins together, the Green pins together, and the blue pins together (ofcours connected to the proper collectors/gains).

Next I connect all the commen, where I connect the commen? Does that goes to the negative pole from the power suply?

Also, I am sure I need some resistors here somewhere (one always needs resistors :wink: )

If you say this could work, I will post a drawing.

edit: something like this? (can you sugest a decent transistor?, and this is for a 4 pin RGB LED :wink: )

edit2: Ahh. I read It is best to give each seperate LED a Resistor, should I place it before or after my LED?

Doesnt matter if the resistor is before or after.

That schematic is correct for individual R, G and B leds.
Its similar for RGB ones.

:slight_smile: Is it realy that easy? HOW COOL!!! Thnx Cheater :sunglasses:

Now, what resistor is use-able for this? And what LEDs do you recommend me?


Can do some resistor calculation once I know what the LEDs want on how my powersuply will be :slight_smile:

You dont need R1. Just one resistor per LED (per colour for RGB LEDs since they are technically 3 in one).

Here's a link to a PDF with all you need to know about current limiting resistors when hooking up LED's.

I forgot where i found it so i put it on my own site.

EDIT: Just remember that many of the very bright LED's are NOT 2V but 3V

Well, thnx again for the info, This is getting cool!!

I hear/read that my Arduino has 6 PWM pins, but looking to the Amtel PinMapping, I only end up with 3 PWM pins. 1 RGB Color is cool though, 2 would be cooler :wink:

When I got this to work, I get me some Xbeez and build a wireless table, with LED inside, a bit like this one.

Perhaps I add a 64 leds (using this turorial) starlfield.

Enough about the LEDs now, I need to find me a decent transistor, any hints?

atmega8 => 3 PWM
atmega168=> 6 PWM

all current arduinos come with a 168. concerning the right transistors: you're probably fine with many available models, i'm currently exploring BC337 (npn) transistors to gate audio from arduino. they are quite common, cheap, and probably would serve you fine... maybe someone knows better, but i got the impression that transistors are the most mysterical components when it comes to finding the best for one's needs.


Hi Westbam,
I'd correct the driver circuit into common Emitter NPN, It's better result and more ease to calculate component value

transistor biasing need R on pin Base (B) and use R2 as current limit on each LED

:smiley: You people are genuise!!! Thnx worapoht

I asked around and they said the same thing as I read now:

  • A BC377 should do the trick. (NPN?)
  • Place the LEDs before the source off the transistor (still not clear why, but I believe you all!!)
  • And add an Base resistor between the PWM pin and the Base pin (4.7 kOhm?)

I am afraid I have an old Amtel on my old arduino :cry:

I made my scheme with TinyCad (took me 1 hour to download, figure out, draw and post!!)

Thank you all!! :slight_smile: Now I need to think about LEDs... all shops in my country are EXPENSIVE!! (I am dutch :wink: :wink: )

New Drawing, Add PWM - Base resistor

These LEDs now have a commen ehhh.... CATHODE (-)
(is this correct before I order the wrong ones?)

Hi Westbam,
After read your question again, the circuit you need should to be like this one

BC547 is general purpose NPN and BC327 is medium current PNP for driver (the 337 is NPN)
for Rr Rb Rg value are depand on lightness of each element (around 150 to 1k)
and current to element should not over than maximum rating of LED ,
for rough calculating.. If max. 100mA, V=IR -> R=V/I -> R = 12/0.1
Then R should not less than 120 Ohm.
as I know, RGB LED lightness per current are not same on each color element..
may apply 100% PWM and try several R value for balance RGB to White color

The RGB LEDs I have, painted white, show white with equal current on all 3 pins so they arent too dissimilar.

If you dont paint them white or do something similar then it looks pretty horrible because the lights are about 0.5mm apart from each other.
You can see the individual colours.

I am Dutch too, I have found reasonable prices at

Good luck!

Ow dear, now I am confushed :-/ But thnx for the replies!!

Why I should I use another transistor to PWM the BC327?

Why I should I use another transistor to PWM the BC327?

because you use +12V. for common cathode tri-colors LED driver and control logic level from Arduino is 0 to 5v.
then driver can't drive directly by single transistor, NPN + PNP cascade circuit will translate control level and made circuit work.

if change driver voltage to +5V., You can use only PNP circuit part but action will be opposite (active logic LOW)

:o Thnx for the expleantion, I understand it (a bit)

So, when I PWM an transistor with 1/2 the ammount off volts as the collector recieves, the emitter shall output 1/2 volts that the emitter is recieveing .
(this is lost in translation)

Sounds logic.

So, when I PWM an transistor with 1/2 the ammount off volts as the collector recieves, the emitter shall output 1/2 volts that the emitter is recieveing .

PWM still digital pulse signal (0 or 5 Volt only) but "Duty cycle" change is effect to average "Output power"
then the switch mode transistor circuit still work on PWM signal

this page is good example to see what different on 10% 50% and 90% PWM signal,

if circuit is active HIGH,
LED will ON while logic HIGH
and OFF if LOW
but PWM is blinking at high frequency, then human eye will see the "dimmed" light instead of blinking
at PWM 100% (255 in value) is always ON and most bright and dimmed if lower %PWM