PDA

View Full Version : 35mA led with 25mA pic output?



xnihilo
- 24th October 2008, 10:48
I have no 5v 10mA led left and the only led i have is 2v 35mA and I have to use that with a pic which can output maximum 25mA per pin. What will happen??

Something else. The piezzo buzzer i use is 3-12v continuous tone, 9mA. 9mA for what voltage??

Thank you if you can explain this to me.

duncan303
- 24th October 2008, 10:58
I have no 5v 10mA led left and the only led i have is 2v 35mA and I have to use that with a pic which can output maximum 25mA per pin. What will happen??


Hi, can you say what you THINK might happen,


____

xnihilo
- 24th October 2008, 11:06
Hi, can you say what you THINK might happen,


____

Led will glow dimmer...?

aratti
- 24th October 2008, 11:06
Place a 220 ohms resistor in series to your led. If you want it brighter, then you should use a transistor. Your beeper can be connected directly to the pic output.

Al.

J. Mark Wolf
- 24th October 2008, 12:42
You'll compromise the integrity of the pin trying to draw too much current from it with your 35mA LED. Possibly damage the PIC.

Put a transistor in the circuit.

Nicmus
- 24th October 2008, 13:42
Hi Xnihilo,

If you want to keep the full LED brightness you must use some sort of buffer (a small NPN or PNP transistor or a low power N or P channel FET or MOSFET will be your best choices) combined with a 82 Ohm resistor for your 2V 35 mA LED.
If you don’t mind loosing some brightness a limiting resistor (in your case 120 Ohm will give you 25 mA or 150 Ohm will give you 20 mA).
All you have to do is trying and decide.

Regards,

Nick

Acetronics2
- 24th October 2008, 13:53
Hi,

Two paralled-trough-180 Ohms-resistors pins will do it ...

simple way.

Alain

xnihilo
- 24th October 2008, 15:35
You'll compromise the integrity of the pin trying to draw too much current from it with your 35mA LED. Possibly damage the PIC.

Put a transistor in the circuit.

I see, the led will try to draw the 35mA it needs. The Chicago red 5v 10mA i used before were better :p
Thanks

xnihilo
- 24th October 2008, 15:44
Place a 220 ohms resistor in series to your led. If you want it brighter, then you should use a transistor. Your beeper can be connected directly to the pic output.

Al.

Okay, thank you but tell me, how did you calculate this 220 ohms value?

xnihilo
- 24th October 2008, 15:48
Hi Xnihilo,

If you want to keep the full LED brightness you must use some sort of buffer (a small NPN or PNP transistor or a low power N or P channel FET or MOSFET will be your best choices) combined with a 82 Ohm resistor for your 2V 35 mA LED.
If you don’t mind loosing some brightness a limiting resistor (in your case 120 Ohm will give you 25 mA or 150 Ohm will give you 20 mA).
All you have to do is trying and decide.

Regards,

Nick
I understand i should use the 5v power supply with a 82 ohms limiter and switch led with a transistor in order to have full brightness but i do not wish to add a transistor. I should then either choose an inline current limiter and chose the adequate value for let's say 20mA and have a dimmer led or get a 10mA led.
Okay, thanks all for your answers.

skimask
- 24th October 2008, 16:01
I understand i should use the 5v power supply with a 82 ohms limiter and switch led with a transistor in order to have full brightness but i do not wish to add a transistor. I should then either choose an inline current limiter and chose the adequate value for let's say 20mA and have a dimmer led or get a 10mA led.
Okay, thanks all for your answers.

Find the datasheet for your particular LED...
Look up 'Forward Voltage'...assume it's 1.5v for example.
Now look up 'Current'...assume in this case it's 35mA, 'cause that's what you said it was
And you're driving the LED from a PIC pin at 5V

The LED will 'drop' 1.5v across it 'cause it's a diode and that's just the way they are...
So, that leaves you with 3.5v to work with.
The LED wants 35mA (.035A)

Ohms Law - I=V/R, V=IR, R=V/I
R (ohms you need) = V (volts, 3.5V) / I (35mA)
R = 100 ohms...
But that'll allow up to 35mA per PIC pin, over the limit...but you're driving the LED from 2 pins (unless I misunderstood).
So, R = 200 ohm across each PIC pin will give you 17.5mA from each pin, paralleled to the LED.

But I gotta tell you, it'll work, but it's not 'the way to do it'. The right way to do it is to add an external transistor or MOSFET to turn the LED on or off.
Or you could just increase the resistor value and use one pin... Like you said, the LED will be dimmer.

Nicmus
- 24th October 2008, 18:28
Ski,

Don’t you mean two resistors of 200 Ohm each when driving the LED with two I/Os?

Nick

RussMartin
- 24th October 2008, 18:50
It may be that the 35mA rating for the LED you describe is a maximum, do-not-exceed rating. If you can find the data sheet for the LED, see if it also gives a typical operating current.

People sometimes forget that most LEDs will produce full brightness long before maximum rated current is reached.

A couple of replies have suggested a 220 ohm resistor; that or even a 180 ohm resistor would be a good starting point. Depending on the Vf of the LED, that will give you something between 14 and 19 mA. You may be surprised to find that the LED is quite bright.


The piezzo buzzer i use is 3-12v continuous tone, 9mA. 9mA for what voltage??

Piezo tone/buzzer devices are basically voltage-driven; the greater the voltage, the louder the sound. The 9 mA rating is probably for the 12 VDC maximum; at 5 volts, it will likely draw only 4 or 5 mA.

skimask
- 24th October 2008, 19:04
People sometimes forget that most LEDs will produce full brightness long before maximum rated current is reached.
As is the case with my parts box full of LEDs...good luck finding any sort of datasheet for any of them.
Just start with a high value resistor (1K-ish) and work your way down until it's good enough or you hit the current limit (47 ohm is my low limit and it's worked for me for years). Hit the current limit first? Put that LED in a different box (i.e. garbage can) and grab another LED.

xnihilo
- 26th October 2008, 20:50
R (ohms you need) = V (volts, 3.5V) / I (35mA)
R = 100 ohms...

->Yes, I already know that. The led is a 2V, 35 mA so with 5V it will need a current limiter of 5-2 / 0.035 Ohms.

But that'll allow up to 35mA per PIC pin, over the limit...but you're driving the LED from 2 pins (unless I misunderstood).

->No, only from one pin (thus max 25 mA, according to Microchip DS).

So, R = 200 ohm across each PIC pin will give you 17.5mA from each pin, paralleled to the LED.

But I gotta tell you, it'll work, but it's not 'the way to do it'. The right way to do it is to add an external transistor or MOSFET to turn the LED on or off.

->Yes, this too I inderstand, that's the way I switch my IR leds (TSAL6100 that can eat up to 1A if used with pulsed current) from 9V source.
In this case I should not use a led that needs so much current as I drive it with an IC pin.
I used to order 5v Chicago red that need 10mA (from) MOUSER but as the shipping costs are too high, I order leds form FUTURLEC but these need 35mA and to keep my PCB simple I wish not to add an extra transistor. I guess I don't have the choice but to order the right led maybe from FARNELL if they have them... or use a transistor.

By the way, I read some info about BJT and MOSFET and still don't know what I should use in my design. MOSFETS are a little more expensive. I need to use a limiter transistor from IC pin to transistor base if I use BJT and choose the right value according to the Load switched by the transistor. I don't need to use such resistor with a mosfet (I think).
As I need to output a 40KHz PWM I could use both BJT and MOSFET even though MOSFET can swich faster but I found some IRL... mosfet wich are level-logic and can switch up to 16A and cost only .60usd versus .22usd for a BC182L for example. I just wonder if I could use such MOSFET to switch a motor or a nichrome wire instead of a bulky DIL transistor that needs a BJT, a resistor a diode,...


Or you could just increase the resistor value and use one pin... Like you said, the LED will be dimmer.

-> Right, as I don't need full brightness, I guess I will rather do that.
Skimask, thank you for your information.

xnihilo
- 26th October 2008, 20:54
It may be that the 35mA rating for the LED you describe is a maximum, do-not-exceed rating. If you can find the data sheet for the LED, see if it also gives a typical operating current.

People sometimes forget that most LEDs will produce full brightness long before maximum rated current is reached.

A couple of replies have suggested a 220 ohm resistor; that or even a 180 ohm resistor would be a good starting point. Depending on the Vf of the LED, that will give you something between 14 and 19 mA. You may be surprised to find that the LED is quite bright.



Piezo tone/buzzer devices are basically voltage-driven; the greater the voltage, the louder the sound. The 9 mA rating is probably for the 12 VDC maximum; at 5 volts, it will likely draw only 4 or 5 mA.

They say "max dc forward current" and "Typical" FC is 35 mA :)
See: http://www.futurlec.com/LEDR3R.shtml

About the buzzer, thanks for the info, I'm surprised it needs only 9mA (7mA in fact) at 12V. That's cool.

I lear so many things here.

xnihilo
- 26th October 2008, 20:56
As is the case with my parts box full of LEDs...good luck finding any sort of datasheet for any of them.
Just start with a high value resistor (1K-ish) and work your way down until it's good enough or you hit the current limit (47 ohm is my low limit and it's worked for me for years). Hit the current limit first? Put that LED in a different box (i.e. garbage can) and grab another LED.

Right, thanks.

falingtrea
- 27th October 2008, 18:36
Looks like the LED you are using can work as low as 12.5mA. So you have a broad range for the current. I would at least try running it at 18-20 mA and see if the light level is sufficient. One other thing you should remember about LEDs, is the higher the current you run them at, the more you reduce the life.

mister_e
- 27th October 2008, 18:42
You can still use a pair of I/O in parallel to drive up to 50mA. It's been widely used in the past. I'm not a fan of it... but sure it may work. You just need to play with the WHOLE TRIS register value.

rmteo
- 27th October 2008, 19:52
There are LEDs and then there are LEDs. They can vary widely in their brightness output. For example, these are 2 green LEDs in a 5mm, T-1 3/4, thru hole package. Both are rated at a test current of 20mA.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=511-1191-ND
This one has a rated output of 100mcd. This is typical of commonly available LEDs, 50 -300mcd.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=LC503FPG1-15Q-A3-ND
And this one has a rated output of 34,000mcd.

The output of the 2nd. one is 340 times that of the 1st. And it is not even a matter of price - both of them are about the same. So if the LED is bright enough for you at 20-25mA, just go for it. If not, get a brighter one. No need to mess with paralleling outputs, using BJT's or MOSFETS etc.

skimask
- 27th October 2008, 22:07
The output of the 2nd. one is 340 times that of the 1st. And it is not even a matter of price - both of them are about the same.
Almost...
The 1st one, at 10 degrees off center still looks about 70% of it's total.
The 2nd one, at 10 degrees off center is only about 30% of total.
So while the one may be brighter, it's only brighter in the middle, it's got a bit more focus...if that makes any sense...

rmteo
- 27th October 2008, 22:33
Almost...
The 1st one, at 10 degrees off center still looks about 70% of it's total.
The 2nd one, at 10 degrees off center is only about 30% of total.
So while the one may be brighter, it's only brighter in the middle, it's got a bit more focus...if that makes any sense...
Sure does. My point is that if you are using an LED as an indicator, 20-25mA is plenty to get a sufficiently bright display with the right LED. A high efficiency LED at just 1mA can be almost blindingly bright. :D

mister_e
- 27th October 2008, 22:34
Absolutely TRUE!

xnihilo
- 27th October 2008, 23:26
You can still use a pair of I/O in parallel to drive up to 50mA. It's been widely used in the past. I'm not a fan of it... but sure it may work. You just need to play with the WHOLE TRIS register value.

Unfortunately I don't have enough pins. One pin only can be dedicated to a led. I will use the led at lower voltage as many suggested in this thread.

xnihilo
- 27th October 2008, 23:46
Sure does. My point is that if you are using an LED as an indicator, 20-25mA is plenty to get a sufficiently bright display with the right LED. A high efficiency LED at just 1mA can be almost blindingly bright. :D

Agreed. It is just an indicator.

xnihilo
- 27th October 2008, 23:47
There are LEDs and then there are LEDs. They can vary widely in their brightness output. For example, these are 2 green LEDs in a 5mm, T-1 3/4, thru hole package. Both are rated at a test current of 20mA.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=511-1191-ND
This one has a rated output of 100mcd. This is typical of commonly available LEDs, 50 -300mcd.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=LC503FPG1-15Q-A3-ND
And this one has a rated output of 34,000mcd.

The output of the 2nd. one is 340 times that of the 1st. And it is not even a matter of price - both of them are about the same. So if the LED is bright enough for you at 20-25mA, just go for it. If not, get a brighter one. No need to mess with paralleling outputs, using BJT's or MOSFETS etc.


34000mcd... awesome! I didn't even think such exist :)
What if I put one on my car ... :p

skimask
- 28th October 2008, 01:28
34000mcd... awesome! I didn't even think such exist :)
What if I put one on my car ... :p
34000mcd (http://en.wikipedia.org/wiki/Candela) sounds really bright and really impressive, and they are fairly bright when viewed straight on...but it's not all that.
These are what I used in my toobz...
http://www.philipslumileds.com/pdfs/DS05.pdf
70mA drive current with a 1/2 power viewing angle of 90 degrees.
They aren't the Luxeon super bright, multi-watt, power LEDs, but they do well.

RussMartin
- 28th October 2008, 07:30
They say "max dc forward current" and "Typical" FC is 35 mA :)
See: http://www.futurlec.com/LEDR3R.shtml

You are misreading the table.

The third line is saying that the maximum DC forward current is typically 35 mA. It means that for some of the LEDs, it may be a little more and for others a little less, but what it is telling you for sure is, "Don't exceed 35 mA."

The first line of the table is probably more indicative, where it shows a typical forward voltage (Vf) of 2 VDC when run at 12 mA. This sounds like a typical operating condition and is probably as bright as it needs to be.

So you need a series resistor of 220 ohms (13.6 mA), but you can probably use down to 150 ohms (20 mA).

xnihilo
- 29th October 2008, 00:23
You are misreading the table.

The third line is saying that the maximum DC forward current is typically 35 mA. It means that for some of the LEDs, it may be a little more and for others a little less, but what it is telling you for sure is, "Don't exceed 35 mA."

The first line of the table is probably more indicative, where it shows a typical forward voltage (Vf) of 2 VDC when run at 12 mA. This sounds like a typical operating condition and is probably as bright as it needs to be.

So you need a series resistor of 220 ohms (13.6 mA), but you can probably use down to 150 ohms (20 mA).

... Right. Thank you.
Stuff like "Vcc=Min,Iol=MAX,Vih=MAX" is not yet so obvious for me.

skimask
- 29th October 2008, 04:48
.....Information removed at the risk of annoying RussMartin......
See post below....

RussMartin
- 29th October 2008, 06:27
Most of those abbreviations are listed at the bottom of the pages of the datasheets.
If not there, usually a Google-search and/or Wiki will get you the answer on whatever the abbreviation means. In this case:
Vcc = voltage common-collector, generally positive voltage input
Iol = current, output, low (sinking current)
Vih = voltage, input, high

. . . and which have nothing to do with either his question or his LED. I believe he was conveying his thanks to me, not asking another question. :D

skimask
- 29th October 2008, 10:47
. . . and which have nothing to do with either his question or his LED. I believe he was conveying his thanks to me, not asking another question. :D
Well excuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu uuuuuuuuuuuuuuuuuuse me

eng.alamin
- 29th October 2008, 12:48
I have no 5v 10mA led left and the only led i have is 2v 35mA and I have to use that with a pic which can output maximum 25mA per pin. What will happen??

Something else. The piezzo buzzer i use is 3-12v continuous tone, 9mA. 9mA for what voltage??

Thank you if you can explain this to me.

easy way just connect 1kohm Resistor serially with your 2v led and it will work fine

regards

skimask
- 29th October 2008, 12:57
easy way just connect 1kohm Resistor serially with your 2v led and it will work fine

You must mean like is suggested in posts #4, #6, #7, #11, #13 and a few others?
Maybe not that exact value...but...well...