Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Led limit for arduino
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Led limit for arduino

by GAHorton on Thu Apr 23, 2009 7:21 pm

per pin, how many leds can be hooked up in series? i want to make a large blinky sign.
GAHorton
 
Posts: 90
Joined: Tue Feb 19, 2008 4:30 am

Re: Led limit for arduino

by franklin97355 on Thu Apr 23, 2009 11:50 pm

The number would depend on the current draw of the LEDs you choose. I would recommend using a transistor or mosfet to switch power to the LEDs

franklin97355
 
Posts: 21561
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Led limit for arduino

by oPossum on Fri Apr 24, 2009 1:46 am

Two red, yellow, or green.
One blue or white.

How many do you want in series and what color?
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: Led limit for arduino

by westfw on Fri Apr 24, 2009 1:55 am

In SERIES, the limit is going to be the voltage drop across the LEDs. When the sum of the voltage drops exceeds the 5V that the AVR can source or sink, you won't get any current any more, and no lights.
That probably means you can light three RED LEDs (1.8V each, so rather dimmly), maybe two of the old-style yellow or yellow-green (2.2v), and probably only one of the modern blue/white/etc (over 3V each.)

An NPN transistor will switch voltage levels as well as provide more current, and can drive more series LEDs, depending one what sort of voltage you have available.

westfw
 
Posts: 1709
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: Led limit for arduino

by GAHorton on Fri Apr 24, 2009 12:00 pm

maybe about 10 or 15 leds per pin?

how would the circuit look with a transistor (i have 3906 and 3904 on hand right now)
GAHorton
 
Posts: 90
Joined: Tue Feb 19, 2008 4:30 am

Re: Led limit for arduino

by oPossum on Fri Apr 24, 2009 2:52 pm

Here is a general circuit that you can customize for your specific needs.

The LED current is regulated, so each string can have up the maximum number allowed or fewer - the brightness will be the same for any number in the series string.

The max in a string is calculated by (V+ - 6)/Vf

For example...

24 Volt power supply.
Green LEDs with Vf of 2.2V
(24 - 6) / 2.2 = 8
So each string could have up to 8 green LEDs.

24 Volt power supply.
White LEDs with Vf of 3.5V
(24 - 6) / 3.5 = 5
So each string could have up to 5 white LEDs.

12 Volt power supply.
Red LEDs with a Vf of 1.8V
(12 - 6) / 1.8 = 3
So each string could have up to 3 red LEDs.


Image
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: Led limit for arduino

by westfw on Fri Apr 24, 2009 5:42 pm

The max in a string is calculated by (V+ - 6)/Vf

Where does the "six" come from? (I get about 4.5, assuming Vb=5, Vbe=.65, Vce=.15)

Note that this is a "constant current" circuit; the current through the LEDs is determined by the 330 ohm resistor and the (relatively constant) 5V that the AVR puts out for "on"; you can have any color and any number of LEDs, and any value of V+, and you'll still have about the same current (within the limits imposed by other bits.) Nice, but it does seem to reduce the available voltage by a substantial amount compared to a simple transistor switch with a customized resistor value.

http://en.wikipedia.org/wiki/Current_source (figure 3, with the zener circuit replaced by the AVR output.)

westfw
 
Posts: 1709
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: Led limit for arduino

by oPossum on Fri Apr 24, 2009 5:58 pm

westfw wrote:Where does the "six" come from?


Wost case conditions. The transistor Vce may be higher, the LED Vf may be higher, etc...
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: Led limit for arduino

by oPossum on Fri Apr 24, 2009 6:23 pm

westfw wrote:Nice, but it does seem to reduce the available voltage by a substantial amount compared to a simple transistor switch with a customized resistor value.


Yes, but it doesn't require a regulated supply or a variety of resistor values. It also reduces parts count because no base resistor is required.

Using a series resistor requires that the voltage supply and LED Vf stay close to expected values. This is not a problem for a single LED, but can be for many in series.

For example...

10 green LEDs (Vf=2.2) at 10 mA from a 24V supply.

10 * 2.2 = 22
24 - 22 = 2
2 / .01 = 200 ohm series resistor

If an unregulated supply is used it could easily be 28 volts or more at low to moderate load.

28 - 22 = 6
6 / 200 = 0.03

LED current increased from 10 mA to 30 mA just by using an unregulated supply.
Similar problems occur when the LED Vf changes a bit.

The simple fix is fewer LEDs...

9 * 2.2 = 19.8
24 - 19.8 = 4.2V
4.2 / .01 = 420 ohm

28 - 19.8 = 8.2V
8.2 / 420 = .0195 A

Only double now.

Notice how the voltage drop is now very close to what is required for the regulated circuit.

If a simple linear voltage regulator is used, the supply voltage to it must be several volts higher (assuming a simple transformer/bridge/cap supply). So again the regulated circuit has similar voltage requirements, but fewer parts.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: Led limit for arduino

by GAHorton on Mon Apr 27, 2009 7:53 pm

So i wired a test circuit up to my arduino and made it run the simple blink program. The LEDs are not lighting up. when i test the voltage of the transistor i'm only getting about .8v with every blink.


here's a picture:
Attachments
DSCN2816.JPG
DSCN2816.JPG (887.83 KiB) Viewed 6130 times
GAHorton
 
Posts: 90
Joined: Tue Feb 19, 2008 4:30 am

Re: Led limit for arduino

by oPossum on Mon Apr 27, 2009 8:10 pm

You need at least 12 volts for those 4 LEDs.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: Led limit for arduino

by GAHorton on Mon Apr 27, 2009 11:41 pm

so how can i get this working for the arduino?
GAHorton
 
Posts: 90
Joined: Tue Feb 19, 2008 4:30 am

Re: Led limit for arduino

by GAHorton on Thu Apr 30, 2009 1:22 pm

let me rephrase..

do i need to hook up a separate voltage to the led series to get it to work? i can't use the on board 5v to power the leds right?


if i do have to hook up a separate voltage, how to i make a common ground?
GAHorton
 
Posts: 90
Joined: Tue Feb 19, 2008 4:30 am

Re: Led limit for arduino

by westfw on Thu Apr 30, 2009 6:07 pm

Before this gets TOO tangled, let me point out that if the goal is to light 4 LEDs on a single pin, it may be simpler to use a parallel configuration. You need the transistor in either case, but the parallel config lets you get by without needing to deal with a separate power supply for the LEDs.
Image
http://farm4.static.flickr.com/3664/348 ... 304dd8.jpg

westfw
 
Posts: 1709
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Re: Led limit for arduino

by oPossum on Thu Apr 30, 2009 8:52 pm

Just connect the grounds together and the +12 volts or higher to the LED string.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Please be positive and constructive with your questions and comments.