Useful links




Laboratory #5 - the transistor

During this lab you will learn about a few of the uses for the transistor. These devices have many uses - you will learn about two of them - transistors as current amplifying switches, and transistors as low power switching devices for logic gate construction. From this lab on you will be working on understanding elements that will be useful in designing and building your autonomous car. In lab 3 you played with the cars a little bit trying to understand how the vehicle behaves using different methods of speed control all of which were done manually. The transition will be made during this lab from making the cars move manually, to making the cars move in response to a signal generated as the vehicle is moving.

Prelab


In order to steer our car we must be able to turn the motors on and off in response to input from the IR sensors. We will put the sensors on the car looking down at the table. These sensors get information about the reflectivity of the table surface by sending a signal down to the table and receiving it. The voltage level of the signal from the sensors can be discriminated looking for white, black, and colored surfaces. The circuit that you will design uses the information from the IR sensors to provide the steering for the car so that it follows a white piece of tape. The circuit must be able to tell the motors to turn on and off, or to run backwards with no external intervention - no nudging or pushing, telekinesis is hard to prove but discouraged. We have learned about one device that can be used as a switch - the DIODE. However, there is a serious drawback to using the diode as such a switch for this application. The load (in this case the vehicle motor) must be connected to the same power source as the diode. Unfortunately, the signals that will turn the motors on and off will be output by TTL logic gates. We'll learn more about these gates in later labs, but for now all we need to know is that these gates are completely incapable of driving the motors in your cars. If you connect one up to the motor and turned it on, the motor will sit serenely, quietly. So we need a switch that can be controlled by a small signal with this small signal somehow enabling a large amount of current to flow. A transistor is such a device.

Below are cartoons of your vehicle. The leftmost figure shows the jacks that supply the voltage for both the TTL logic which needs 5V and that supply the voltage for the motors. You have already hooked the voltage from the battery to the motors in lab 3 - as shown in the middle figure - and watched how the motors act when one motor is connected...then both motors. Imagine modifying this circuit to include a switch between the motor and the negative terminal of the motor voltage. Now the switches can be used to turn the motors on and off by connecting and disconnecting the motors from the battery.

Pasted Graphic 1Pasted Graphic 2Pasted GraphicPasted Graphic 1

For our autonomous design we want the switching to be done electronically. Autonomy is gained by replacing the manual switches with our electronic equivalent (rightmost figure). There are two modules that can be used - both use transistors to do the switching. Both accept a very weak signal as the control for the state of the switch (designated L and R in the figure). Both control the flow of current through a separate, more powerful supply using the very low power signals generated by our sensors and logic gates. In effect these devices connect the motors directly to motor battery and at the same time use a small signal to switch this connection on and off.

Current Amplifier Module

One of the modules is called the Current Amplitfier (CA). It acts exactly as the manual switches except there is an extra input to the module that accepts a small signal to control the switching. This small signal controls the CA module by presenting different voltages to the module. A high voltage will close the electronic switch and a low voltage will open the electronic switch. As the combinations of the switches are opened and closed the vehicle will respond accordingly, by stopping, turning right, turning left, and going straight.

  1. Draw the vehicle in all four states using the manual switch (the right center figure is an example of the state where both switches are opened) and describe what the vehicle is doing for each switch setting.

    How do the modules that we will use provide this capability? The devices that acts as our electronic switch are transistors. The modules are actually transistors circuits whch use several transistors but to the designer - you - the module can be treated a single transistor - see figure below. The block representing the electronic switch has been isolated from the drive circuit and expanded in the figure with the circuitry inside the electronic switch modeled by a single transistor.

    Pasted Graphic 7

  2. Draw the vehicle connected to the motor voltage as before except now use electronic switches instead of the manual ones. Use the model above for the electronic switches, drawing the transistor inside the box as in the above figure. The electronic switch is connected between the motor voltage ground at the collector and the battery ground at the emitter. The input signal is applied to the base. To specify the signal connected to the base simply draw a line not connected to anything, but specify the voltage levels at the two electronic switches needed to make the vehicle turn left.

    A schematic of the Current Amplifier (CA) module is shown below. This circuit uses Bipolar Junction transistors The heart of the circuit is a module labeled TIP 142 whose internal circuitry is shown to the right. The TIP module has two transistors in a configuration called a Darlington pair. This is a common configuration of transistors when the load (in this case our motors) needs more current than any one transistor could handle. This module, combined with the external transistor, allows the motors to be turned on and off electronically. This is one of the modules you will use in the lab.

    Pasted Graphic 6Pasted Graphic 8




    Current Amplifier Bridge Module

    The other device that can be used to drive the car motors is called the Current Amplifier Bridge (CAB) which uses a different type of transistors - the Field Effect transistor (FET). The module that we will be using that contains the MOSFET transistors has an interesting configuration of transistors that allows the current to flow through the motor in either direction so that the motor can run either forwards or backwards. It is called an 'H-bridge' configuration. Any type of transistor could be used it just happens that the modules used are made of MOSFET transistors. A typical bridge is shown in the figure below. The different transistors are turned on and off with voltages applied across the gate. These are designated in the figure below as Vswitch1, Vswitch2, Vswitch3, and Vswitch4. This bridge circuit works like the circuit on the right where the transistors have been replaced by switches. We can selectively close the switches - there are 16 different combinations but only two useful ones and a couple harmful ones that short the source to ground.

    lab5_H_bridgePasted Graphic

    Let's assume that the load is the motor of our car which is run from the voltage Vload. The four switches (transistors) connect the motor to this voltage in 16 different ways. The table below enumerates all 16 possibilties. A designation of '1' in the column of the Vswitch voltages indicates that the voltage will turn ON the appropriate transistor and the current will flow from the drain to the source or the switch in the other diagram is CLOSED. A zero indicates that the transistor is OFF or equivalently that the switch is OPEN. If the current flows from left to right I have called this direction 'forward'. When the current flows through the motor in this direction the motor is running forwards - a completely arbitrary designation.


    lab5_prelab_bridge_table

    Pasted Graphic 4 Pasted Graphic 3


  3. Fill in the column which asks how the circuit is behaving. A few rows have been filled in for you with the equivalent circuits drawn to show how the selective closing of the switches affects the flow of current.
  4. Why would you want to use this module in your design, what advantage doe the ability to go backwards afford you?
  5. Could a similar circuit using only the CA module be designed - remember the CA can not go backwards

    A real H-bridge is more sophisticated than our simple model for it has logic circuitry that ensures that you NEVER close the switches (turn on the transistors) in harmful combinations. The module that we use in the Current Amplifier Bridge (CAB) uses a combination of N-channel and P-channel MOSFETS that are always switched in pairs so that transistor 1 and 4 must be conducting at the same time and transistor 2 and 3 must be off for the motor to run forward. The opposite is true for the motor to run backwards - transistor 2 and 3 are configured so that they must be conducting at the same time while transistor 1 and 4 must be off. During this lab you will be playing with a Current Amplifier bridge and they will be made available to you for driving your vehicles's motors.

    Transistor as switch to represent binary logic levels

    The logic that you will use to navigate the track is implemented in hardware using TTL logic - this type of logic uses transistors as switchesto implement logic gates. These days there are many different technologies that implement Boolean logic gates. TTL and DTL technology - two of the older technologies are mentioned in class. These technologies exploit the fact that the transistor has several modes of operation - OFF, ACTIVE, and SATURATION. The OFF and SATURATION modes will be the two states that will be used to represent the two logic levels 0 and 1 in our Boolean logic. Lets see why these transistor states are useful to represent the logic states 0 and 1.

    In lecture you may have learned some logical functions including NOT, AND, OR, NAND, NOR, XOR to name a few. These are abstract concepts involving the different ways of combining two states using Boolean algebra. These two states we usually call 0 and 1. In this lab we will investigate how to map these abstract concepts onto hardware. Each of the states 0 and 1 will map onto two distinct states of the circuit usually dintinguished by voltage levels with lower voltages representing the 0 state and higher voltages representing the 1 state. In TTL the gates accept any voltage (within reason) but divide the voltage range into two with input voltageranges < ~.8V representing a 0 and all higher voltages represent a 1. The output voltages of TTL usually give 0V for a 0 and 5V for a 1, but this too depends on what is connected to its inputs. So you can see that inputs and outputs of the real circuit cannot be mapped cleanly to the desired logic function.

    0 state -

    Below is a transistor circuit in the common emitter mode. The input to this circuit is the voltage source to the left. If Vin is very small then the transistor is in the OFF state. The highlighted portion shows that when the transistor is OFF then no current flows from the collector to the emitter and therefore the output circuit sees an open across the collector-emitter junction so this voltage V
    ce is just the voltage Vcc - the highest value that Vcc can be. In this case as long as Vbe is less that Vbeon the turn-on voltage of the transistor, then the output voltage (Vce) is unchanging and is equal to the voltage Vcc.


    Pasted Graphic 1 OFF STATE

    1 state -

    The next figure (below) represents the transistor circuit when the transistor in the SATURATED state. Now Vin is large enough so that Vbe > Vbeon and large enough so that the input base current Ib is greater than that need to drive the transistor into saturation. The output circuit now looks like a simple resistor circuit where the output Vce is constant at Vcesat which is usually quite small.

    Pasted Graphic 2 SATURATION STATE


    A graph of how the output voltage Vce depends upon the input voltage Vin helps to see how useful the transistor might be as a two state device. In the graph below we can see that for two ranges of Vin the transistor output is constant and easily distinguished from each other. This suggests that logic gates might be built from these devices.

    Pasted Graphic 4


  6. Draw the above plot and label the voltages V1, V2, V3, and V4 and label the three different regions stating the mode that the transistor is in for each (01, V12, and V>V2 are the voltage ranges of each mode).

  7. If we were to call the collector to emitter voltage (Vce) the output voltage (Vout) what logic function might this simple circuit represent?

  8. A potential drawback of using the transistor this way is that for intermediate voltages between V1 and V2 the output state is indeterminant - neither a high voltage like V4 or a low voltage like V3. Lets see if we can make this a better logic gate by making the region of indeterminant values as small as possible. What transistor parameters does V1 depend upon (Vbeon, â, Vcesat)? What transistor parameters does V2 depend upon (Vbeon, â, Vcesat)? How would you move V1 and V2 closer together?

  9. Suppose we designed a circuit to emulate a NOT gate what would the output of the NOT gate look like if we input a sine wave shown below in the figure. A perfect NOT gate would emulate our abstract idea of a NOT gate so that only two possible voltage level exist. This gate would respond by outputing a square wave. Draw this square wave (assuming the threshold dividing the 0 and 1 state is 2V) on top of the sine wave below. Sketch what you think might be the actual signal if we input this sine wave into the transistor circuit above assuming that Vbeon=.6V, â=50, and Vcesat=.2V.

    Pasted Graphic 6



    Lab Instructions

    Part 1 - transistors as current amplifiers

    The first part of this lab will focus on getting comfortable with building the two possible circuits to be used to control the vehicle motors - the circuits that are represented in the figure below as the electronic switch box. The first - the current amplifier (CA) - is built of BJTs cascaded to allow the device to control a load that demands a fairly high current. This module is simple to use but requires a different approach for designing a robust, flexible controller because it lacks the ability to drive the motors backwards. The second - the current amplifier bridge (CAB) allows the current to flow through the motor in either direction and can deliver more power to the motors. But it is trickier to connect and requires a slightly more complex algorithm to use all of the features.

    Pasted Graphic 1

    Current Amplifier module

    The schematic of the basic component of this module is shown below. You can see that this component - the TIP142 - is just two transistors cascaded together so that the entire module can be considered one big transistor. The advantages of using the current amplifier module is that it is simpler and less temperamental than the module using the amplifier bridge (CAB). The disadvantage is that you cannot reverse the car without turning around and so have fewer options for finding the tape once the sensors indicate that it has been lost.

    Pasted Graphic 6

    The TIP142 has been incorporated into a circuit called the "current amplifier module" or simply the CA and can be found in the kits in your gray boxes. There should be two, one for the right motor and one for the left motor. The schematic for the entire module is shown below. Notice there is an extra transistor in addition to the TIP module itself. Across the base emitter junction of the exterior transistor is a jumper. In one position the exterior transistor base-emitter junction is shorted, in the other position the short is removed.


    This image shows the numbering scheme of modules from the top view. pic up the current amplifier so that the notch faces up and the pins are pointing away from you. The top left pin is 1 and pin 2 is beneath it. Pin 16 is the top right pin on the module.

    Below is the schematic of a circuit that connects the CA module to the battery voltage and motors on your vehicle. Build the circuit on your protoboard EXCEPT do not connect the Vlogic to pin 1 yet. A diagram of how the circuit will look is not included - this is the challenge. Try to build this circuit from the schematic. If you have trouble getting it to work don't spend too long - ask your TA for help.


    Pasted Graphic 13


    1. Turn the car on. You now have the CA module included in your circuit so a signal applied to pin 1 (base) should turn on the motor. Since we do not have any logic connected yet the signal will come from the power supply. To apply this voltage to the equivalent base of the CA connect the positive terminal of the supply to pin 1 - don't forget that the negative terminal of the power supply must already be connected as the schematic shows. Is your motor running (the answer should be yes)?
    2. With the motor running probe the CA module with the multimeter to measure the voltage between the collecter and the emitter, and the base and emitter. What are these voltages?
    3. By connecting pin 1 to the ground the motor should be turned off. This is what the navigation logic that you will be designing does to the CA to turn it off. Remeasure the voltage across the collecter and emitter with the module in the off state and record the value.
    4. Explain why the voltages are different.
    5. Reconnect pin 1 to the power supply initially delivering 5V. The motor should be running as before. We will be using this module mostly as a switch, but it is capable of more complex behavior which you can see by slowly decreasing the voltage - you should note a change in the speed of the motor. What happens to the speed of the motor? A simple switch would not have any effect on the motor speed ,explain why this module does.


      Current Amplifier Bridge/MPV3005

      The other module that you can use to run the vehicle motors is called the Current Amplifier Bridge (though it really does not amplify the current - so maybe we should just call it the MOSFET bridge module). The heart of this module is the MPM3004 which contains four transistors connected to form a transistor bridge. The configuration of the transistor is more sophisticated than that discussed in the prelab since it precludes any possibilty of putting the transistors in destructive states. A schematic is shown below. As you can see, as discussed in the prelab when two opposing transistors are ON then the current flows one way through the load connected to the bridge (in this case your motor). When the other pair is ON then the current reverses. The destructive states are eliminated because the design uses a combination of N-channel and P-channel devices so that when on pair is ON the other pair must be OFF.

      Pasted Graphic 9

      The CAB module incorportates the H-bridge module in a circuit with external logic that chooses between running forward or backwards depending on signals provided by the navigation circuit that you design. For today you will use the voltage and ground provided by the power supply to emulate these signals.

      Connect the other motor of the vehicle to this module as shown in the figure above - between pins (11 and 12) and (5 and 6). Pins (11 and 12) and (5 and 6) must be connected together - this designation does not mean 11 OR 12 as for some of the previous modules. Use the bare wires in your lab kit to short these two adjacent rows together. The positive terminal of the motor voltage (Vmb) (V2 on protoboard) is connected to pins (9 and 10) of the module and the negative terminal to pins (7 and 8). The module is now ready to drive the motors depending on the signals applied to pins 1, 2, 3, and 4. these signals will be provided by the navigation circuit that you will design if you choose to use the CAB module. For now these signal will be provided by the power supply. The logic voltage provided by the power supply set to 5V is connected to pins 16 (the positive terminal) and 15 (the negative terminal). Ignore pins 13 and 14. Pin 1, 2, 3, 4 provide the logic to run the motor forwards, backwards, and still. We are connecting one of them to ground and 2 and 3 together because for this lab we are using a simplified subset of all possible combinations. Let's see what happens when we vary the two inputs - that to pin 1 and to the pins 2 and 3 combined.


    6. The motors will not be on for all of the following combinations. If they are off, simpoly report this in your lab noteook
    7. Connect pin 1 to the negative terminal of the logic voltage and pins 2 and 3 to the negative terminal. What happens to the motor?
    8. Connect pin 1 to the negative terminal of the logic voltage and pins 2 and 3 to the positive terminal. What happens?
    9. Connect pin 1 to the positive terminal of the logic voltage and pins 2 and 3 to the positive terminal. What happens?
    10. Connect pin 1 to the positive terminal of the logic voltage and pins 2 and 3 to the negative terminal. What happens?

      Part 2 - transistors as building blocks of logic gates


      The following image shows the correspondence between the physical transistor and its circuit diagram.

      Pasted Graphic 5

      Pasted Graphic 15


      Figure 1: Circuit setup for making a simple inverter using a transistor circuit.


    11. Build the circuit shown above on your protoboard plugged into the vehicle with a charged battery using a 2N2222A transistor, 10kÙ and a 1kÙ resistor. Use the terminals on your protoboard that supply the 5VDC from the battery as your Vcc. Use the function generator to be Vin for now so that we can change the voltage as we wish. It will be our first design for a NOT gate. As you can see from the lower figure the input is Vin and our output voltage is taken as Vce.
    12. Turn on the oscilloscope and put it in XY mode. Position the displayed dot at the center of the screen.
    13. Connect channel 1 of the oscilloscope across the collector-emitter junction to measure Vce (our output) and connect channel 2 of the oscilloscope across the input voltage which is the function generator. Turn on the function generator and set it to a 100 Hz sine wave. Set the amplitude of the waveform to 5V peak-to-peak and the DC offset to 2.5 V from the function generator. Sketch this curve in your lab notebook - it should look just like the graph of Vin vs. Vce (or Vout) introduced in the prelab. As you can see when the input voltage is low the output voltage is high and when the input voltage is high the output voltage is low making this circuit a candidate for an inverter. Lets see how good an inverter it is.
    14. Take the oscilloscope out of xy mode so that you are looking at the two signals that were used to create the Vin vs. Vout plot. Vin is just the output of the function generator. If this circuit were a perfect inverter then whenever the voltage of Vin is below a certain value the output voltage would be 5V and when Vin is above that value the output voltage should be nearly zero. Draw the actual signals Vin and Vout on top of each other. Does this circuit do a good job of implementing a logical NOT gate?
    15. (optional) Now insert two diodes (1N914) in between the base resistor and the base of the transistor. Draw this output signal on top of the plot you drew in part c) Is this circuit a better inverter than the previous design?
    16. (optional)Now put the transistor back in xy mode to see how this graph has changed. Draw this graph on top of the similar graph drawn in part c). Explain the differences.
    17. Build the circuit shown below which is identical to the previous circuit except that you are using an actual TTL logic chip for comparison. The function generator is connected between pin 1 and pin 7 which is ground and still providing the same sinusoidal signal. Monitor the output by connecting the oscilloscope channel that you used to display the output voltage in previous parts between pin 2 (the output of the NOT gate) and pin 7. REMEMBER: All of the transistors on these chips need to be provided with an external Vcc voltage and an external ground. So you must connect pin 14 to the positive terminal of the voltage supplied by the battery in your car. And you must connect pin 7 to the negative terminal of the voltage supplied by the battery in your car. These circuits have been designed to be the best possible NOT gate - how does the output compare to the circuit you built with discrete parts?


    Pasted Graphic 7