I've got an Raspberry Pi and I want to control some LEDs. I've read that the maximum current at the GPIO pins should be less than 50mA. But each LED uses 20mA. Does that mean that even three LEDs are too much? Because 20+20+20=60, so its more than the allowed 50. Is that right or where's the mistake?

How many LEDs can I connect to my Pi without damaging it?

  • Just have the leds run at 15mA. Running leds at a lower current only makes them slightly dimmer (light output is not proportional to the current). Just calculate the correct resistor you'd need to use. Or use a NPN transistor like wilf suggested. – Gerben Nov 17 '13 at 19:13
  • GPIOs on raspberry PI are much lower than that! More like 5mA. If you want to drive LEDs to full brightness you must use a transistor/buffer – John La Rooy Nov 18 '13 at 0:26
  • 1
    Note, luckily though, RPi GPIOs are built in such a way that trying to draw too much current will not result in burning them, but merely in failure to provide enough current. To damage them you have to connect overvoltage from some external source, or pull them down to some negative voltages, or jolt them with static electricity, and not just connect to GND. If you draw too much, your circuit simply won't work, but nothing will get damaged. – SF. Nov 18 '13 at 8:11
  • @SF. Do you have a reference to that? – John La Rooy Nov 19 '13 at 5:20
  • 1
    @Wilf: You can find it in the official data sheet indirectly: parameters of the overcurrent resistors at the I/O ports, and the rated current of these ports. With the given resistance and given Vcc you can calculate maximum current flowing through these resistors when shorted Vcc-Gnd; it doesn't exceed the ports' rated current. – SF. Oct 31 '15 at 9:43

Modern LEDs are efficient enough that you can use them as indicators even at 2mA. It's safe to drive them directly from GPIO if you calculate the resistors based on a 1-2mA current.

You can configure the GPIO to slightly higher currents as @Milliways mentioned. But there is an overall limit for the combined current for all GPIOs that you can't exceed anyway.

If you want to drive the LEDs to full power (eg for illumination, or to be visible as indicators in daylight), you must buffer the GPIOs. Use a transistor, or use some sort of buffering IC that is designed to drive those currents.

  • If you use a transistor, do you still need to use resistors or can you just use the transistor as depicted in @wilf's 2nd image? ... According to this it appears that you still need to use current limiting resistors when switching on LEDs using a transistor. – HeatfanJohn Nov 18 '13 at 3:06
  • 1
    @HeatfanJohn, you need to limit the current. resistors are the simplest way to do it, but they waste the extra energy. For a couple of LEDs it's usually not significant, but for lighting there are more efficient (and complex) methods to limit the current. – John La Rooy Nov 18 '13 at 3:20

There are some worthwhile comments above (although you should NEVER run LEDs without current limiting, and LEDs should not put in parallel.

There are a number of errors. The Pi can only supply 50mA through the 3v3 pins of the P1 Header.

The GPIO pins cannot supply 50mA, the source and sink current is configurable from 2 mA up to 16 mA. NOTE this is not current limited, but if you try to draw more operation is not supported, and may damage the chip.

see http://elinux.org/Rpi_Low-level_peripherals


I was able to connect three LEDs to my Raspberry Pi without any problem. The LEDs glowed pretty bright. I did connect them in parallel though, as suggested by Wilf.


I think you can connect the LEDs anyway, but it will not work if you connect them in series. Each LED will require 2-3 Volts + to operate - see here: http://www.retrospieler.de/e-led-r.html

I use NPN transistors to control anything big connected to my Pi, but ONE LED to EACH output I found did no damage.

Theoretically, you could connect them in parallel, as in the diagram below. It is NOT RECOMMENDED as this even with 2 LEDs could easily exceed the current limit of the pi - see here


So to run a larger loads, you just need a NPN transistor (or relay, control circuit etc) and a external power supply:

Schematic 2

The NPN transistor acts like a switch, and will turn on the LEDs when the GPIO pin is powered.

  • 2
    Never ever leave out the resister when dealing with led. Leds don't limit current themselfs like incandescent bulbs do. The will draw as much current as they can and then burn out. In this case the extra current could damage the GPIO pin too, maybe even the entire Pi. – Gerben Nov 17 '13 at 19:16
  • Connecting the LEDs in parallel like this will cause the same voltage to be applied to each LED & resistor, however depending on the resistors you use, you can easily have each LED draw 20mA and therefore exceed the 50 mA limit of the GPIO pin. If each LED draws 20 mA, then the total current would be 80 mA in the circuit you have drawn. Of course if the GPIO can't provide that much current then the voltage output by the GPIO pin will most likely lower. – HeatfanJohn Nov 17 '13 at 19:33
  • 1
    I already upvoted this a while back because I don't think there's anything wrong with it in theory. If you want to avoid drawing too much current in the parallel version, you just have to use an appropriate resistor for each LED; e.g., for an LED w/ a forward drop of 2.2 V, a 55 ohm resistor will produce 20 mA; then you add them up. It's no more risky than connecting one LED; if you don't get the resistance right, you'll draw too much current. – goldilocks Oct 29 '15 at 20:50
  • 2
    HOWEVER, I think @HeatfanJohn is wrong about the 50 mA -- that's a total for all pins, per pin < 1/2 that is recommended. I think he's right about the voltage drop though; I tried this at some point and the LED's just glowed more dimly than they would have alone (vs. in series, one is bright and one is dark). – goldilocks Oct 29 '15 at 20:50
  • 1
    @goldilocks -I am currently poking LEDs on a breadboard - for starters I don't think (some) LEDs will draw a full 20mA - its nearer 10mA or just 1mA (I will sort this out properly when I locate a non-fault voltmeter and then update this). Anyway, I don't want to become blamed for frying anyone else's Pi and/or LEDs :) – Wilf Oct 29 '15 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.