Pages: [1] 2   Go Down
Author Topic: LED trouble  (Read 1023 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24308
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 506
Posts: 31345
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Plus the individual pin limit of 40mA
Logged

Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 436
Posts: 23623
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 506
Posts: 31345
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 436
Posts: 23623
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24308
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 436
Posts: 23623
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Offline Offline
Sr. Member
****
Karma: 0
Posts: 298
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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))
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 506
Posts: 31345
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 436
Posts: 23623
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1] 2   Go Up
Jump to: