Lab: Using a Transistor to Control a High Current Load

Introduction

Transistors are often used as electronic switches, to control loads which require high voltage and current from a lower voltage and current. The most common example you’ll see of this in a physical computing class is to use an output pin of a microcontroller to turn on a motor or other high current device. The output pins of a microcontroller can only produce a small amount of current and voltage. But when coupled with a transistor, they can control much more.

What You’ll Need To Know

You should have read the notes on high current loads before doing this lab. In order to get the most out of this lab, you should know the basics of electronics, as well as how to use a solderless breadboard. It would help to do some reading on DC motors as well.

Microcontrollers aren’t the only integrated circuits that produce a low voltage and current on their output pins. There are many components that do this. You’ll see a whole range of so-called logic ICs that can’t produce very much current or voltage, but can produce a small change on their output pins that can be read as a data or control signal. The output voltage from devices is often referred to as a logic or a control voltage, as opposed to the supply or load voltage needed to control the high-current device. You can use transistors from circuits like these. For example, you might put a transistor on the output pin of a 555 timer IC (which produces a variable timing pulse), or a shift register IC (which allows you to produce multiple control signals in parallel) to control high current loads from those devices.

Things You’ll Need

A short solderless breadboard with two rows of holes along each side. There are no components mounted on the board. The board is oriented sideways so that the long rows of holes are on the top and bottom of the image.
A short solderless breadboard.
Three short pieces of hookup wire: one is clad in red insulation, one in blue, and one in black. All three have exposed ends approximately 5mm long.
22 AWG hookup wire
5-volt regulator, model 7805. This component has three legs and a tab at the top with a hole in it. If you hold the component with the tab at the top and the bulging side of the component facing you, the legs will be arranged, from left to right, voltage input, ground, and voltage output.
5-volt voltage regulator, model 7805
Resistors. Shown here are 220-ohm resistors. You can tell this because they have two red and one brown band, followed by a gold band.
Resistors. Shown here are 220-ohm resistors, but you’ll need 1-kilohm resistors for this exercise.
Pushbuttons. These ones are designed to be mounted on a solderless breadboard. They have four legs spaced 0.2 inches apart on both sides of the component.
Pushbuttons, also called momentary switches
Potentiometer. The one shown here has three legs spaced 0.1 inches apart and can be therefore mounted on a solderless breadboard.
Potentiometer
Diodes. Shown here are 1N400x power diodes.
Diodes. Shown here are 1N400x power diodes.
DC Power Supply. Shown here is a +12 Volt 1 Amp Center Positive DC power supply with a 2.1mm male jack. This size fits the Arduino Uno's female jack.
DC Power Supply
TIP120 transistor. The transistor here has the same physical package as the voltage regulators shown above. It has three legs and a tab at the top with a hole in it. The tab is the back of the component. If you hold the component with the tab at the top and the bulging side of the component facing you, the legs will be arranged, from left to right, base, collector, emitter. The only way to know the difference between two components of the same package is to read the label on the package, unfortunately. This one is labeled TIP120.
TIP120 transistor
DC toy motor, hobby size. This motor is a metal tube with flattened sides, approximately 2 in. (5cm) long. a thin shaft at one end spins when the motor is on. Two small metal tabs or wires protrude from the other end to connect the motor to your circuit.
Small DC motor, 130 size
Small Incandescent lamp bulb and socket
Small Incandescent lamp bulb and socket (optional)

Set Up the Breadboard

Connect a 7805 5V voltage regulator to your board, and power it from a 9-12V DC power supply. Connect the ground rows on the sides together. Don’t connect the two red rows on the side of the breadboard to each other, though. Wire the breadboard so that the right side of the board receives the 5V output from the regulator, but the left side gets 9-12V directly from your DC power supply. The 5V line is the 5-volt bus or logic supply and the 9-12V line is the high-voltage bus or load supply. The two ground lines are ground.

 

Schematic drawing of a DC power jack connected to a 7805 5-volt voltage regulator. At left, there is a power plug. The positive terminal of the power plug is connected to the voltage input of a 7805 voltage regulator (the terminal on the left as it faces you). The negative terminal of the power plug is connected to the ground terminal of the regulator (the terminal in the middle).
Schematic drawing of a DC power jack connected to a 7805 5-volt voltage regulator.
At the top of the drawing, there is a DC power jack. Yellow and black wires from the jack connect to a 7805 5-volt voltage regulator mounted in the top right three rows of the breadboard with its tab facing to the right. The power supply's yellow wire is connected to the regulator's top pin row, the input pin. The power supply's black wire is connected to the regulator's middle pin, or ground. A yellow wire connects the regulator's top pin, the input pin, to the outer left side row of the board. This is an unregulated voltage bus on the left side. It will be used to control the motor. A red wire connects the regulator's output pin, the bottom pin, to the inner right side bus. This will be the regulated voltage bus. Another black wire connects the regulator's middle pin, ground, to the inner right side row of the board. This is the ground bus on the left side. Similarly, a black wire connects the left side ground bus to the outer row on the right side. This is the right side ground bus. There is no connection between the unregulated voltage bus on the left and the regulated voltage bus on the right, however.
DC voltage jack and 7805 voltage regulator on a breadboard. The regulator is supplying 5V and ground holes are supplying voltage to the rest of breadboard.

Add a Motor and Transistor

The transistor allows you to control a circuit that’s carrying higher current and voltage from the a lower voltage and current. It acts as an electronic switch. The one you’re using for this lab is an NPN-type transistor called a TIP120. The datasheet for it can be found here. It’s designed for switching high-current loads. It has three connections, the base, the collector, and the emitter. Attach high-current load (i.e. the motor or light) to its power source, and then to the collector of the transistor. Then connect the emitter of the transistor to ground. Then to control the motor, you apply voltage to the transistor’s base. When there’s at least a 0.6V difference between the base and the emitter, the transistor will “turn on” — in other words, it’ll allow voltage and current to flow from the collector to the emitter. When there’s no voltage difference between the base and the emitter, the transistor turns off, or stops the flow of electricity from collector to emitter.

The schematic symbol of an NPN transistor where B is the base, C is the collector, and E is the emitter.
The schematic symbol of an NPN transistor. B is the base, C is the collector, and E is the emitter.
Pinout drawing of a TIP-120 transistor. It is facing forward with the heat sink tab at the top and the bulging side of the component facing you. From left to right the legs are labelled 1. base, 2. collector, 3. emitter.
Pinout drawing of a TIP-120 transistor. From left to right the legs are labelled 1. base, 2. collector, 3. emitter.

You also need to add a diode in parallel with the collector and emitter of the transistor, pointing away from ground. The diode to protects the transistor from back voltage generated when the motor shuts off, or if the motor is turned in the reverse direction. This is called a snubber diode, or protection diode. Related topics: Transistors, Relays, and Controlling High-Current Loads

Schematic drawing of a transistor controlling a DC motor. At left, there is a power plug. The positive terminal of the power plug is connected to the voltage input of a 7805 voltage regulator (the terminal on the left as it faces you). The negative terminal of the power plug is connected to the ground terminal of the regulator (the terminal in the middle). A 1 kilohm resistor is connected to the regulator's output. The other side of the resistor is connected to the base pin of a TIP120 transistor. A DC motor connects to the voltage line between the DC plug and the voltage regulator. The motor's other pin is connected to the transistor's collector pin. The transistor's emitter pin is connected to ground. A diode's cathode is connected to the emitter as well, and its anode is connected to the transistor's collector.
Schematic drawing of a transistor controlling a DC motor.
Breadboard view of a transistor controlling a DC motor. THe breadboard is set up for power input as described above, with a DC power jack and a 7805 regulator. The left side voltage bus is unregulated, and takes its power directly from the DC power jack. The right side voltage bus takes its power from the regulator. A TIP120 transistor is connected to rows 16 to 18 in the right center section of the board. Its base is in pin 16, collector in pin 17, and emitter in pin 18. A black wire connects row 18 to the ground bus on the right. A DC motor is connected to the unregulated voltage bus on the left via a yellow wire. A green wire from the motor's other terminal connects to the transistor's collector, in row 17 in the right center section. A 1N400x diode's cathode is connected to row 18 with the emitter, and the diode's anode is connected to row 17, with the collector. A 1 kilohm resistor is connected to row 16. Its other end connects to row 12, and from there, a red wire connects to the regulated voltage bus on the right side of the board.
Breadboard view of a transistor controlling a DC motor.

Be sure to add the diode to your circuit correctly. The silver band on the diode denotes the cathode which is the tip of the arrow in the schematic, like so:

Schematic representation and physical representation of a diode. The schematic form shows an equilateral triangle with a line bisecting the triangle equally from one point to and through the middle of the opposing flat side. There is also a line perpendicular to the other line that also intersects the triangle at its bisected point. The cathode is represented by the side of the schematic with the line. The drawing of the physical form of the diode looks like a black resistor with only a single grey stripe on one side. The side with the stripe represents the cathode
Schematic representation and physical representation of a diode.

This circuit assumes you’re using a 12V motor. If your motor requires a different voltage, make sure to use a power supply that’s appropriate. The TIP120 transistor can handle up to 30V across the collector and emitter, so make sure you’re not exceeding that. Connect the ground of the motor’s supply to the ground of your microcontroller circuit, though, or the circuit won’t work properly.

Add a Switch to Control the Transistor

To turn on the transistor, you need a voltage difference between the base and the emitter of at least 0.7V. Since the emitter is attached to ground, that means any voltage over 0.7V applied to the base will turn the transistor on.

  • Connect a wire from the 5-volt bus of the board (also called the regulated voltage bus) to the other end of the 1 kilohm resistor as shown above and you should see the motor turn on.

Of course, it’s inconvenient to connect and disconnect a wire like this, so use a switch instead.

  • Remove the red wire connecting the resistor to 5 volts and connect one side of a pushbutton or switch to the 5-volt bus, and the other side to the 1K resistor.
Schematic drawing of a transistor controlling a DC motor with a pushbutton. The drawing is the same as the previous schematic, but there is a switch or pushbutton symbol added between the resistor and the regulator.
Schematic drawing of a transistor controlling a DC motor, with a pushbutton to turn it on and off.
Breadboard drawing of a transistor controlling a DC motor with a pushbutton. The drawing is similar to the previous breadboard drawing, but a pushbutton has been added straddling the center divide in rows 12 and 10. The red wire that was in row 12 in the previous drawing has been moved to row 10.
Breadboard drawing of a transistor controlling a DC motor with a pushbutton.

Change the Switch for a Potentiometer

The voltage on the base of the transistor doesn’t have to be controlled by a switch. You can use a potentiometer, connected as a voltage divider, to produce a changing control voltage for the transistor’s base. Related video:¬†Connecting the potentiometer

Schematic drawing of a transistor controlling a DC motor with a potentiometer. The drawing is similar to the previous schematic, but the pushbutton has been replaced with a potentiometer. The potentiometer's ends are connected to the regulator's output pin and ground, respectively. The wiper is connected to the resistor.
Schematic drawing of a transistor controlling a DC motor, with a potentiometer to change the speed.
Breadboard drawing of a transistor controlling a DC motor with a pushbutton. The drawing is similar to the previous breadboard drawing, but the pushbutton has been removed and a potentiometer is now in rows 7 through 9 in the right center section of the board. Row 7 is also connected to the right side regulated voltage bus through a red wire, and row 9 is connected to the right side ground bus through a black wire. Row 8 is connected to row 12 where it connects to the resistor.
Breadboard drawing of a transistor controlling a DC motor with a potentiometer.

When you turn the potentiometer, you’re producing a varying voltage on the wiper pin. That means you’re changing the voltage on the base of the transistor. Yet the motor doesn’t change its speed. It only turns on or off.¬†When the voltage on the potentiometer’s wiper pin reaches 0.6V, the transistor will turn on. When it’s below 0.6V, the transistor will turn off. The transistor is acting like a switch, not a variable supply. If you want to vary the motor’s speed using a transistor, you need to turn the transistor on and off very fast, and change the ratio of on time to off time. This is called pulse width modulation. You’ll learn more about it in these notes on analog output from a microcontroller and see it in action in the analog lab.

Change the Potentiometer for a Voltage Divider

If you’ve understood everything so far and managed to get it to work, here’s where it gets really fun. Imaging you have a variable resistor and you want the motor to turn on when the variable resistor passes a particular threshold. For example, maybe you want to turn on the motor when a shadow falls across a photo resistor, or when a weight is placed on a force-sensing resistor. To make this happen, change your control circuit to include a variable resistor.

Schematic drawing of a transistor controlling a DC motor with a voltage divider. The drawing is similar to the schematic with the potentiometer, but the potentiometer has been replaced with a variable resistor and a fixed 10-kilohm resistor in series. The two resistors are connected to the regulator's output pin and ground, respectively. The junction where they meet is connected to the transistor's 1-kilohm resistor.
Schematic drawing of a transistor controlling a DC motor, with a potentiometer to change the speed.
Breadboard drawing of a transistor controlling a DC motor with a pushbutton. The drawing is similar to the breadboard drawing with the potentiometer, but the potentiometer has been removed and a light-dependent resistor is now in rows 6 and 9 in the right center section, A fixed 10-kilohm resistor connects row 9 to the ground bus on the right side. A green wire connects row 9, to row 12 where it connects to the transistor's 1-kilohm resistor.
Breadboard drawing of a transistor controlling a DC motor with a voltage divider.

Connect a lamp instead

You could also control a lamp using a transistor. Like the motor, the lamp circuit below assumes a 12V lamp. Change your power supply accordingly if you’re using a different lamp. In the lamp circuit, the protection diode is not needed, since there’s no way for the polarity to get reversed in this circuit:

Schematic drawing of a transistor controlling an incandescent lamp with a pushbutton. The drawing is similar to the schematic with the pushbutton above, but the motor has been replaced with an incandescent lamp and the diode has been removed.
Schematic drawing of a transistor controlling an incandescent lamp with a pushbutton.
Breadboard drawing of a transistor controlling an incandescent lamp with a pushbutton. The drawing is similar to the breadboard drawing with the pushbutton above, but the motor has been replaced with an incandescent lamp and the diode has been removed.
Breadboard drawing of a transistor controlling an incandescent lamp with a pushbutton.

Conclusion

A motor controlled like this can only be turned in one direction. To be able to reverse the direction of the motor, an H-bridge circuit is required. For more on controlling DC motors with H-bridges, see the DC Motor Control lab.

Originally written on July 1, 2014 by Matt Richardson
Last modified on August 23, 2018 by Tom Igoe