ELEC30x0 Lab8
ELEC30x0 Lab8
ELEC30x0 Lab8
12v DC
Tachometer
Motor
Microcontroller
Keypad
8-1
ELEC 3050 Lab Manual Lab 8 Revised 01/11/17
Fig 2. Motor drive circuit using a single transistor. Input Vin is from the microcontroller.
Diode D protects transistor Q during the “turn OFF"” transient that occurs once every PWM
cycle. A suitable diode D quickly switches state in response to the voltage transients associated
with the inductive nature of the motor winding. In the lab, the 1N4148 or equivalent 1N914
switching diode is provided. These diodes are underrated for continuous full load current, but are
marginally acceptable to conduct such current during the brief turn OFF transient time periods.
The resistor R must be designed this week. The resistor limits the base current IB, so as to not
exceed the microcontroller’s output current rating. On the other hand, an excessively large value
of R prevents transistor Q from operating in the saturated state when turned ON. In the saturated
state, the transistor’s collector-to-emitter voltage is called VCE(sat), and the value can be found in
the transistor datasheet; typical values for a bipolar transistor are in the range of a few tenths of a
volt. To design the resistance value, the following must be known:
• maximum collector current expected by the load (call this Iload)
• bipolar transistor gain (β or hFE) and base-to-emitter turn on voltage (VBE(on))
• microcontroller output current characteristic for logic “high” (IIO)
• microcontroller output voltage characteristic for logic “high” (VOH)
For the transistor to operate in a saturated state when ON, the base current IB must be
significantly larger than the ratio of the load current divided by the transistor gain, yet not exceed
the microcontroller output current rating. That is:
𝐼𝐼𝑙𝑙𝑙𝑙𝑙𝑙𝑙𝑙
𝐼𝐼IO ≥ 𝐼𝐼𝐵𝐵 ≫ .
ℎ𝐹𝐹𝐹𝐹
𝑉𝑉OH − 𝑉𝑉BE(on)
𝑅𝑅 = .
𝐼𝐼𝐵𝐵
8-2
ELEC 3050 Lab Manual Lab 8 Revised 01/11/17
In modern power electronics, the MOSFET is very widely used for PWM applications. Design
equations using a MOSFET for the saturating switch can be found in textbooks.
The VP+ output will be used to supply the motor drive circuit (also labeled VCC in Fig. 2). The
VP+ supply is to be configured for 9 Vdc with current limit 1.5 A. The ground connection of the
VP+ supply is the ground connection in Fig. 2. (The VP– supply is not used for this lab.)
Important Note: The notation VCC is widely used to denote power supplies, but this
can create confusion when multiple power supplies are in a system. The notation is
used two different ways in this lab, i.e. two different power supplies are both labeled
VCC. In Waveforms, the notation VCC refers to the fixed supply (3.3 or 5 Vdc), which
is not needed here, and can be turned OFF. But the same notation VCC is used in Fig.
2 to denote the power supply for the motor drive, which runs on 9 Vdc. BE VERY
CAREFUL to distinguish between the various uses of the symbol VCC. The
microcontroller board will be very unhappy if 9 Vdc appears on any of its pins!
Figure 3. Waveforms window, showing positive power supply setting VP+ ON.
8-3
ELEC 3050 Lab Manual Lab 8 Revised 01/11/17
Figure 4. Grounds in the system should be connected in this laboratory, as shown in blue.
Introducing an external supply means that multiple grounds also exist, as illustrated
in Fig. 4. In this lab, all grounds should be interconnected, as illustrated by the blue
lines in the figure.
PRE-LAB ASSIGNMENT
Prior to lab, design a motor drive circuit as described in the lab lecture. Use voltage and current
characteristics for the 2N2222 BJT and 1N914 diode. These are the devices provided in lab, but
students are free to choose other devices on their own. Study the ARM STM32L100RC
microcontroller datasheet to determine typical voltage and current characteristics of the output
pin (VOH, IIO: See Table 43 on page 74, Table 10 on page 43, and read the last sentence on page
73, “The GPIOs can…). Then, design a value for the base resistor R.
In your laboratory notebook, write a test plan for testing the motor drive circuit characteristics.
Describe methods to measure the following operating characteristics.
1. VCE – For the curious: Measure with and without diode D in the circuit. Do not be
surprised if transistor Q becomes damaged while D is removed.
2. VCE(sat) – to verify that transistor Q is saturating during ON periods of the PWM signal
3. VBE(on)
4. VOH – output of the microcontroller pin PA6, or motor drive input voltage
5. IB - transistor base current, or microcontroller output current
6. IC - transistor collector current, or motor load current
8-4
ELEC 3050 Lab Manual Lab 8 Revised 01/11/17
The C program from the previous lab should be modified as necessary to produce the PWM
signal to control the motor. The period T of the PWM signal should be constant, with a variable
duty cycle. This program should start the motor at a low speed. In your laboratory notebook,
include a draft program (or directions to your content on H:drive).
LABORATORY EXPERIMENTS
1. Beginning this week, teams will need to design their own experiments to test designed
hardware and software. Be sure to document each experiment in lab notebooks, and
summarize the most significant ones in progress reports.
2. Construct and test circuits in stages, ensuring that each stage works properly before
proceeding to the next stage.
a. Double- and triple-check all power supply connections, to prevent damage to any
components. (See earlier warning about VCC and grounds!)
b. Verify the desired PWM signal at the microcontroller output, before connecting the
signal to the motor drive input.
c. Verify the motor drive operation with a dummy load (resistor), before connecting the
actual motor. Confirm that drive circuit characteristics (voltages and currents) are similar
to theoretical values, initially using the dummy load, and then with the actual dc motor.
Create a table of data that displays:
i. voltages and currents in the drive circuit, e.g. “base current, IB”
ii. the theoretical, design values of these signals (with units)
iii. the measured, actual values of these signals, and
iv. the percent difference between (b) and (c).
d. Compare various drive circuit signals using the oscilloscope, initially using the dummy
load, and then with the actual dc motor. Does changing the type of load (resistor vs.
motor) change any circuit characteristics?
The dc motor with tachometer is shown in Fig. 4. The motor is mounted to a wooden baseplate,
with labeled “quick connect” terminals for easy connection of hookup wire to respective leads of
the motor and tachometer. Press the top of a quick connect terminal to open the terminal, insert
the bare end of the hookup wire, and then release the terminal top to clamp the wire end in place.
8-5
ELEC 3050 Lab Manual Lab 8 Revised 01/11/17
3. Use the oscilloscope to measure the tachometer signal as the motor turns. Observe the
tachometer signal amplitude and frequency -- both are proportional to motor speed. Measure
the tachometer signal for different keypad selected PWM duty cycles. Plot tachometer signal
amplitude (or frequency) vs. duty cycle or (button number). The ideal relationship is linear,
but your results may vary. If the keypad interface is not working, then select the PWM duty
cycle with switches. However, the keypad is a required element of the final project.
4. Repeat Step 3 several times, each time using a different PWM signal frequency over a range
of values between 10 Hz and 1 kHz. Determine which frequency gives the best performance,
i.e. produces the most linear increase in motor speed (tachometer signal) with respect to
changes in duty cycle.
1. Briefly describe the circuit (but not “wire by wire”) and the test program (attach a circuit
diagram and C program source listing).
2. Discuss your results, including a table and a plot of motor speed vs. PWM signal duty cycle.
Compare the theoretical and actual motor drive characteristics. Compare experimental and
theoretical results, including what you observed at different PWM signal frequencies.
8-6