Safely Powering 45 LEDs with PWM off digital pins

Hello Everyone,

First time posting here and hoping someone can ease my mind. I’m tinkering with a project where I am trying to power 45 LEDs with the digital pins using PWM. I currently have them wired up in 3 sets of 7 parallel pairs that are behind 100 ohm resistors with the last 3 LEDs behind a 100 ohm resistor each. I’m hoping to power each of the three sets (7 pairs and one single LED) off a digital pin each but after reading some other threads on the forum, am worrying myself that this will be unsafe or potentially fry the photon.

I’ve modeled it and expect each digital pin to supply about 279 mA meaning ground will be sinking around 840 mA. I have some memory reading somewhere that the photon can supply up to 1 amp. However, I don’t recall where I saw this and haven’t been able to find it again. Is the Photon capable of this? Am I worrying myself needlessly or is this not a good idea?


It’s not a good idea. The pins on the photon can deliver a maximum of 25mA. You’re going to have to look into using a transistor to switch those currents.


You could also try something like this

or look at their schematics and use that for your own transistor setup.

The 1A sourcing of the Photon may be refering to the Vin pin when used as output while powered via USB.
1A is a safe value with some margin as long your USB supply can provide it plus the demand of the Photon itself plus some losses.

For GPIO pins you have the 25mA limit per pin as already mentioned by @Moors7 plus the total of 120mA when using multiple pins in parallel.

But for that info you’d be usually looking in the docs and datasheets

Thanks for the advice, both of you. Please excuse me if this is a base question but if I were to try to pull more than 25 mA from a GPIO pin, would I cook the photon or would the LEDs just not be very bright? Not that I am planning on doing this but I was just curious as just hooking up a single LED with a 100 ohm resistor would already be pulling about equal to if not more than 25mA.

Either way, new plan is to get some NPN transistors and wire in a 5V 1 amp wall supply.

Thanks for your help!

@eperkins, that would cook the pin in all likelyhood. And with multiple pins simultaneously doing this, you might cook the Photon as well.

Actually no, you wouldn’t be pulling more than 25mA.
Given you are using a standard red LED which typically has the lowest forward voltage amongst standard LEDs of 1.2V, you’d only draw about 21mA when limiting current with 100Ohm.

I = (Vcc - Vled) / R = (3.3V - 1.2V) / 100Ohm = 0.021A

Unless you are sinking the current via the pin and supply the LED from Vin (~5V) - then you’ll eventually frazzle the GPIO, although with ~40mA that won’t happen immediately but reduce the lifespan.