# Will my Arduino output pin at 0v handle 25 LEDs cathodes

Short question: Is it safe to connect a single Arduino ADK (Mega) output pin at 0v to 25 LEDs, each with an appopriate 100 ohm resistor, and each being powered by a output pin at 5v?

i.e. 25 output pins at 5v each connected to an anode of one of 25 LEDs with all of their cathodes going to a single input pin at 0v

Also will I need to use transistors to provide enough power?

Long question: I'm working on a 5x5x5 LED cube similar to this: The 4x4x4 LED cube (Arduino)

There's 5 levels of 25 LEDs, and using multiplexing I intend to switch between each level very quickly to give the impression they are all on at the same time. How I understand it is this is achieved by connecting each of the 25 anode pins to the anode of the LED on the above level and connecting all of the cathodes on the same level to one another. So with 25 anode pins and 5 cathode pins, if I switch the bottom level cathode pin to 0v and all the other level's cathodes pins to 5v I can then turn on individual LEDs on the bottom level by turning on the appropriate anode pin.

If there's any maths involved the LEDs are 20mA, and the Arduino provides 40mA per pin I think. I have a feeling I'm also going to have to use transistors to properly power this as 25 LEDs is 500mA and I have heard that the ADK only provides up to 200mA, though the project I have linked to doesn't seem to do this?

• Your title doesn't match the question. input/output Oct 24, 2012 at 22:07

I think you just answered your own question. If you want to power 25 LEDs @ 20mA that's 500mA total. So no you can't drive or sink 500mA with a single pin when that pin can only supply 40mA. Try using a transistor on the output that can handle the current. I think you're on the right track there.

Maybe try something like this. Disclaimer though I only thought about that circuit for a few minutes, I didn't try it or sim it. But that's half the fun :)

• Ok thanks, so the pin can only sink as much as it can source I guess (I hope my terminology is correct, it's been a long time since I touched electronics). I guess I can change my code so that it multiplexes so only LED is on at a time but I think the brightness will suffer. Would you particularly recommend the FDV305N or was that soley an example? I have a ULN2803A darlington array I can begin to test with Oct 24, 2012 at 22:19
• Your terminology is correct I looked in the datasheet and it doesn't call out sink current separately, but if you look towards the end there are charts that seem to show it doesn't like any more than 20mA. Either way though I've never seen a little micro like this that can sink or source 1/2 an Amp :) Oct 24, 2012 at 22:24
• Oh and that 40 mA that's the absolute maximum rating usually you'd want to back off of that a little. Good luck! Oct 24, 2012 at 22:25

If you'll have more than one LED simultaneously on, they'll draw from their common pin more current than the Arduino can provide.

But there's a software solution that you can consider: if you make sure in your software that NEVER two LEDs will be simultaneously on, then it's OK (although risky).

That can be achieved by using a "scanning" algorithm. Say you want LEDs 1, 3 and 5 to appear on: you have a loop that activates each of them in sequence, and do it fast enough for POV to work.