Hello All, I am new to the forum and don't usually post questions but I am having trouble figuring this out... My first step was to use the 6 PWM pins on the arduino to control 2 different RGB leds. I can add another RGB led in series with no problem but I want to add 19 more RGB leds in series with each of the two currently wired but am not sure how I will power them all. The LEDs are common anode. My current understanding is that each channel will need 20 mA and there are a total of 6 channels so I need 120 mA of current to light all the LEDs. I am pretty confused on how to achieve this. Any help is greatly appreciated!
I assumed 19 more because I because I bough 40 LEDS and I can run two "RGB channels" with 6 PWM pins. There is only 4 leds on the bread board being powered only by the 5V pin on the arduino. I trying to make rope light of sorts where every other RGB led is controlled by the same pins. If there is an easy way to power all the lights I'd love to know. Thanks
I believe I am mistakin. I believe I am trying to wire the lights in parallel not series.
With a Transistor :)
Base via resistor to PWMpin. Collector 5V (or whatever is needed) which can provide the needed current. And 19 RGB-LEDs WILL need more than 120mA. Emitter: 19 LEDs (with series-resistor) in parallel. Cathode to ground.
Just read out a tutorial about transistors, and you'll find out :)
Thanks. I figured it was time to start figuring out how those worked. Just a transistor or do I need to purchase some other sort of power supply. Just trying to figure out quickly what parts i'll need cause im trying to take this thing to a festival in 8 days so if I need to order something it needs to be by tomorrow.!
I currently do not have a power source apart from the arduino board. I am not sure what the best power source would be for this number of LEDs and am open to suggestions. In short I'd like pins 3,5 and 6 to control one string of RGB leds and pins 9,10, and 11 to control a second string of RGB leds. These two strings will be interlaced to alternate between leds from each string. SO each string (not series) will have 19 RGB leds. Does that make sense? I currently have no idea how to decide whether I need a wall transformer, transistors, or just a big battery to run this thing! Thanks for all your help!
Also @ Punmbaa. My LEDs are common anode and the cathodes are connected to resistors connected to the PWM pins in an active-low configuration. if I have two strings of 19 leds running off the power in parallel won't I need a 600 mA current source to power 38 LEDs at 15-20 mA each? Thanks
@ Richard. I am putting these lights around a circular shaped bar for a sound camp i'm doing. The bar is 8 ft in diameter so each LED will be 7-8 inches apart. It will be portable but we have a generator I could run power off of. If batteries are an easier or cheaper alternative i'd also consider it. The bar will be up and running for three days so I'm not sure a battery would last that long.
Could I use something like this.
The just connect the positive lead to my anodes and the negative lead to the ground on the arduino?
Also. I currently have 220 Ohm resisters in between the cathode pins of the LED and the PWM pins on the arduino. Can I use just one resister for each PWN pin? Also I am assuming the resistor for the red diodes should be slightly larger since the red leds are only 2 V?
You could use a IC driver chip ULN2003 and an external power source. Very simple to wire up. I have driven alot of LED's with this chip, I even drive a standard GM fuel injector with it. Google the ULN2003 and take a look at the datasheet. It may help you out. --Joe
Lights will be on about 8 hours a night for three nights. Well be using generator for other black lights and laser scanners. 5 v would be the voltage drop across all parallel leds and the resistor before each pwm pin. I guessed 600 mA based on 38 leds * 20 mA max is 720 mA. I guess I'd want to use something rated for 800 mA then?
I do not understand what the chip is for. Would that be instead of the arduino or does the chip help regulate power? Please explain. So my blackberry charger outputs 5V = 700mA. I am thinking I can hack this up to power the lights? Would I just hook the 5V out to my common anode wire and then hook the ground wire to the group on my arduino and hook the anodes to resistors connected to the PWM pins?
This hopefully gets across what I am trying to do. Please let me know if I am an idiot.
So I couldn't wait for a reply to test it out. I sacrificed my blackberry charger to see how well it would work. It powered up the 4 lights on the board so I jammed a few more LEDs in the bread board. Phone charger was able to power 10 RGBs no problem. I would have tried more but my breadboard is clogged up. I'm assuming I can get 34 LEDS at 20-21 mA because the LED's are rated at 25 mA max. I am going to use 150 Ohms of resistance in series with the red diodes and 90 Ohms in series with each of the blue and green diodes. At 20 mA the voltage drop across the red diode + red resistor is 2 V + (150 Ohms * 0.020 A ) = 5 V. For the blue and green series the voltage drops are 3.2 for diode + ( 90 Ohms * 0.020 A) = 5V. I'm currently using 220 Ohm resistors so I imagine the LEDs will be alot brighter when I get the new resistors.
You do need a resistor for each LED cathode.
Grumpy Mike. I do not see why I would need more than a single resister for each PWM pin. Could you please explain why this would be necessary. I’d prefer not to have to buy 100+ resistors if I can find a cheaper solution. My budget is extremely tight. Thanks
Your single resistor will reduce the overall-current. Which has to be more than the 20mA. If you apply just one (smaller) resistor, just the "weakest" LED will shine. Very bright. 19x20mA-bright. And that's very bright, like in LED-Heaven. And after this, there might be a 2nd-weakest LED.....
In your configuration, you'll have more than 100mA that every PWM-pin of the Arduino has to sink. Consider 40mA as absolute maximum. It will maybe work, but not for 3x8h i would bet :o)
the ULN2003 can be considered as a switch. Not as replacement for anything. One Side: Inputs. Other Side: Outputs. Benefit: Outputvoltage/-current does not have to be the same as on the inputside.
So you wont screw anything, since the ULN2003 can handle more than 20-40mA per channel.
@ GrumpMike Would the combined current from all the LEDS burn out the resistor? For example at a green PWM pin.... 19 LEDs * 0.020 A = 0.38 A (going through the resistor).
I^2/R = (.1444 /100 OHms) = 14.4 Watts? Is this what I woudl be trying to prevent?
@ Pumbaa. Are you saying that I cannot sink 100 mA on the arduino even if my power source connects to the ground of the arduino? I am setting this thing up on the 11th and fear I don’t have much time to order new parts. Would like to be able to put as many lights on this bar as possible without having everything fail.