Controlling Multiple Common Cathode RGB LEDs With PWM And NPN 3904

Greetings everyone.

First time poster here.

I've been trying my hand at electronics for a few weeks in my spare time and I think I’m start to get the gist of it from some of the posts I've been reading in the forum, but I’m having a hard time understanding whether or not I have some of the foundations down correctly and I don’t want to go letting smoke out where I don’t have to.

What I’m trying to eventually accomplish to create a panel of 36 Common Cathode RGB LEDs all running in a parallel circuit banks that are controlled by 3 of the PWM pins on my Uno through a 3904 per channel which, in turn, controls 4 additional 3904 that are sending current from a constant 5V 2A power supply to banks of 9 LEDs each ( 9 to keep the 3904 draw under 200mA max) with the PWM frequency.

I've been using a few different circuit simulators and all of them seem to indicate that I’m headed in the right direction but I was wondering if I might be able to trouble someone else to take a look at the diagram I've attached to make sure I haven’t missed some simple underlying principle and/or recommend a better way I might go about this.
I'd prefer to run these LEDs as close to their max current as possible.

Thanks

You want to use NPNs to sink current to Gnd. Other than that, looks good. If you want to source current, use a PNP.
Would be better if you had 9V, 12V, source, put the LEDs in series and cut back on your current needs.
For those kinds of currents, you're also better off with power MOSFETs. Use Logic Level, Low Rds, N-channel MOSFETs to sink current from LED cathodes to Gnd/5V return.

Apologies for not clarifying more in my previous post.
In my diagram I'm showing 27 LEDs total, but this actually is representative of 9 4-Pin Common Cathode RGB LEDS with their individual channels broken out into parallel circuits for diagramming simplicity.
This is why I've put the NPNs and resistors sitting on the high side so I can retain control of them via the PWM pins.

High Side, still recommend PNP then as current source.

I have several projects with CC RGB LEDs. There are several ways that you can do this, if you want to do it with transistors, that is viable, but the ways you have things, I think you are going to run way too much current for your arduino.

I have a flashlight that im modifying that is almost exactly what you are doing (it uses 9 RGB CC LEDs), it doesnt control the LEDs individually, but it controls the color for all of them. I dont have any PNPs handy, I do have NPN's, but that wont work for this situation. My plan is to use some P channel mosfets, but its basically the same thing.

The cathode sides will all be connected to ground, the red/blue/green LEDs are all in parallel so I need 3 P-channels (but I could use PNPs), and appropriate resistors.

What im talking about is very similar to your schematic, but much of your schematic is confusing to me, it looks like you have batteries charlieplexed, no microcontroller.

Besides the transistor, there are many ways to control many LEDs, shift registers, LED drivers, charlieplexing/mulitplexing are the more common ways.

For clarity's sake, I've attached a revised version of the diagram that should be a little more accurate in representing the final circuit.

From my understanding, I could just replace the NPN with the PNP exactly as it's currently wired and then just to flip my PWM output logic (PNP -> 0 = Always On vs NPN -> 255 = Always On).
Is there going to be any significant response or performance increase in using PWM to drive a PNP versus an NPN on the high side (I have plenty 3906 PNPs that I could use instead)?

My next step from here would be a beefier power supply (~30A) that would allow me to drive about a dozen of these panels and add in 5 daisy chained 74HC595 Shift Registers so that each panel could be controlled separately using the original 3 PWM pins

I don't follow what you are doing with the series PNP on the left side.
If you are looking to beef up the base current from the PNPs, then you want this kind of arrangement (with 5V vs 12V)
with RL being your resistor/LED.

My diagrams don't use any PNP transistors, I was merely asking if I understood the logic behind swapping the 3904 for the 3906.
I do understand your diagram though which make me feel better overall.
I think I'm going to give this a shot this evening with 2 banks of 9 LEDs.
Results to follow :slight_smile:

This is my third attempt at replying to this thread. I will try posting without the attachment, and see if this works. then see if I can edit the post and add an attachment.

Edit: replaced horrible huge image with better size, and common cathode LEDs!

Besides being too large of a drawing, very hard to review, those LEDs will not turn on as you have the common anodes grounded and no way to pull the cathodes to -3V to -5V turn them on.

Hippynerd
By running 9 LEDS parallel using only a single resistor inline with each PWM pin, wouldn't each LED have to share the resisted current on that same line.
When I run that same circuit in a couple of the simulators i'm using I'm showing around 3 - 5mA per LED channel.
I'm not sure what the specs are on your LED, but nearly all the ones I've seen run around 20mA so, if this is the case, you're only going to get a fraction of the brightness (but on the upside conserve the lifespan of the LED)

In other news, I was successful in building out a scaled down version of the last circuit i posted and have attached some images of the circuit and LED segement.
I cut some corners as I didn't have any 43 or 47 ohm resistors so i went with 100 ohm across the board. Just means my Blue and Green channels are only running at around 50% brightness.
Tomorrow I'm going to try to scale it out the rest of the way pending a successful trip to Radio Shack.

Thanks for the help eveyone! XD

Doh! It looks like I forgot to switch the LED to common cathode. Its supposed to be CC LED, grounding the cathode, and using 3 pins for the R,G and B, anodes.

It might be better to have 1 resistor on each LED, but as long as it has a current limiting resistor, its ok, and 3 resistors fits much better than 27 resistors.

What is a good size for schematics? The fritzing program usually makes then humongus, and I have to reduce them anyway, but I dont want to make them too hard to read. (too big or too small)

About 800 wide works well for viewing on screen. 2000 and 3000 wide are just too big.

That sounds reasonable, I'll try to make them about that size.

Crossroads,

Huge thanks!
When I was using the 1st set of NPNs to trigger the gate of the subsequent NPNs I was getting between 2.7 - 3.3 V coming off the emitter going to the LEDs (which was hard to predict what size resistor to use to maximize the current)
I got ahold of some 2907 PNPs and wired it up like you had in the diagram above and now i'm getting the full 5v going across all channels! XD XD XD

Cool.