The term project develops a speed control system for a direct current (dc) motor. The system illustrated in Fig. 1 operates the motor at one of ten speeds, as selected by a keypad. The project is designed, tested, and evaluated over several weeks, and has the following parts:
PWM waveform generation (previous week).
Hardware to drive the motor (this week’s lab).
Hardware and software to measure the speed of the motor (next two weeks).
Measurement of the motor characteristics.
A control program to control the speed of the motor.
Demonstration and presentation of results (final week of lab).
This week, students design and test the amplifier that drives the dc motor. Such an amplifier is commonly called a motor drive.
9 Vdc Power
Figure 1. Dc motor control system.
SINGLE SWITCH MOTOR DRIVE
The single switch motor drive circuit shown in Fig. 2 has been presented in the lab lecture; review the lecture slides to understand the various elements. Some design considerations are described next.
A suitable transistor Q satisfies several ratings:
In the ON state, the transistor must be able to conduct the full (maximum) load current. On a transistor datasheet, one should study the maximum rating for collector current IC.
In the OFF state, the transistor must withstand the full power supply voltage VCC. On a transistor datasheet, one should study the maximum rating for collector-to-emitter voltage
In the lab, either the 2N3904 or 2N2222 NPN small -signal transistors are provided, but students are also free to select other devices. Warning: If the motor load is high (for example, stalling the motor by locking the shaft), then neither transistor type can carry the increased current; one can expect smoke from the transistor! For normal operation, the maximum ratings of either transistor type are marginally acceptable. “Power transistors” having higher rating are used in commercial practice.
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:
≥ ≫ ℎ .
The resistance value can then be calculated as
= OH − BE(on) .
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.
DIGILENT EEBOARD ADJUSTABLE POWER SUPPLY
As illustrated in Fig. 1, a power supply will supply the amplifier or motor drive. The Digilent EEboard has adjustable positive and negative power supplies, labeled VP+ and VP–, respectively, on the power distribution block located at the bottom of the board. Output voltages are adjustable from 0 to ±9 Vdc, with current limits adjustable from 0 to 1.5 A. These values are selected in the Waveforms Power Supplies and Voltmeters instrument, shown in Fig. 3. Note that power must be turned on (in the upper left pane) and button “VP+ ON” must also be checked.
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.
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.
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.
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.
VCE(sat) – to verify that transistor Q is saturating during ON periods of the PWM signal
VOH – output of the microcontroller pin PA6, or motor drive input voltage
IB – transistor base current, or microcontroller output current
IC – transistor collector current, or motor load current
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).
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.
Construct and test circuits in stages, ensuring that each stage works properly before proceeding to the next stage.
Double- and triple-check all power supply connections, to prevent damage to any components. (See earlier warning about VCC and grounds!)
Verify the desired PWM signal at the microcontroller output, before connecting the signal to the motor drive input.
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:
voltages and currents in the drive circuit, e.g. “base current, IB”
the theoretical, design values of these signals (with units)
the measured, actual values of these signals, and
the percent difference between (b) and (c).
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.
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.
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.
INFORMATION FOR FUTURE LABORATORY REPORTS
Briefly describe the circuit (but not “wire by wire”) and the test program (attach a circuit diagram and C program source listing).
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.
Figure 4. Buehler permanent magnet dc motor with tachometer