Go Down

Topic: LED trouble (Read 1 time) previous topic - next topic

vishalapr

I have 19 LEDs and 1 servo and 1 bluetooth module which I need to attach to an arduino duemilanove
I powered the servo of a seperate 5 V power supply (And I connected the grounds together(And the Servo works just fine))
But I just wanted to know if my arduino duemilanove can handle 19 (at least 15) LEDs when I connect the arduino to a 9V battery as it communicated wirelessly with the computer with a bluetooth module that needs 5 V power which will be powered of the arduino.
I will connect 3 LEDs to pin13 and 3 LEDs to pin12 and 3 LEDs to pin11 and 3 LEDs to pin10 and 4 LEDs to pin9 and 1 LED to pin8 and 2 LEDs to pin7 and a servo to pin6 and the bluetooth module to RX and TX.
Please reply

AWOL

Assuming you're not using external drivers (you didn't mention any), and as long as you don't approach the absolute maximum per port current of 150mA and the package limit of 200mA, and you can accept that some LEDs will be dimmer than others, I don't see any problems.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Grumpy_Mike

Plus the individual pin limit of 40mA

vishalapr

So everything would be just fine but maybe some will be dimmer

CrossRoads

With that many LEDs and a 9V source available, you should connect the LEDs in series with a current limit resistor from the 9V supply, with an NPN transistor (2N2222 for example) on the bottom cathode that the arduino will control. Then you can get full brightness by having the same 20mA current flow thru a 'string' of diodes and have longer battery life, versus having the LEDs powered from 5V and having to split the arduino's 20mA/pin among the three LEDs and their seperate current limit resistors.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Grumpy_Mike

Quote
So everything would be just fine but maybe some will be dimmer

No if you exceed the maximum ratings you don't get less current out so it's dim but fine. You get the current out you asked for and your arduino is damaged and perhaps bricked.

vishalapr

Thanks CrossRoads Could you give me some more detail on how to do what you are saying because I cannot understand what you mean , as you know I'm still sort of a beginner in arduino so please help.

CrossRoads

Sure, I'll  draw  you a picture tomorrow. PM me if I forget, I have a few other things to take care of first tomorrow.

Basically the 2 pictures on the right tho:
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

vishalapr

But how will adding a transistor help the LEDs and the +5 V is it from the arduino

AWOL

Quote
But how will adding a transistor help the LEDs

It won't help them at all, but it will help prevent damage to your AVR.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

CrossRoads

If you have many LEDs in parallel, each drawing 20mA to be nice & bright, that can be driven from the 5V you have for the servo and not damage the 20mA recommended max current sink of the ATMega chip. 3 LEDs could draw 60mA.

If you have the LEDs in a string, they could all share the same 20mA to turn on; however you need a higher voltage as each LED will have ~2V across it. So you need a transistor that can handle the higher voltage when the LEDs are off and not conducting; the ATMega is not recommeded to go past 5.5V.

You might be able to put 2 LEDs in a string from 5V, depends on the forward voltage of each LED. Blue LEDs need higher voltage, while Red LEDs need less.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

vishalapr

There are 4 sets of 3 LEDs and the rest are single LEDs
The LEDs in the sets are white coloured LEDs and the there are 4 other independant red LEDs and 1 independant orange LED and 1 independant blue LED.

So do I need to use a transistor for the sets of white LEDs
If I do, then do I need to use 4 transistors, 1 for each set(NPN transistors)

vishalapr

And does each and every LED in the set need to have a resistor or is it okay if you use 1 resistor for 1 set( the set of white LEDs(3 white LEDs))

Grumpy_Mike

Quote
And does each and every LED in the set need to have a resistor

Unless the LEDs are in series (in line) then yes they do.

CrossRoads

Yes, transistor (or an open collector driver like ULN2003, ULN2803, provide same functionality but all nicely packaged up) for the sets of 3.
One-LEDs can be driven directly from Arduino.
String of LEDs needs a current limit resistor.
Single LEDs need a current limit resistor.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up