 # Powering LED's from external source?

Hello everyone,

I am doing some simple LED circuits and had a quick question on running a large number of simultaneous LED’s (100+) with the arduino.

My goal is to have the LED’s powered by a separate 9V source and have the on/off functionality via a 120 transistor with the arduino digital pin going to the base. Basically, I am trying to adapt this circuit (borrowed from elsewhere on this forum) to use an external 9V to power the LED’s as opposed to the arduino-provided 5V. I had this thread on the forum (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1200895650) about the limits of the current able to be provided by Arduino and the reason I am trying this modification.

Thank you for your time as I muddle my way through this. My end project after my learning curve is a version of the LED Fan Sign I saw on the MAKE podcast to help promote the Minnesota Twins.

• Tom

Is there a question in there somewhere? ;)

Using an external DC voltage is no problem, just remember to wire the ground side of the external voltage source to the Arduino ground. Also you will have to recalculate the series current limiting resistors for each LED string.

Depending on how many LEDs you are going to drive and how many Arduino output pins you are going to use you might consider using a logic level N channel MOSFET transistor for switching the LED's on and off instead of a NPN transistor. A mosfet requires no continous DC current for it's gate drive and the active 40ma source and sink capablitly of an Arduino output pin will work well drive most MOSFETS gate well.

Lefty

Thank you for the quick response, I will take a look at the MOSFET transistors, but am currently testing with the NPN 120’s.

Question: With external 9V power supply, does the arduino 5V need to be connected to the circuit in any way (i.e. to “close” the circuit with the digital output pin)?

The end project plan is to use 2 digital output pins to run 2 transistors that each control one line of parallel connected LED’s. Likely about 75 LED’s per transistors. Along with one 9V DC source for each LED line.

Currently I have some test LED’s wired in parallel with appropriate resistors with the negative terminal of the LED’s attached to the collector pin, the Arduino digital output pin directly to the base pin and then the emitter pin wired to the ground of the 9V and arduino ground.

My arduino code blinks the onboard test LED along with the external LED’s.

Problem is that the external LED does not blink unless I also connect the arduino 5V power supply to the positive portion of the LED’s. Below is the rough schematic.

Tom

You are missing a series base resistor for the switching transistor. Otherwise it should work if you've tied the ground together as you have shown. If it switches with +5vdc but not with +9vdc then there has to be something wrong with the +9vdc source or wiring to the source.

Good luck

Lefty

Thank you very much Lefty, that fixed it for me!

Question: Is there a formula for calculating the base resistor? I will use a 1K ohm as in the example, but was just curious.

you might consider using a logic level N channel MOSFET transistor for switching the LED's on and off instead of a NPN transistor

Would using a MOSFET not require the series resistor wired to the transistor gate in the original post? I simply understand that mosfets operate on voltage rather than the current but my knowledge ends there. Simply looking to understand. Don't wish to hijack this thread

Is there a formula for calculating the base resistor?

The base resistor controls the base current. The voltage across it is Vhigh (5V in this case) - Vbe of the transistor (0.7V)

So the question is how much base current do you need.

The collector current is the base current multiplied by the gain of the transistor.

Normally you don’t know the exact gain of a transistor so you look at the data sheet or guess. Let’s guess the gain is 50, and the collector current is three LEDs worth at 20mA per LED (that’s 80mA).
So the base current you need is = 80/50 = 1.6mA

With a 1K resistor and 4.3 volts in the base you will get 4.3mA which is more than enough to turn on the transistor fully.

Too little base current will not turn the transistor on hard enough and there will not be the required amount of collector current flowing.

Too much base current doesn’t actually matter that much providing it is within the capabilities of the transistor and you are not worried too much about maximising the switching speed of the transistor.