I am new to the science behind electronics (software guy at heart) but I am working on a project where I need to power an Arduino and 14 standard 20 mA red LED's preferably from the same source.

I want to be able to control the LED's from the Arduino, nothing fancy, just fade them all on and off (together). I have a Darlington TIP120 on hand, will this be useful?


Since you want them all controlled from a single pin, you will need to use the transistor (it is unlikely that a single Arduino pin can safely source or sink enough current for that many LEDs).


simulate this circuit – Schematic created using CircuitLab

The output will be PWM, which uses a variable duty cycle to control the brightness.

  • \$\begingroup\$ Okay, thank you, you are awesome! Now, is it a safe idea to use the 5v power rail provided by the Arduino, or should I power the LED's externally? \$\endgroup\$ – lampwins Aug 6 '13 at 5:44
  • \$\begingroup\$ Assuming the board is powered by a 5V supply, the power rail probably won't mind the 150-200mA needed to light them. \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 6 '13 at 5:45
  • \$\begingroup\$ If I power the board with a 9v battery, will this matter? \$\endgroup\$ – lampwins Aug 6 '13 at 5:47
  • \$\begingroup\$ Check the specs of the regulator on the board; if it can source 1A (TO-220 case or D2PAK) then you're golden, but the regulator may get a bit warm. If it's a TO-92 then you can't, and will have to draw off the battery directly (and adjust the resistors accordingly [(Vin - 2.2V[LED] - 0.7V[Q1])/10mA]). \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 6 '13 at 5:50
  • 2
    \$\begingroup\$ If you are using a 9 Volt battery, then put the LEDs in strings of 4 each (yeah, that makes 16) powered direct from the 9 Volts and with a 47 Ohm resistor in series with each string, and connect all 4 strings together at the Darlington being used as a low-side switch just as shown in this answer. \$\endgroup\$ – Anindo Ghosh Aug 6 '13 at 5:54

There are two options. You could connect them to individual Arduino pins, or you can connect them through the transistor. The former gives you individual (or paired) control. The later avoids any current draw issues from the Arduino's microprocessor.

For the most part, the Arduino's 5v power supply is strong enough to power each of those leds at 20mA without much issue. That's 280mA. But given that typical red led's have a forward voltage drop of 1.8~2.2V, they are assumed to be 2v leds. That means you can pair two of them in series, to share the current. Instead of 20mA x 14, you could have 20mA x 7. More energy efficient that way.

The 40Ω resistor is based on R = V/I, where V is (Source Voltage [5v] - Led Forward Voltage Drop [2v * 2 because two in series] - Transistor VCE Drop [Typically 0.2v in saturation]) and I is 20mA, so (5 - 2 - 2 - 0.2 = 0.8) / 0.02 = 40Ω. Round to standard resistor values, 39Ω or 47Ω.

The same can be done with direct connections to the Arduino gpio. 2 leds in series with one resistor per gpio. Reduce the current to 15mA each (68Ω) and you are well within the Arduino's ATMega's limits.


simulate this circuit – Schematic created using CircuitLab

As for the TIP120, you can use that, but as the saying goes, that's like using a bazooka to kill a fly. The TIP120 is a darlington pair transistor, and is suitable for up to 5 Amps. A tiny 2n3904 can handle 100~150mA (200mA at the highest), while a 2n2222 is better at 1A. Both are fairly common and dirt cheap. In either case (14 individuals at 280mA or 7 strings at 140mA or less), the amount of current does not require the use of a TIP120.


Many Arduinos use the ATmega328P. According to the ATmega328P datasheet, p. 313, output pins can easily drive +20 mA or -20 mA each. You could use one pin to drive your external transistor, as shown by Ignacio Vazquez-Abrams. Alternatively, if you don't need the Arduino pins for something else, you could directly connect one Arduino output pin for each resistor+LED.

If you have some power supply in the 7 V to 12 V range plugged into the the barrel plug of the Arduino Uno, the NCP1117 regulator on the Arduino Uno can supply up to 1 A at 5 V, far more than enough to power the Arduino and 14*20 mA = 280 mA of LEDs.

Good luck.

p.s.: have you seen the unnecessarily complicated Arduino Charliplexed Heart ?

  • \$\begingroup\$ I don't know whether to be impressed or terrified at that point-to-point job... \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 6 '13 at 7:49
  • \$\begingroup\$ There is a total limit to the sum of all IO pins drain, 280mA of LEDs could exceed it. See arduino-info.wikispaces.com/ArduinoPinCurrent Using a transistor driver to pull power off the 5V rail is the way to go. \$\endgroup\$ – Ron J. Aug 6 '13 at 12:15
  • 1
    \$\begingroup\$ @RonJ. 2 red in series for each pin, at 20mA would only be 140mA on 7 pins. Or drive them at 15mA, that's only 105mA. And you get individual control. \$\endgroup\$ – Passerby Aug 6 '13 at 17:54
  • \$\begingroup\$ @RonJ.: Thank you, I see I overlooked p. 314 of the datasheet. \$\endgroup\$ – davidcary Aug 8 '13 at 20:54
  • \$\begingroup\$ @Passerby: good point, that should work. \$\endgroup\$ – davidcary Aug 8 '13 at 20:55

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.