7

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?

Piotr Kula
  • 17,336
  • 6
  • 66
  • 105
tecmen
  • 71
  • 1
  • 1
  • 2

4 Answers4

4

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.

John La Rooy
  • 12,005
  • 9
  • 48
  • 77
2

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

Milliways
  • 62,573
  • 32
  • 113
  • 225
1

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

Schematic

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.

Wilf
  • 2,533
  • 3
  • 23
  • 39
1

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.