# Control voltage using transistor

I know nothing about transistors except they can be used as simple amplifiers. I do not know which one to use for my project.

A port from arduino would give me volts ranging 0V-5V. I have an external circuit, which consists of a 12V battery and a LED array. The LED array is composed of 4 serially-connected blue LEDs and each rated 3V, 0.25W. How to make a highly efficient transistor circuit, such that the maximum current dropping does not exceed by 2V ?

• It does not sound like you need an amplifier, it sounds like you only need a switch. However, let me clarify, are you trying to switch the "4 serially-connected blue LEDs" on and off using a pin on your Arduino? When you wrote "such that the maximum current dropping does not exceed by 2V", did you mean the transistor switch must not drop more than 2V when the full current of the LEDs is flowing through it, or is there something else that you require? – gbulmer Sep 1 '14 at 14:19
• The LEDs fade in and out. Yes, the transistor must not drop more than 2V. I really need it. Please Please help! – Damodar Dahal Sep 1 '14 at 14:53
• If you have four series-connected LEDs, each rated at 3 volts, they will "use up" all of the 12 volt supply, and not leave any room for the switching transistor to work. You will probably need to use two series strings, with two LEDs in each. – Peter Bennett Sep 1 '14 at 15:32
• Is the 12V fixed, or could that be increased to say 15V? Or 12V with just 3 LEDs? What is the context of your project? – starblue Sep 2 '14 at 19:55
• Do you have a datasheet for this LED array? Link? – Phil Frost Sep 5 '14 at 12:04

4 LEDs in series, each dropping 3 V isn't going to work well with a 12 V source. The LEDs are using up all the voltage, so there is nothing left for a switch to drop or some mechanism to make sure the current is reasonably regulated.

The "12V" battery will vary a bit depending on temperature and state of charge. LEDs have a steep current curve as a function of voltage, so a small change in the battery voltage will cause significant change in LED current.

At most you can run 3 of these LEDs in series from a "12 V" battery. That gives you about 3 V at nominal voltage for whatever regulates the current to drop. Here is a simple circuit for a single string of 3 LEDs controlled from a 5 V digital output:

This sets up Q1 to be a current sink largely independent of the actual battery voltage. You say your LEDs take 250 mW at 3V. That means the current thru them is 83 mA. In this circuit, we're trying to keep the emitter at 1 V, which will cause the right current thru R12, with 98% of that or more going thru the LEDs. The transistor will do this over a wide range of collector voltage, which is how the same current is maintained regardless of battery voltage variations.

R2 and R3 are somewhat of a guess. You probably have to tweak R3 to get the desired LED current. However, once you find the right value with your particular transistor, this should work nicely. The problem is that the base current is high enough to load down the R3/R3 voltage divider, but we can't know what it is up front to trim R3.

Let's say the transistor gain is 50, which is the minimum you should be able to count on. In that case the base current will be 1.7 mA. As a rough start on calculating R3, I used 1.5 mA base current. Figure the B-E drop at 700 mV, so we want to hold the base at 1.7 V. That means 7 mA will flow onto the base node thru R2. With the base taking 1.5 mA, that leaves 5.5 mA for R3 to draw. (1.7 V)/(5.5 mA) = 309 Ω, so 300 Ω is a good value to start at and see where you are. Lower value of R3 will cause lower LED current.

Note that this circuit assumes your digital output can source 7 mA at 5V. Many can, but you should check that.

The point of the above circuit was to drive the maximum number of LEDs from a string and deal with the possibly significant variation of the battery voltage. If you want to give up and just get two LEDs per string as some other answers have done, then this becomes even simpler:

This uses the least parts, draws the least current from the digital output, and still keeps the LED current reasonably constant as the battery votlage varies. Note that R1 needs to be at least a 1/2 Watt resistor.

This uses the same strategy as before, which keeps the base of the transistor at a fixed voltage with a fixed emitter resistor to create a current sink that is largely independent of the battery voltage. With only two LEDs to drive, we have enough voltage for the transistor to drop so that the base can be held at 5 V. Unlike with a brute force common emitter switch, the current drawn from the digital output will be the LED current divided by the transistor gain, not some artifically lowered "forced gain", in addition to this actively regulates the LED current as noted before. Figuring you can count on the transistor having a gain of 50 at least, this draws less than 2 mA from the digital output.

Replicate for each pair of LEDs you want to drive.

• Running Q1 in either cutoff or saturation with a proper ballast resistor from the collector of Q1 to 12V will get rid of the necessity for R1 and R3, will allow Q1 to more closely approximate a switch, and totally eliminate the need for any "tweaking", LOL ;) Further, forcing a beta of 20 with Ic = 80mA means the base only needs 4 mA to saturate the transistor, which virtually any 5V source should be able to provide. Then, ostensibly, since the OP wants to use all four of the LEDs in the array, what's to be done, sensibly, with the last one? – EM Fields Sep 1 '14 at 19:52
• @EMFi: If you're willing to have only 2 LEDs in a string, this gets even simpler AND has better performance AND draws less current from the digital output. See addition to my answer. Also, your method has 160 mA collector current, not 80, so requires 8 mA from the digital output at a "forced beta" of 20. – Olin Lathrop Sep 1 '14 at 20:21
• And uses only one transistor, so that's two more resistors eliminated, plus the extra transistor. Then, since the transistor's got a bunch of beta left over with Ic = 160mA, and it increases as the transistor heats up, forcing it to a beta of 40 in order to get 4mA into the base is duck soup. Using NMOS, of course, would get rid of another resistor and make the beta argument moot. – EM Fields Sep 1 '14 at 20:35
• @EMFi: You make it sound like a extra resistor or transistor actually matters. For driving 4 LEDs I'd use two transistors and two resistors. You'd use one transistor and three resistors. Same thing. The biggest parts would be the two power resistors, which each design uses two of. Same thing. No, you're not "eliminating two more resistors". Count again. – Olin Lathrop Sep 1 '14 at 21:03

You need to get some headroom, so split the serially connected 4 LED array into an array of two parallel strings, as shown below.

R1 and R2 will dissipate about a half-watt each, so it wouldn't hurt to use two standard 150 ohm 5% carbon film 1/2 watt resistors in parallel for each string, each parallel pair in series with its string of LEDs.

• I make R1 and R2 75 ohms - they each carry 80 mA. Since they drop 6 volts, their power dissipation is 6 x .08 = 0.48 watts, so 1/2 watt resistors are definitely required - 1 watt might be better. – Peter Bennett Sep 1 '14 at 17:28

It appears that you only need a switch to switch the LEDs on and off using an Arduino pin, setup as a digital output. The comment about a transistor being an amplifier seems to be a distraction.

You could do this in a variety of ways. You could use a MOSFET, BJT, Darlington transistor, or an IC.

The simplest approach might be to use an N-Channel MOSFET:

simulate this circuit – Schematic created using CircuitLab

Your LEDs need a current of:
I = 0.25W / 3V = 83mA

The LEDs are in series so the same current passes through them all of them. Choose a MOSFET which will handle at least 2x or more of that current to give some headroom.

Edit:
A MOSFET looks like a voltage controlled resistor. It's on-resistance is called Rds(on). MOSFETs with Rds(on) well under 0.1ohm are available for less than \$1.

Voltage drop across a MOSFET's drain to source (Vds), with an on-resistance (Rds(on)) of 0.01ohm is:

V = IR = 0.083A * 0.1ohm = 0.0083V, or 8.3mV

Which is well under your 2V target.

The MOSFETs current (ID) should be 200mA or more,
Vds 20V or more, and
Vgs 20V or more (to be safe if you make a wiring error)
It needs to switch at 4.5V Vgs (many switch at 10V Vgs), so the easiest way to ensure the MOSFET has a low-enough Vgs is look for
Rds(on), which should be stated at 4.5V or less.

The only significant disadvantage is they are mostly Surface Mount Devices (SMD) which might be inconvenient.

A very similar circuit will work with an NPN BJT, with the addition of a resistor on its base connection to limit the current drawn from the Arduino pin.

I tend to use ULN2803's which are integrated circuits which contain 8 Darlington transistors. Each one is capable of switching 150mA, and it has a resistor to limit base current built in, so it is very easy to use. The come in Dual-In-Line (DIL) plastic (DIP) packages,and so are easy to use on a breadboard. The voltage drop across these Darlington transistors is about 1.3V.

Edit:
The 'best' solution would use a constant current source, and remove R1. It would maitain the current constant even while temperature changes. You could make that from discrete components.

(I can't see the integrated circuit that I'm looking for.)

• As I see, usual MOSFETS activated only at about 4 Volts. Is there a MOSFET that activates at 1V or so? – Damodar Dahal Sep 5 '14 at 6:14
• @DamUnderscore - Why do you need "a MOSFET that activates at 1V or so"? The question says the circuit will be driven by an Arduino, which will provide a switching voltage close to 5V. I have added a bit more detail to my answer to explain the voltage drop across the MOSFET when it is switching. For a modest MOSFET, switched on by an Arduino, the voltage drop across it when it is on, may be 0.01V in this circuit. – gbulmer Sep 5 '14 at 11:45
• This solution won't work because 12V is not enough to run 4 LEDs each with a forward voltage of 3V ($3\:\mathrm V \cdot 4 = 12\:\mathrm V$). If the voltage across the LEDs is the full supply voltage, then how can there be any voltage across R1 or the transistor? – Phil Frost Sep 5 '14 at 11:59
• @PhilFrost - You changed your comment. "This solution won't work". My interpretation of the question is the OP has asked for a circuit to switch the 4 serial LEDs, and the switch must drop no more than 2V. I have not seen anything more from the OP. I agree we need more info. I am still assuming the OP wants 2V or less across the transistor and R1. The transistor drops less than 10mV, so I don't think it will have a huge effect on the LEDs. One rationale for the question is they intend to pulse the LEDs. That would probably work without a resistor if the duty cycle is about right. – gbulmer Sep 5 '14 at 15:19
• @gbulmer Given the constraints in the question of a 12V battery and four LEDs in series each with a forward voltage of 3V, what's needed is exactly 0V dropped across the transistor and any resistor, which means you can't have any current regulation. If you put those LEDs straight across 12V, then the current will depend on only the LEDs' and battery's internal resistance, both of which are variable, small, and very temperature dependent. Without making some really bad assumptions, that circuit will not work. Most likely either the LEDs will turn into smoke, or they will be very dim. – Phil Frost Sep 5 '14 at 19:05