ECE 248 Lab 6 Spring 2016 Lab 6: BJT Switches (May 17/18) GOAL The overall goal of this lab is to better understand how to use BJT switches. OBJECTIVES To build, test, simulate, and understand the following circuits: 1) Relay controller 2) DC motor driver using pulse width modulation GENERAL GUIDELINES You should know the guidelines by this point in the course … PARTS AND MATERIALS Lab kit (breadboard, wire stripper, wire) Digital oscilloscope, scope probes, function generator, coaxial cable (with alligator clips), benchtop power supply Miniature relay DC motor Npn transistor: 2N3904 (1) 2N2222A (1) Resistors: 560 ohm (green/blue/brown) (2) Diode 1N4002 (2) 1 ECE 248 Lab 6 Spring 2016 PART 1: RELAY CONTROL In this section you will see how a BJT switch is used to control an electromechanical relay for a DC fan. The fan requires 700 mA or more of current. This is quite a bit of current, but it is easily handled by a relay. Nice! Meanwhile, the relay coil only needs about 80 mA, which is no problem for a small-signal transistor like the 2N3904. Fig. 1: Relay control circuit using a BJT switch. The relay coil is powered by +5V, while the fan is powered by +12V. Step 1a: Build the relay circuit in Fig. 1. o Spread out your circuit, since you’ll need to measure base and collector currents. o Wire the benchtop power supply to provide TWO outputs: o o +5V is for the relay coil. Set the max current of the power supply to 0.2A. +12V is for the fan. Set the max current to 3A. The colored terminals on your breadboard should be the following: RED terminal = +12V. YELLOW terminal = +5V. GND terminal = GND. Insert the relay across the breadboard “gap” (i.e. like an op amp). The relay connections are the following: Pin 1 = empty Pin 12 = FAN+ Pin 5 = Transistor collector Pin 8 = +5V Pin 6 = +12V Pin 7 = GND 2 ECE 248 Lab 6 o The 2N3904 pin diagram is on the course website. o Remember the “gray band” of the 1N4002 diode is the cathode. Step 1b: Test the relay circuit. o o The control signal is the Agilent function generator with the following settings: HighZ output Waveform = SQUARE WAVE, Frequency = 0.1Hz Amplitude: Low Level = 0V, High Level = 5V Your circuit works properly when the relay is clicking and the fan turns on and off. Spring 2016 The fan is quite powerful … and loud. Step 1c: DC measurements when the fan is ON. o Make the necessary multimeter measurements to complete VCE, IC, and IB in Table 1. You should get VCE ≈ 0.15V, IC ≈ 60 mA, and IB ≈ 8 mA. Is the BJT switch in hard saturation? o Remember that hard saturation requires IC/IB ≈ 10. The benchtop power supply displays both the voltage AND current output. What is the fan current? You should get IFAN ≈ 0.7 A. Table 1: DC measurements when the fan is on. VCE IC IB DO NOT DISASSEMBLE THIS CIRCUIT! (see next page for Part 2) 3 IFAN ECE 248 Lab 6 Spring 2016 PART 2: PWM CONTROL OF MOTOR SPEED Pulse width modulation (PWM) is a very common technique to control the speed of a motor. The basic idea is to power the motor with a series of PULSES rather than a DC voltage. Low Duty Cycle Med Duty How does this affect speed? The duty cycle (% of on-time) affects the Cycle average voltage seen by the motor. For example, a DC voltage of +12V is basically a 100% duty cycle waveform. Therefore, the motor sees an average of +12 V (full speed). A 0-to-12 V square wave with a 50% duty cycle results High Duty in an average voltage of only +6V (about half speed). The pulse frequency Cycle must be fairly high (> kHz) to ensure the motor does not respond to individual pulses – remember that it is the AVERAGE value that we want! Fig. 2: Schematic of voltage pulses with different duty cycles. Step 2a: Build the motor control circuit shown in Fig. 3. +12V o Notice the 1N4002 flyback diode in parallel with the motor. o The PWM signal comes from the Agilent function generator. o See the course website for the 2N2222A pin diagram (data sheet). MOTOR 1N4002G Step 2b: Configure the Agilent function generator. o Choose the “Pulse” waveform with a 25 kHz frequency. o Make sure the LOW amplitude= 0V and HIGH amplitude = 5V. o Use alligator clips to attach the function generator output to the “PWM” input of the circuit. Step 2c: Test the circuit. From Function Generator 560Ω Q1 2N2222A Fig. 3: PWM‐driven transistor switch to control the speed of a DC motor. o Your circuit works if the motor speed can be controlled by the PWM duty cycle (vary from 10 to 90%). o Use the multimeter to measure the DC motor voltage when the PWM duty cycle is 20%, 40%, 60%, and 80%. Complete Table 2. Table 2: DC measurements of motor voltage at various PWM duty cycles. 20% o 40% 60% When the Agilent duty cycle is 80%, adjust the scope to display a few cycles for each trace. Record scope traces of the PWM input (from function generator) and the transistor’s collector voltage. 4 80% ECE 248 Lab 6 PART 3: CIRCUIT DEMOS As always, Buma will reset the scope and function generator. 1) Circuit #1: Relay o Show your completed Table 1. o Set the Agilent function generator to the following settings: HighZ output Waveform = SQUARE WAVE, Frequency = 0.1Hz Amplitude: Low Level = 0V, High Level = 5V o The relay should be clicking, the motor should be turning on and off. o Use the multimeter to show VCE. 2) Circuit #2: PWM driver for DC motor. o Show your completed Table 2 and recorded scope snapshots. o Set the function generator to: o Waveform = PULSE Low Level = 0V, High Level = 5V Frequency = 25 kHz, Duty cycle = 80% Adjust the scope to show a few cycles of the transistor’s collector voltage. NOTE: BUMA FORBIDS ANY STUDENT FROM USING THE AUTOSCALE BUTTON. Buma will deduct 4000 pts from your lab grade if he catches you using Autoscale! o Adjusting the PWM duty cycle should vary the motor speed. (End of Lab 6) 5 Spring 2016