SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By kommi10
#170840
If one LilyPad Micro LED takes 20mA of current, but one petal outputs 40mA, then how does Leah Buechley manage to string 7 LEDs onto one petal in her tutorial?

Hi all, newbie here trying to figure out how many LEDs I can run off a lilyPad petal for a small project.

According to her design, you can string 7 LEDs onto one petal: http://www.flickr.com/photos/leahbuechley/2596552004

But according to the specs on of the LilyPad Main Board the DC current per I/O Pin is only 40 mA
http://arduino.cc/en/Main/arduinoBoardLilyPad

Asuming that each LED will consume around 20mA of current, how is it possible to string 7 of them together onto one petal?

Unless each LED is eating way less than the 20mA's?

Also, not sure how I would use Ohm's Law to calculate anything here. I know the current (I) as 40mA, and I know the resistance of the thread as 28 ohms per foot (lets say 2 feet are used, so 56 ohms). So I can use Ohm's Law to calc the volatge needed as 2.24 volts. But not sure how that helps me? I plan on using a 3V 250mAh coincell battery to power the lilyPad itself.
By trueRF
#170908
There are lots of ways to subvert the 40mA output restriction. One such way to to string the LEDs in series. Such that each led shares the same current. but you would need a high voltage on the output. For a 12V system you can use 5 leds in series without much trouble.

The second option is to switch the led string to the high side. Such that the current flows directly from the supply through the LED to the micro. Most micro controllers can "sink" more current than they can "source." Sinking means to receive while sourcing means to supply. You'll have to look up the exact source limit in the datasheet for the microcontroller. It's also likely the the microcontroller will have a global current sinking limit. While 1 pin might be able to sink 140mA the total for all pins might only be 250mA. To control that LED string the output is reversed an high level on the output turns the string off and low level on the output turns the string on. This is called "active low."

Finally, as you suspect she could use a resistor to reduce the current flow to each LED but, splitting up 20mA 7 ways doesn't leave a lot of current to make each LED shine brightly.
By kommi10
#170911
Humm, I see what you are saying but I still do not understand how she manages to power 14 LEDs off 3 petals using nothing more than 1 AAA 5V 200mA battery...?

According to her code she just turns the LEDs on/off using HIGH/LOW so it does not look like she is regulating the current via the code.

I ordered a LilyPad simple and a 3.7V 850mA LiPo battery. Will I destroy the board if I just plug that battery in?

the link to the tutorial
http://web.media.mit.edu/~leah/LilyPad/ ... acket.html
By Mee_n_Mac
#170912
kommi10 wrote:Asuming that each LED will consume around 20mA of current, how is it possible to string 7 of them together onto one petal?
Unless each LED is eating way less than the 20mA's?
You knew the answer all along. From the diagram in your link, Leah puts 7 (normal type I think) LP "LEDs" in parallel off just 1 I/O pin. Just how much current is going through each "LED" is hard to say but it's certain that it's less than 40/7 = 5.7 mA. It may be just enough to get them to glow, but not very brightly.

I use quotes for the LP LEDs because the LP "LEDs" come in 2 types, normal and Micro. The normal type has an LED in series w/a 100 ohm resistor in the package and so is more than just an LED. The Micro LEDs are just naked LEDs, no added resistance inline other than that due to the conductive thread. As to why there are 2 types ... well that's covered below.
kommi10 wrote:Also, not sure how I would use Ohm's Law to calculate anything here. I know the current (I) as 40mA, and I know the resistance of the thread as 28 ohms per foot (lets say 2 feet are used, so 56 ohms). So I can use Ohm's Law to calc the volatge needed as 2.24 volts. But not sure how that helps me? I plan on using a 3V 250mAh coincell battery to power the lilyPad itself.
Ohms law assumes the device, say a resistor, is a linear device. Double the voltage and you double the current. Halve the resistance and you double the current, V = I*R. Alas diodes and LEDs are not linear and so it's a bit tricky to know how much current you'll get or what resistance is needed to prevent too much current from flowing and smoking the LED.

It's generally a safe assumption that a generic LED can tolerate 20 mA, maybe 30 mA, continuously. If you know the output voltage, you can get a good guess at the resistor needed by assuming a voltage drop across the LED and then use Ohms law. Now the actual (forward) voltage drop (aka Vf) across an LED is (primarily) dependent on the color of the LED and then how much current is passing through it. If that current is assumed to be 20 mA, then there are kind of standard voltage drops for each color. Red LEDs might be 1.8V, yellows a bit more, greens perhaps 2.0-2.2V but blues and whites would in the range of 3.0 - 3.4V. The shorter the wavelength of the color (IR is max, UV is min), the higher the Vf.

So take the output voltage, subtract the assumed LED drop, and use 20 mA and get your resistor needed. ie - (5V - 1.8V)/0.02A = 160 ohms. If you happen to be off a little, it won't make a practical difference. And if you use a normal LP LED, remember there's already 100 ohms in the circuit. In this example your thread should add around 60 ohms.

And so, looking at the above, and asking "but what happens if I want to use blue LEDs in a 3.3V system", you'll see why there are LP Micro LEDs, w/o any resistor in the package. Indeed the resistor needed may already be larger than the minimum provided by a single conductive thread, using a Micro LP LED. So what happens then ? Well, give it a try first. The LED may light up, just not as bright as it would normally. If it's too dim, then you might try a shorter thread and/or using multiple threads in parallel. Two threads in parallel have 1/2 the resistance of a single thread. Do this to and from the LED. But you may find that as the battery drains down, the output voltage is just too low to run any white or blue LED. That's a limitation you'll have to live with ... or use a 5V system.

If you look at page 2, the plot of Forward Current Vs.Forward Voltage in the datasheet below, you can see just how much the typical "normal type" LP LED drops for voltage vs color and current.
https://www.sparkfun.com/datasheets/Dev ... 50OVS4.pdf
You can find similar plots for the other LEDs.
https://www.sparkfun.com/datasheets/Dev ... ANB4-H.pdf
https://www.sparkfun.com/datasheets/Dev ... 6QWF-D.pdf

If you don't want to do the math above, there are online calculators that do it.
http://led.linear1.org/1led.wiz
By kommi10
#170914
Thanks for the replies! A few questions:

(for serial)
If I have 10 Micro LEDs in series that take 20mA, across 2 feet of 25 ohm/foot resistance, then the Voltage needed is (aprox):

.02 * 50 = 1.0 Volt

If I attach 3 volts to this then I would get 3 / 50 = 0.06A which would fry my micro LEDs. And so in order to not fry them I would need to put a resistor that would eat up the excess .04A, correct?

(for parallel)
If the LEDs are in parallel then they would require less voltage to supply them all with 20mA than if they were in serial? Based on the fact that there is less resistance?

(Or I guess I can power more LEDs with the same amount of voltage because it is parallel)

If I string 10 red LEDs then I have to account for the voltage drop for each LED (1.8 * 10)? Or is it just 1.8 volts across all 10? Is it the same for both serial and parallel?
By trueRF
#170918
Each LED is going to drop voltage though. If the voltage drop across 1LED is 1.5V having 2 in series is going to require 3V. 3 = 4.5V and so on. Plus the resistance of each length of wire. So 10 micro LEDs, assuming 1.5V each, would require 15V to turn on. But the current required is still only 20mA.

For the parallel the math is similar but instead of adding voltage for each LED in series you are going to add current for each LED in parallel.

As far as stringing 10 red leds are they in series or parallel? If series it's like my example above 18V across all 10 but only 20mA. If parallel it's 1.8V across all 10 but 200mA.
By Mee_n_Mac
#170919
When you have devices in series, the voltage across each is added to get the total voltage. When you have devices in parallel each gets the same voltage but the total current is the sum of the current through each device.

So if you have 10 LEDs in series you need to have a voltage that's > the sum of all their individual Vfs.

ie - if they are red LEDs then, on average, the Vf of any 1 LED is about 1.8V at 20 mA. So 10 such LEDs, in series, means you will have 18V across the LEDs and the supply needed to drive these LEDs needs to be at least that much, but only source 20 mA.

You shouldn't put naked LEDs in parallel because each LED will get exactly the same voltage but the current through each LED is described by it's V vs I curve and they aren't all exactly equal. So one LED might easily get 2x the current that another LED does. You can put LED+resistor pairs (aka the normal LP "LED"s) in parallel, the resistor will tend to mitigate the LED-to-LED differences. If you do this and each LED+resistor uses 20 mA at the voltage supplied, then 10 such pairs will use 10x that current or 200 mA. Now it becomes a question of whether your supply (in this case a single I/O pin) can actually supply that amount of current. If it can't then it could be that the output voltage drops to something less than the normal level. It could be that the supply goes into some non-linear current limiting, outputting less than the expected current. It could be that the supply shuts off (like a circuit breaker does) or it could be that the supply burns up. Or some combination of the aforementioned.

I've seen a list of Arduino I/O pin output voltages vs current drawn from the pin. Alas I don't recall where I saw it. But if the Arduino supply voltage is 5V then at only a few mA of current draw, the pin's output is 4.9-5.0V. At 20 mA of current draw, it's more like 4.3-4.5V. At 40 mA it was (IIRC) only 3.5V !!! Note that as the output voltage drops, the current to the LED+resistor also drops and so they may balance out at some lesser current than the expected 20 mA per "LED".

I've also read that Arduino I/O pins don't well tolerate abuse, so trying to draw more than 40 mA out of any 1 pin is likely to overheat and destroy it. Frankly I don't know how well or long the design Leah used at your link will work or last.