Hooking up multiple RGB LEDs while using a minimal number of PWM pins?

Hey everyone!

I currently have an anode RGB connected to the 11, 10, & 9 PWM pins on my arduino. However I would like to add 3 more LED's to my project, but I don't want to necessarily take up every single PWM pin. Is there a way for me to hook up all 4 LED's while using the minimum number of pins? Keep in mind that I do want to use all 12 resistors for the 4 LEDS. Oh and all the LEDs will do the exact same thing (They all will be red, and all turn blue, etc) if that helps.

Here's how my board looks right now:

If anyone could help me out, that would be awesome!!!! Appreciate the help! XD

P.S. I attached the .fzz file so that if any of you would like to edit the schematic image, it would be super easy. :slight_smile:

RGB.fzz (2.94 KB)

If you want all LED's to do the same thing, you could just connect their legs together.

But of course the Uno will not supply enough current for 4 LED's so you will have to use some transistors. I use something like BC337's for tasks like this.

Other than that you could use some shift registers and the ShiftPWM library, or some TLC5940 PWM drivers to free up arduino pins and have all the LED's addressable.

I'll look into those a bit more, thanks! And say I were to only hook up two LEDS? Could the Uno supply enough power for that? Thanks!

Do you want all the LEDs to show the same color?

@Fungus: Yeah that's the idea. So even though I'll be cycling through colors (Green for one second, then Red for another second, and loop) I want them all to display the same color at the same time. (All Green the first second, then All red the next second, etc.)

VAlexander:
@Fungus: Yeah that's the idea. So even though I'll be cycling through colors (Green for one second, then Red for another second, and loop) I want them all to display the same color at the same time.

A transistor will work for that. Use a BC337 or a 2N222A or something. Wire it up like this but with multiple LEDs connected to the collector:

Alternatively you could use some of these:

ka2284 for sale | eBay or an6884 for sale | eBay (basically the same thing)

They act like a transistor with five input legs and proper built-in current regulation (you don't need any resistors anywhere). They're great for switching lots of LEDs. Use three - one for R, one for G and one for B.

VAlexander:
I'll look into those a bit more, thanks! And say I were to only hook up two LEDS? Could the Uno supply enough power for that? Thanks!

No problem. providing the LED's you are using are 20mA per colour, the uno should just handle it (40mA per pin) but it is borderline.

dtokez:
No problem. providing the LED's you are using are 20mA per colour, the uno should just handle it (40mA per pin) but it is borderline.

40mA isn't recommended for long-term use.

OTOH it's possible to run LEDs at less than 20mA (strange, but true!)

You could do this a few ways, The typical way would probably be using a few small transistors, but you could also charlieplex them, you could run the LEDs at lower current, and just run them straight off the arduino.

I'll add some schematics, this is my second post in this thread, the first post failed.

The drawing with the 9 LEDs and transistor is for common cathode, but its basically the same thing, only you use common anode LEDs, and NPN transistors instead of the PNP ones in the schematic.
Edit: replaced huge incorrect drawings with sane sized and hopefully correct drawings.