0

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:

enter image description here

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

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. click here.

KingPolygon
  • 4,753
  • 7
  • 43
  • 72

3 Answers3

1

if there are all doing always the same, just connect them parallel, which means that you just put your second LED into the breadboard right under the existing one.

If that is to much power consumption wit 4 LEDs you have to use a transistor as amplifier. I would like to send youo a schematic, but I have no software to draw such. However, using a transistor to amplify the arduino output is quite a common thing...

Hope I could help!

  • Hey Kai! Thanks for the help! How could I quickly check if it'll draw too much power? Will it burn out the LED's? Which transistors would you recommend? And here's a link to site where you can download the schematic program (super simple!) [Fritzing App](http://fritzing.org/download/). I attached my schematic file in the last line of my question. – KingPolygon Apr 05 '13 at 09:56
  • Hi, thanks for the download tip. I already drawed the 2 images, but have still not enaough reputaion to post them so I uploaded them here: http://www.kaiheinz.de/downloads/4RGB_LED.zip You can use simple transistors like the BC547C, the cost here in Germany just 30 cents or so. Using Transistors is recomended, so you will surely have no problems. My way, the NOT recommended way, is to simply try and see what it gest without transistors. If it runs you are fine, if not you can change it anyway. – Kai Benjamin Heinz Apr 05 '13 at 10:25
  • I went out and bought 3 transistors! But Before hooking everything up together, I have a question about the AA battery source that you included in the image. Do I need that, or am I fine with using a regular usb to power my arduino? Thanks! – KingPolygon Apr 05 '13 at 22:46
  • You cannot use the USB Power, because it might not deliver not enough A's. That's why you should use an external power source (ie. 2 - 3 AA-Batteries) Just make sure that the external power source is powerful enough if you run all your LED's at a time (see Data Sheet for exact power consumption of your LED's). – Kai Benjamin Heinz Apr 08 '13 at 08:52
1

Whether you connect the RGB LED in series or in parallel off the same PWM lines, your main issue will be current drawn from each PWM line. Arduino lines typically support up to 40mA from each GPIO pin (with a 200mA maximum/chip). LEDs usually allow up to 20mA for each channel if you want maximum brightness. This means that you really shouldn't put more than two channels on each GPIO pin, if you want maximum brightness for each LED. This calculation tells you that the only sensible result is to use transistors to actually power the LEDs, and use your Arduino to control the transistors. Here's one description of how to do that, but I am sure you can find plenty more.

As far as wiring the LEDs, you really have two options here:

I prefer the parallel configuration: it is easier to debug, and easier to ensure the proper current limits for all LEDs. There is also the issue of LED forward voltage: most leds need between 1.8V-3V of forward voltage across them to conduct. If you only have 5v to work with, then you can string only up to two LEDs in series before you cannot ensure a proper forward voltage across each one. If you try to put three in series you may either get the result that some of them are dimmer then the others or the whole thing doesn't light up at all.

Community
  • 1
  • 1
angelatlarge
  • 4,086
  • 2
  • 19
  • 36
0

Depending on the granularity of your timing on the LED(s), what you can do is the following:

Arduino => shift register => transistors => Resistors => LED pin.

Look at the bitshift out libraries out there for the Arduino. This will make it so that you are only using a few of pins: clock, signal, and latch.

You can daisy chain the serial-in, parallel out registers to increase the number of LED(s) you can control in this fashion. What would happen then is this: you send a stream of bits which represents which bits you want to turn on/off, then toggle the latch to update the values. In this manner, you can PWN drive a good number of tri-color LED(s) without risk of burning out an IO pin.

Note that timing becomes critical. As others have suggested, you can get dedicated RGB driver IC, but if you want to go with easy to find parts, the latching shift registers are a good way to go.

If you search, there are a number of good tutorials on PWM'ing over shift registers, as well as libraries.

Wing Tang Wong
  • 802
  • 4
  • 10