Go Down

### Topic: Can I connect 22 20mA LEDs each though a 150 resistor then each to a Digital pin (Read 4388 times)previous topic - next topic

#### TECH GEEK

Can I connect 22 20mA LEDs each though a 150 resistor then each to a Digital pin? will this damage my mega?
As always... Thanks for posting!!!

#### TerryKing

#1
##### May 24, 2011, 10:13 pmLast Edit: May 24, 2011, 10:21 pm by Terry King Reason: 1
Hi Tech,

Probably OK if you are careful with ports.  But you need to look at some details:

- What's the REAL current? Are the LED's all the same, same color? Test what the voltage drop is really and test the current (or calculate from E/R). Maybe you need to go to 220 ohms or whatever.

You need to not exceed three things:

1. The per-pin maximum (20mA is right)  40mA is an Absolute Maximum rating
2. The per-Port maximum
3. The VCC and GND pin maximums.  The Mega has more VCC and Ground pins so much better than 328 this way.

So, for the Gory Details (which you need) see: http://arduino-info.wikispaces.com/ArduinoPinCurrent  You need to read the MEGA part. I have not yet made a Port-Max diagram for the Mega like the one for the 328.  (Any volunteers?)   But you can work it out.  You will need to understand which pins are on which ports..

It seems (to me and @crossroads), reading the 1280/2560 spec that the Max for the total MEGA, if distributed carefully among the ports, is 800 mA! But that's hard to accomplish, with the "upper" ports supporting less current.

But you are talking about 440 mA. Should work if distributed right...

Let us know what you see...

#### retrolefty

Will here is the gory details of current limits from the datasheet:

Quote
3. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state
conditions (non-transient), the following must be observed:
ATmega1281/2561:
1.)The sum of all IOL, for ports A0-A7, G2, C4-C7 should not exceed 100 mA.
2.)The sum of all IOL, for ports C0-C3, G0-G1, D0-D7 should not exceed 100 mA.
3.)The sum of all IOL, for ports G3-G5, B0-B7, E0-E7 should not exceed 100 mA.
4.)The sum of all IOL, for ports F0-F7 should not exceed 100 mA.
ATmega640/1280/2560:
1.)The sum of all IOL, for ports J0-J7, A0-A7, G2 should not exceed 200 mA.
2.)The sum of all IOL, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200 mA.
3.)The sum of all IOL, for ports G3-G4, B0-B7, H0-B7 should not exceed 200 mA.
4.)The sum of all IOL, for ports E0-E7, G5 should not exceed 100 mA.
5.)The sum of all IOL, for ports F0-F7, K0-K7 should not exceed 100 mA.
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater
than the listed test condition.
4. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady
state conditions (non-transient), the following must be observed:
ATmega1281/2561:
1)The sum of all IOH, for ports A0-A7, G2, C4-C7 should not exceed 100 mA.
2)The sum of all IOH, for ports C0-C3, G0-G1, D0-D7 should not exceed 100 mA.
3)The sum of all IOH, for ports G3-G5, B0-B7, E0-E7 should not exceed 100 mA.
4)The sum of all IOH, for ports F0-F7 should not exceed 100 mA.
ATmega640/1280/2560:
1)The sum of all IOH, for ports J0-J7, G2, A0-A7 should not exceed 200 mA.
2)The sum of all IOH, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200 mA.

Lefty

#### liuzengqiang

Looks like it's no go. the port maximal are 100mA for some ports. Why not using some 595 shift registers? Their ports should support 20mA alright. And you only need 3 io pins to control all 22 LEDs if you use shift registers and they're dirt cheap. If they burn out you don't have to cry your eye balls out. The mega is surface mount chip so if it burns out you need a new mega, that is nice dinner in a decent restaurant plus tips (am I too cheap or is my wife very tolerant to me? )

#### Grumpy_Mike

The data sheet for the 1280 says:-
Quote

Absolute Maximum Ratings
DC Current per I/O Pin ............................................... 40.0 mA
DC Current VCC and GND Pins................................ 200.0 mA

So I am not sure where you get:-

Quote
But you are talking about 440 mA. Should work if distributed right...

Even with 200mA sourcing and 200mA sinking.

#### Simpson_Jr

It wouldn't hurt to check the leds at a much lower current though, 20mA is maximum per Led, but maybe... they're still bright enough at 7-8mA.

#### TerryKing

#6
##### May 25, 2011, 01:46 pmLast Edit: May 25, 2011, 01:49 pm by Terry King Reason: 1

The data sheet for the 1280 says:-
Quote

Absolute Maximum Ratings
DC Current per I/O Pin ............................................... 40.0 mA
DC Current VCC and GND Pins................................ 200.0 mA

So I am not sure where you get:-

Quote
But you are talking about 440 mA. Should work if distributed right...

Even with 200mA sourcing and 200mA sinking.

BUT there are multiple VCC and GND pins on the 1280/2560-- 4 of each, I believe... 200 mA EACH.. IF distributed carefully..

Anyone want to try this on a MEGA?? I need to get a MEGA protoboard...

Look at the second (MEGA) section of this and tell me if this is wrong: http://arduino-info.wikispaces.com/ArduinoPinCurrent

I don't care who's right first as long as we're all right in the end...  :~

#### Grumpy_Mike

Quote

BUT there are multiple VCC and GND pins on the 1280/2560

Interesting reading of the specification, I would not have looked at it this way. Looks like this needs an email to the manufacturers.

#### TerryKing

Quote
DC Current VCC and GND Pins................................ 200.0 mA

The use of the plural "pins" means to me that the 200mA limit is the total package limit, not the per-pin limit.  I would be very surprised if the package were good for 400mA.  It is a microcontroller, NOT a power chip.

Quote

BUT there are multiple VCC and GND pins on the 1280/2560

Interesting reading of the specification, I would not have looked at it this way. Looks like this needs an email to the manufacturers.

Mike, you're right.. I have signed up at ATMEL and asked to connect with an ATMEGA applications engineer..  We need to get this settled, the confusion has gone on too long..

The "Pins" thing?? It also says "I/O PinS" and they are considered separately.  Hmmmm.

@TechGeek, are you reading the mail here? Are you close to trying this out?  Please drop in and tell us more about what you want to do and what type(s) of LEDs you are using...

This question has been buzzing around for over 3 years now, at least. I'd love it if we could corner it in this thread and stomp it to death...

#### TECH GEEK

@ terry king --- i've been checking this forum every 2-3 hours, and yes I would love to help you get this straightened out... one problem about me testing this on my mega... i bought my mega off ebay for \$25 and it uses different parts than the Arduino brand one, so i might get different results than if I used a band name Arduino mega...

but if you want me to try testing my mega in some way just tell me what I should do and i'll try it out...
As always... Thanks for posting!!!

#### TECH GEEK

also the only different parts i see are the two caps next to the DC jack and the fuse is a different color
As always... Thanks for posting!!!

#### Grumpy_Mike

Quote
so i might get different results than if I used a band name Arduino mega

It is the processor we are testing not the rest of the circuit.
If you try it and it works that will unfortunately not settle the argument because it might blow up in two days, two weeks or two months if you over stress a part.

#### TerryKing

Hi Tech,

Can you tell us a little more about what you plan to do with the LEDs and what color they are? (Makes a difference in forward voltage)..  How are you planning to mount and connect the LEDs?

Does your MEGA look like this: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=9 ?? (Click to enlarge)
This is the "original" MEGA design with an FTDI USB chip..  There is no difference of importance: The ATMEL 1280 is the same, and that's what we're discussing.

#### TECH GEEK

yes that is the exact mega i have

I plan on making a row of 11 Bicolor (red+green) common cathode led's (datasheet for led)
each of the 22 pins on my mega (D22 - D44) will connect to a 150ohm resistor, then each of the resistors will go to either a green or a red led
all of the cathodes to 1 ground pin...
As always... Thanks for posting!!!

#### TECH GEEK

also i could use 22 bi color leds and just use one color and not the other
As always... Thanks for posting!!!

Go Up