Electronic – arduino – Turning on multiple leds with arduino using transistor

arduinoledtransistors

I want to be able to turn on 50 red LEDs with one pin of an Arduino. I don't want individual control, I just want to be able to turn them all on or all off.

I found this example. It uses a 2N3904 transistor. Is this the approach I want to take? I presume I would need a higher power transistor?

I am using an external power supply that is wired into a custom board with a 5v voltage regulator so I am powering the LEDs directly from this regulator.

The LEDs come in the form of this LED light bar array (or at least very similar)…

I had mentioned in a comment in an answer below that I was using a 330 ohm resistor with each LED. On another part of this project, I use the light bars as level meters, and each separate LED is controlled via a shift register, thus the separate resistor. I realise after thinking about it that I don't need to have a resistor in series with each LED for this now as they are either all on or all off (hmmm…. sorry for my rather haphazard comments!).

I did have a thought that I could have some sort of electronic switch that can disconnect ground or 5V. Is this viable?

Best Answer

A transistor is basically a switch that can disconnect ground or 5V. There are transistors of all sorts, and some can switch truly huge loads. 50 LEDs is no big deal.

So, the question then is this: Can a single 2N3904 switch 50 LEDs?

To answer that, we'd need to know first what kind of LEDs. But let's assume you are using the usual nothing-special variety. A reasonable estimate of the maximum current of these is \$20mA\$. If you have 50, then the maximum current is \$20mA \cdot 50 = 1000mA \$. Looking at the datasheet I see the maximum collector current for 2N3904 is \$ 200 mA \$. So the answer is no: you can not switch 50 LEDs with one 2N3904.

I suppose you have several options:

  • use multiple 2N3904
  • use fewer LEDs
  • use the same LEDs, but drive them with less current
  • use a bigger transistor (TIP121 is very easy to find)
  • use some other switching device

Of these, I think reducing the LED current or using a larger transistor is probably the most likely solution. Other switching devices (like a relay) are probably more expensive and slower.