I've been learning Arduino for the purpose of lighting my Science Fiction Model Kits. I have a background in code development so the software side I can hack through. The physical side on my latest project I have a question.
I want to fade up six 1.8mm 3v 20ma LED's as part of a weapons firing sequence. I've read that each PWM pin can handle maybe ~2 LEDs max or 60ma total. Am I correct in understanding that I would need to include a Transistor to help with this? Also, if i'm using a Transistor is it still possible to Fade up/down the LEDs with a Transistor in play? I don't need anything over kill just looking for a point in the right direction to a Transistor that would work.
Max recommended current on an I/O pin is 20mA on an AVR chip, absolute max 40mA. And that's peak current - if you're PWMing them at 10%, but they're pull 50mA at 100%, that's 50mA, not 5mA.
So yeah, if you want to control all of those from a single PWM pin, you do need an external transistor if you're running them at 20mA each. You could use higher value ballast resistors to lower the current per LED - if you say limited it to 5mA per LED, you'd be okay (but the LEDs would be dimmer) - 30mA is higher than recommended, but probabably ok.
If that's not an acceptable approach, you need a transistor or MOSFET. I'd use a small logic level N-channel MOSFET - tie the positive side of the LED+resistor pairs (each LED does need it's own resistor), then the low sides to the MOSFET's drain, MOSFET source to ground, and gate to the pin of the arduino (ideally through like a 47~100 ohm resistor to limit peak current through the arduino pin while switching (gate can be thought of as a capacitor, with the conductivity of the source-drain channel dependent on the voltage of the gate capacitor - hence when switching, brief pulses of significant current can flow - experience shows that with small fets this usually isn't a problem)
Do you want all six led’s on at the same brightness at all times or do you want them to be different? All the same brightness equals one driver transistor. With individual brightness you could drive one led per PWM pin as there six PWM pins on an Uno/Nano.
BTW 20ma per led is high by modern standards. What color LEDs will you be using?