Can I connect 22 20mA LEDs each though a 150 resistor then each to a Digital pin

Can I connect 22 20mA LEDs each though a 150 resistor then each to a Digital pin? will this damage my mega?

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

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

  1. 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.
  2. 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

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? :sweat_smile:)

The data sheet for the 1280 says:-

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

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

Even with 200mA sourcing and 200mA sinking.

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.

Grumpy_Mike:
The data sheet for the 1280 says:-

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

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... :~

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.

KE7GKP:

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.

Grumpy_Mike:

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

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

also the only different parts i see are the two caps next to the DC jack and the fuse is a different color

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.

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.

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

also i could use 22 bi color leds and just use one color and not the other

OK thanks for the Spec. Sheet.

Those LED's are 2.0V @ .02 (Rd) 2.2V @ .02 (Gn) so 150 ohms is fine: 5-2=3/.02=150ohms

So the question is how would you arrange the LEDs among the different ports so as to not exceed the port total current ratings?

Can you look at the port limitations? Um... copy?

The sum of all IOH, for ports J0-J7, G2, A0-A7 should not exceed 200 mA.
The sum of all IOH, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200 mA.
The sum of all IOH, for ports G3-G4, B0-B7, H0-H7 should not exceed 200 mA.
The sum of all IOH, for ports E0-E7, G5 should not exceed 100 mA.
The sum of all IOH, for ports F0-F7, K0-K7 should not exceed 100 mA.

So, 10 LEDS max on the first 3 sets of ports. Sounds like your 22 can fit. How about 7 or 8 LEDs on each of those groups??
Maybe ports A,B,C ??

Anybody?? IF the 200 mA PER Vcc pin is True, does this work??

Wow..

@terry king

if u want me to test what the mega can handle, just give me a schematic of how you want me to wire it up...

also try to stick with using only the bi-color leds and 150ohm resistors please

if u want me to test what the mega can handle

Did you not read my earlier post? Just testing it is no going to tell you anything except perhaps that it immediately bricks you Mega. A so called successful test will not tell you about the long term viability of this.

TechGeek,

I think we need to get an answer from ATMEL. Several of us understand this pretty well but we are not sure what the Spec. means.

If you are going to hook up Something sooner, I suggest you look at the per-port limitations and at least follow those, even though we are not sure about Total Vcc and Ground currents.