7
\$\begingroup\$

Why is my transistor only driving 5V instead of 6V? How can I fix it?

I have a 6V, 25mA circuit running some LEDs. I can control them by connecting and disconnecting the positive terminal of the battery pack.

I want to control them with an Arduino. So I added an NPN bipolar junction transistor with the base attached to the arduino's digital output pin and the collector-emitter acting like a wire from the positive terminal of the battery to the LED circuit. I also connected the Arduino's ground to the battery's negative terminal, but the Arduino is powered off a separate power supply.

          o---------o
 #####    |         |
 #   #  |/         /+\
 # A #--|         (   )
 # R #  |>         \-/
 # D #    | ####### |
 # U #    | #     # |
 # I #    o-# LED #-o
 # N #      #     # |
 # O #      ####### |
 #   #              |
 #####--------------o

The problem is that the LED circuit really needs 6V to run, while the Arduino's digital pins only output 5V. I don't quite understand why, but even though the collector is attached to 6V, the emitter is not really driving 6V, even when the base is on at 5V.

It's a little hard for me to debug, since the circuit is all diode-y, so if it doesn't get enough voltage that part just turns off in a non-ohmic way. Part of the circuit only needs 5V to function, and it works, but the longer series of LEDs only works when I connect the base to a 6V source.

What is going wrong, and just as importantly, how do I fix it?

\$\endgroup\$
1
  • \$\begingroup\$ Thanks! Moving the load closer to +6V and the transistor closer to +0V worked, though it was a pain to rewire the LED harness for common anode instead of common cathode. PNP was too hard to test, as showtime is tomorrow. \$\endgroup\$ Commented Oct 31, 2010 at 5:10

4 Answers 4

7
\$\begingroup\$

You can do this a number of ways. I usually drive transistors in common-emitter mode when using them as switches. The emitter of the NPN transistor goes to the common (ground) rail, the collector to the cathode of the LED and then a current limiting resistor to B+. The transistor will turn on when the base voltage is approximately 0.7V above the emitter voltage. Use a resistor on the base of the transistor (to the I/O pin) since BJTs are current controlled devices.

When the I/O line goes high (say +5V), you will have 5V across the resistor and the B-E junction of the transistor. The transistor B-E junction will drop 0.7V with the remainder (4.3V) across the resistor. Say you use 1k for the base resistor. This will give you 4.3/1000 or 4.3mA of base drive current. This is TONS of current, and since the B-E junction is forward-biased it will amplify the base current by the gain of the transistor (usually between 50 and 200) and limit the C-E current to this level. (When using transistors as switches you usually don't care about the actual collector current, you just want to make sure the transistor is allowing much more current than you will actually draw.) The end result is that the transistor is fully on and your LED will light, limited by the series resistor you chose to limit the LED current to something like 10-20mA.

When the I/O line is low, the B-E junction has no appreciable voltage across it and the transistor is considered "off." I like to include a 4.7k-ish resistor between the base and emitter to make sure that the transistor doesn't accidentally switch on due to noise or a floating I/O pin.

This basic NPN switch circuit works well as long as your C-E voltage is under about 30V and your load is mainly resistive and relatively low current (under a few Amps). When you're trying to control higher voltages you have to start looking at either more specialized (high voltage) transistors or more complex drive circuits. When driving inductive loads (relays, motors, etc.) you need to protect the transistor from the inductive kickback that occurs when current stops flowing through an inductor. When driving high current loads you may have to again look at specialized transistors or more complex drivers to ensure the transistor remains fully switched-on.

If your load must be connected to common (instead of the transistor emitter) then you can use a PNP transistor. Emitter to B+, collector to the LED anode, LED cathode to a current limit resistor and the other end of the resistor to common. Now a logic '1' should turn the LED off and a logic '0' should turn it on, but you've got a problem. The problem is that your I/O line cannot turn the transistor off, because the highest voltage it can reach is 5V (in our example). This would maintain 1V across the B-E junction and the transistor would remain on, even only if partially on. In this case I like to "cheat". You can turn the I/O line into an input to turn the transistor off (remember I like to have a 4.7kish resistor between the base and emitter). This is not ideal because it slows down your turn-off (which may or may not be a problem) but also because you now have (in this example) 6V going to an I/O line. It may not be able to withstand this kind of voltage and you can damage the line or the internal protection circuitry on the input. What I do to mitigate the problem is to use an NPN transistor to turn on the PNP transistor. This doesn't solve the turn-off problem but for most general cases it's nothing to worry about.

\$\endgroup\$
5
\$\begingroup\$

Sounds like the load you're driving is floating the emitter voltage up to where the signal from the arduino can't really completely saturate the transistor.

You could move the load up so that it's between the transistor's collector and the battery, and wire the transistor's emitter to ground. This will ensure that the signal from the arduino will be high enough relative to the base-emitter junction to get the transistor on and saturated. In fact, you would probably want to put a current limiting resistor between the arduino output and the base of the transistor, something in the 500 to 2000 ohms ballpark.

\$\endgroup\$
2
\$\begingroup\$

For something like an LED, put the transistor on the low side (that is, emitter connected to ground.)

EDIT: It seems I should have expanded, as I have got -1 perhaps due to my vague asnwer. If you put it on the low side, then any signal above 0.7V will usually saturate it (turn it completely on.)

\$\endgroup\$
2
\$\begingroup\$

"The problem is that the LED circuit really needs 6V to run,"

No, you're lucky that the LED needs 6V! If it wouldn't it would go up in smoke as your circuit doesn't have any form of current limiting.

You're using the transistor in common collector, aka voltage follower. In common collector the Arduino will see the load's resistance \$\times\$ \$H_{FE}\$ as the impedance at the base, so for instance a 100\$\Omega\$ emitter resistor may show as a 10k\$\Omega\$ at the base. That's why you can do without a series resistor connected to the base.

If you would just have a common LED on the emitter, however, you only have the LED's voltage drop (2V?) + the base-emitter junction (0.7V) between the Arduino's output and ground. That's less than the Arduino's output level, the base current would skyrocket, and the collector current even more so. Goodbye, LED.

Now this LED of yours, which needs 6V. 6V is a weird voltage for any LED, so I assume it has a few LEDs in series with a series resistor built-in. If the LEDS' combined voltage is higher than 4.3V this circuit won't work: the transistor's emitter has to be at 4.3V maximum otherwise there can't flow any base current, hence no collector current either.

The solution is to use the transistor in common emitter, like is most often done to switch a load from a positive control voltage. Place the LED between collector and +6V, and place a series resistor between the Arduino output and the base. If the LEDs are 25mA a 1mA base current will do for most small signal transistors, so use a 4k7 resistor.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.