Lab Manual
Lab Manual
University of Alberta
Developed by
Florian Kaumanns (kaumanns@[Link])
Prof. Alan Lynch ([Link]@[Link])
Contents
1. Lab 1: The Hardware and Software Platform 1
1.1. Platform Overview . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . 1
1.1.1. PC Workstation and MF 634 I/O board . . . .
. . . . . . . . . . . . . 2
1.1.2. Interface System . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . 3
1.1.3. Physical Plant . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . 4
1.2. H-Bridge PMDC Motor Drive Model . . . . . . . . . .
. . . . . . . . . . . . . 7
1.3. Simulink and RTWT . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . 9
1.4. Experiment I: H-bridge Simulink PWM Output Block . . . . . . . . . . . . . 16
1.5. Experiment II: Current Measurement . . . . . . . . . . . . . . . . . . . . . . . 18
1.6. Experiment III: Velocity Estimation . . . . . . . . . . . . . . . . . . . . . . . 19
1.7. Experiment IV: Ball Position Measurement . . . . . . . . . . . . . . . . . . . . 20
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency
Domain Methods 43
5.1. Transfer Function Modeling of the Ball and Beam . . . . . . . . . . . . . . . . 43
ii
Contents
5.2. Experiment I - Lead Controller Design for Ball Position using Root Locus . . 46
5.3. Experiment II - Lead Controller Design for Ball Position Using the Frequency
Response Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
A. Appendix: Datasheets 53
A.1. A-max 32 motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
A.2. HEDL 5540 Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
A.3. Current Filter Inductor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
A.4. H-bridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Bibliography 67
iii
1. Lab 1: The Hardware and Software
Platform
The labs for ECE 360 Control System I all relate to controlling a Permanent Magnet Direct
Current (PMDC) servo motor. During Labs 2 and 3 this motor will be controlled with no load
attached (most of the time). In Lab 4 we attach an identical PMDC motor operated as a generator,
and in Lab 5 we attach a Ball and Beam positioning system. The PMDC motor is an important
device for achieving servoing or motion control tasks in general. For example, closed-loop velocity
control of a wheeled mobile robot often relies on PMDC motors.
The content of the five labs is
• Lab 1: This lab introduces the experimental platform.
• Lab 2: This lab involves PMDC motor modeling and model parameter identification. A
comparison of simulated and experimental open-loop PMDC motor response is performed.
• Lab 3: This lab investigates closed-loop velocity control using Voltage and Current Modes
of operation. Time domain control design methods are used.
• Lab 4: This lab investigates closed-loop position and velocity control with a generator load
disturbance. It also investigates an anti-windup method.
• Lab 5: This lab considers position control of a Ball and Beam system using root locus and
frequency response design methods.
1
1. Lab 1: The Hardware and Software Platform
MATLAB
SIMULINK
MF 634 + RTWT
PC Workstation
Current I/O
Transducers H-bridges + Protection
Interface System
Physical Plant
2
1. Lab 1: The Hardware and Software Platform
of I/O:
• 8x digital inputs (“DinX” denotes digital input Channel X), 8x digital outputs (“DoutX”
denotes digital output Channel X)
• 4x timer/counter channels. The channels will be used for Pulse-width Modulation (PWM)
outputs (“PWMoutX” denotes PWM output Channel X). Note: the timer/counter channels
have a 50 MHz clock, 32 bit resolution, and are dual purpose, i.e., they must be configured
as either frequency generator outputs or counter inputs. However, counter functionality (e.g.
frequency measurement of pulse counting applications) is not required in this lab (other
than the separate encoder input).
The MF634 allows controls running on the PC’s CPU to perform I/O with a physical system.
For example, we will read current of the PMDC motor using an AD channel.
Drivers for the MF634 are provided in Simulink’s Real-time Windows Target (RTWT)
toolbox1 . Together with an installed Microsoft Visual C++ compiler, this toolbox allows us
to build Simulink models which can send and receive data to the MF634 without performing
any hand-coding. RTWT also ensures the control laws run in real-time on the CPU of the PC,
e.g. our control law is implemented with a predictable sampling time in spite of the needs of
the Windows OS. Section 1.3 describes the library of Simulink blocks provided by RTWT to
program the I/O of the MF634. The section also briefly introduces Simulink in general with an
emphasis on RTWT functionality.
1
It is important to note that RTWT has been renamed to Simulink Desktop Real-Time in MATLAB 2015a.
We refer to the product as RTWT.
3
1. Lab 1: The Hardware and Software Platform
provide anti-aliasing so that it can be fed to an AD channel of the MF634. The voltage sent to
the AD is only proportional to current and so calibration is required as discussed in Section 1.5.
The interface board protection circuits decrease the risk of damaging the MF634 which costs
about $1500. The Interface System includes a regulated switched power supply that feeds the
H-bridge amplifiers a DC voltage. It also supplies power to other components of the interface
board. It delivers a controlled DC voltage Vd = 46 V at a maximum current of 6.8 A. On the top
panel of the circuit board a power switch is mounted. It passes both the 46 V supply, indicated
by a blue LED, and a 5 V supply, indicated by a green LED, to the interface system components.
The outside of the Interface System is show from the top and side in Figure 1.3.
4
1. Lab 1: The Hardware and Software Platform
Figure 1.3.: The box housing the Interface System. Top view (left) showing various interconnection
jacks. Side view (right) showing LEDs and encoder input jacks.
Encoder
Motor
Figure 1.4.: The A-max 32 PMDC motor with HEDL 5540 encoder attached.
The PMDC generator is identical to the PMDC motor except that it does not include an
encoder. It is coupled to the motor using a rigid aluminum coupling. The coupled motor-generator
system is shown in Figure 1.5 and is used in Lab 3.
The Ball and Beam system is shown in Figure 1.6. It is a 2-link mechanism which attaches
to the PMDC motor shaft. A ball rolls along one of the links and we study the problem of
controlling its position in Lab .
5
1. Lab 1: The Hardware and Software Platform
Coupling
Motor
Generator
Encoder
Ball
Beam with
position 1:1 Gears
measurement
Motor shaft
6
1. Lab 1: The Hardware and Software Platform
• It should be capable of applying positive and negative v at the motor terminals. This
voltage should be independent of the current i provided which could be either positive or
negative.
• To ensure a simple control of the PMDC motor, the relation between the drive’s control
input and its output voltage should be modelled by a pure gain.
• In order to minimize losses and torque/speed pulsations the current i produced should have
small ripple.
Although a linear amplifier satisfies all the aforementioned requirements its low efficiency makes
it uncommon today. To improve efficiency, modern PMDC drives rely on DC-DC converters
which employ power electronic switches. A switched power electronic amplifier often used for
DC motor drives is the Full-bridge or H-bridge converter depicted in Figure 1.7. This topology
enables 4-quadrant operation and provides a simple way to control voltage to the PMDC motor.
The four switching cells S1 - S4 each comprise one MOSFET and one freewheeling diode. Each
cell can be thought of as an ideal switch.
In contrast to linear amplifiers, armature current delivered by the H-Bridge suffers from ripple
components due to its switched mode of operation. However, it is possible to reduce the amount
of ripple to an acceptable level by adjusting supply voltage, switching frequency, or inductance
(see Section 2.5).
7
1. Lab 1: The Hardware and Software Platform
Vd v i
–Vd S3,S4
S1,S2
S1,S4 S2,S3
Figure 1.8.: PWM waveforms for i > 0 and v̄ greater (0 < t ≤ 4Tsw ) and smaller (4Tsw < t ≤ 8Tsw )
than zero. The blue lines corresponds to the average voltage v̄.
In the experimental setup used for this lab a 3-level PWM switching scheme is used to drive
the four switching cells S1 - S4 . This means v can be either negative (−Vd ), positive (Vd ) or zero.
In this lab Vd = 46 V. PWM involves turning Sk on and off at the so-called constant switching
frequency fsw = 1/Tsw . In this lab we take fsw = 30 kHz. By adjusting the on duration of the
switching cells over the switching period Tsw the average value of v can be controlled. We define a
duty cycle 0 ≤ d ≤ 1 which is the ratio of the on time to the switching period Tsw . The expression
for the average value of v over one switching period Tsw is
1 Z t+Tsw
v̄ = v(τ )dτ (1.1)
Tsw t
Since the PWM switching frequency is high, our modelling and control of the PMDC motor drive
will use average voltage v̄ as a system variable. In Section 2.6 you will compare a PMDC drive
models based on average voltage v̄ and instantaneous voltage v. This comparison proves the time
average model of the drive is sufficiently accurate.
Next, we describe the basic operation of the H-bridge converter. In the first case let’s assume
i ≥ 0. Then the following two cases can be distinguished depending on v̄ being smaller or greater
than 0 (i.e., Q I & Q II):
• v̄ ≥ 0: S1 and S4 are turned on and S2 and S3 are turned off during 0 < t ≤ dTsw where d
denotes duty cycle. Since i is positive the current flows through the MOSFETs of S1 and S4 .
During the first interval of the switching period 0 < t ≤ dTsw we have v = Vd . In the second
interval of the switching period dTsw < t ≤ Tsw , S3 is turned on while S1 is turned off (S4
remains on and S2 remains off). Due to i > 0 the current flows through the MOSFET of S4
and the diode of S3 . The motor terminals are short-circuited, hence v = 0. Using (1.1) the
8
1. Lab 1: The Hardware and Software Platform
• v̄ < 0: During the first interval of the switching period 0 < t ≤ dTsw S2 and S3 are turned
on and S1 and S4 are turned off. Since the current is greater than 0 it flows through the
body diodes of S2 and S3 , and v = −Vd . In the interval dTsw < t ≤ Tsw , S1 is turned on
while S3 is turned off (S2 remains on and S4 remains off). The current flows through the
MOSFET of S1 and the diode of S2 . Again, the motor voltage is short-circuited v = 0.
Using (1.1) the average voltage is v̄ = −dVd .
Similar analysis can be performed for the case i < 0 and v̄ ≥ 0 or v̄ < 0 (Q III & Q IV). In
summary v̄ is independent of the direction of i and the input-output relation for the H-bridge is
d · Vd , for non-negative v̄
v̄ = (1.2)
−d · Vd , for negative v̄
We remark in general the average voltage v̄ is a time varying quantity used to control the PMDC
motor. The duty cycle d and v̄ only remain constant over the switching period Tsw .
As mentioned earlier these averaged quantities are used for modelling and control design.
Therefore the bar notation is dropped in general, and v and i refer to their averaged quantities
from now on.
• Starting: Typing in simulink in the Matlab command window will open the Simulink
Library Browser shown in Figure 1.9. By selecting New from the File menu you get a
new model window which you use to build a Simulink model. This model is saved as a file
with .slx extension.
• Creating blocks: Simulink has a standard block library shown currently selected in Figure 1.9
and labelled Simulink; additionally, there are other libraries such as RTWT, Communication
System Toolbox, Control System Toolbox, etc. We will only be using the Simulink and
RTWT libraries. To create a Simulink model, you can drag and drop blocks from any of the
Libraries in the Simulink Library Browser into your model.
9
1. Lab 1: The Hardware and Software Platform
from a data line to an input or output port, press and hold the Ctrl key, and then click
on the point in the line and drag it to the port. When the ports are connected, the angle
brackets disappear and the solid arrowhead indicates the direction of signal flow as shown
in Figure 1.10. Rather than hold the Ctrl key you can also left click the block you want to
connect to and drag to the data line.
• Simulation parameters: Figure 1.11 shows the Configuration Parameters dialog with
the Solver settings selected. Launch this dialog by hitting the gear button in the menu bar
of your model window (see Figure 1.13). The simulation stop time has to be chosen to meet
the requirements of the experiment or simulation. Pick the fixed-step ode3 solver. The
fundamental sample time should always be initialized with the variable T_s. Since T_s
should also be used in the RTWT I/O blocks in the field Sample time, it is recommended
to define T_s in a script which is run before the simulation or experiment. See Figures 1.17a–
1.17c. If the Simulink model does not include RTWT blocks, configuration of the simulation
is finished. However, if RTWT blocks are involved adjustments to the Code Generation
section have to be made. As shown in Figure 1.12, under Target Selection hit the Browse
button to select a different target. In the dialog that pops up select [Link] and press
OK twice to apply the changes. Additionally, the simulation mode has to be changed from
the default Normal to External in the button area of your model window menu bar (see
Figure 1.13).
10
1. Lab 1: The Hardware and Software Platform
• Simulating: In order to simulate a standard (i.e., no RTWT blocks) Simulink model hit
the green Run button in your model window or select Start from the Simulation menu. If
a model containing RTWT blocks has to be run, use the following steps: First, build the
model by hitting the green run button in the model’s menu bar (see Figure 1.13). This
will rebuild the model (i.e., generate source code corresponding to the model and compile
it). Generally, the model has to be rebuilt whenever it was modified structurally (e.g.
signals lines deleted or rerouted). This does not include adjustments made to parameters
11
1. Lab 1: The Hardware and Software Platform
(e.g. changing parameters in the Gain, Constant or Transfer fcn block). Note that the
build process takes some time so it’s good to remember that it is not required when only
parameters in the model have been changed. In fact, you can vary model parameters while
the model is running. This is a very useful feature of RTWT as it allows the real-time
response of your system to be tuned. If the model builds successfully, it will start to
execute immediately. Important: you can hit the Stop button to terminate the program
if something does not look right. You can also turn off the power to the Interface System to
stop the system faster.
• Plotting: Generally, for plotting purposes the Scope block which is a standard block in
Simulink is used. It can be found in the Simulink library under Commonly Used Blocks.
Place the Scope in your model. Double-click the scope symbol and press the gear button
Figure 1.13.: Simulink menu bar and buttons for a model window.
12
1. Lab 1: The Hardware and Software Platform
to invoke the settings window shown in Figure 1.14. In the General Tab choose the
number of axes depending on the number of subplots you wish to create in the scope.
Select the History Tab and remove the tick from data points limitation. Check the Save
data to workspace box and leave the default settings. In standard Simulink models the
environment automatically takes care of storing all data that is visualized in the Scope.
If the RTWT kernel is involved in External mode (i.e., you are performing a physical
experiment) you have to specify the buffer length for the data to be stored. If not configured
properly data loss may occur. Configuration involves navigating to the Code menu in
the model window and pressing External Mode Control Panel. In the pop-up window
select Signal & Triggering.... You should see the window in Figure 1.15. The only
13
1. Lab 1: The Hardware and Software Platform
adjustment that has to be made in order to get the desired behavior when recording data
is the Duration field. Since the Duration field assumes a value in terms of samples you
have to take the sample time T_s and the duration of the simulation into account when
calculating the buffer length. As an example, assume T_s=1e-3 (1 ms) and the desired
simulation stop time is 10 s (T_sim=10). To avoid data loss the buffer length has to be
chosen to Tsim /Ts + 1 = 10001 samples. The one is added since the buffer would otherwise
get flushed right at the end of the simulation (10000th sample). Once a simulation is finished
you can access the scope data from the Matlab workspace. Normally data is best visualized
in Matlab and the Simulink scopes are mainly for fast access to data in real-time. As
shown in Figure 1.14, the scope data is exported to the workspace in a structure called
ScopeData by default. Assuming the number of axes was three, the following commands
should be executed to produce a plot
plot ( ScopeData . time , ScopeData . s i g n a l s ( : , 1 ) . v a l u e s , ’ x l a b e l ’ , ’ t / s ’ ) ;
hold a l l ;
plot ( ScopeData . time , ScopeData . s i g n a l s ( : , 2 ) . v a l u e s ) ;
plot ( ScopeData . time , ScopeData . s i g n a l s ( : , 3 ) . v a l u e s ) ;
• RTWT blocks: Throughout this lab you will use the Frequency Output, Encoder Input,
Analog Input, Digital Input, and Digital Output blocks that can be found in the
Real-Time Windows Target Library in the Simulink Library Browser. When you
use any of these block you must ensure that the MF634 I/O card is selected in the Data
acquisition board section of the blocks’ settings. After selecting the MF634 a dialog
box shown in Figure 1.16 will open asking for you to configure the counter/timer channels.
Configure all channels as Frequency Generator as shown in Figure 1.16. Additionally, sample
time has to be assigned consistently in every block of a model by using the sample time
variable T_s that has to be defined in the workspace.
Figure 1.16.: Time/counter setup dialog. Be sure to select all channels to use the frequency generator
functionality.
The Frequency Output block whose settings are shown in Figure 1.17a is responsible for
providing high frequency PWM signals to drive the H-bridges. In addition to selecting
the correct board hit the Board Setup button and set all frequency outputs to Frequency
14
1. Lab 1: The Hardware and Software Platform
generator. Channel 1, denoted PWMout1, drives the motor H-bridge and Channel 2, denoted
PWMout2, drives the generator H-bridge. Important: To ensure proper behavior after the
model terminates, the initial and final values for the switching frequency and duty cycle
have to be chosen as shown in Figure 1.17a. Enable the external duty cycle pin by selecting
duty source as external.
In order to read motor shaft position you will need the Encoder Input block whose settings
are shown in Figure 1.17b. Make sure all settings (except the channel selection) match
the ones in Figure 1.17b, especially the Reset input function. The channel has to be
selected consistently with the physical channel chosen for the encoder. We choose to use
Channel 1 which is denoted Encin1.
The Analog Input block shown in Figure 1.17c is responsible for capturing analog input
signals. Channel 1, denoted ADin1, is connected to the low-pass filtered current sensor
output of the motor H-bridge, ADin2 to the low-pass filtered current sensor output of the
generator H-bridge, ADin3 to the current sensor output of the motor H-bridge enabled to
measure the current transients and ADin4 to the DIN-connector for the Ball and Beam.
Make sure all settings correspond to the ones shown in Figure 1.17c.
Finally, the Digital Input and Digital Output blocks enable reading low frequency
digital signals into the MF634 and applying low frequency digital outputs from the MF634.
Some of these signals will be used with the H-bridges.
A summary of the channels used in the 5 labs is in Table 1.1.
15
1. Lab 1: The Hardware and Software Platform
(a) Frequency Output Block (b) Encoder Input Block set- (c) Analog Input Block set-
settings (PWM output). tings. tings.
Figure 1.17.: Important RTWT block settings for the MF634 I/O card.
16
1. Lab 1: The Hardware and Software Platform
Motor
H-bridge
Dout1 DIR
FF1
Dout2 PWML Din1
FF2
PWMout1 PWMH Generator
H-bridge
Dout3 DIR
FF1
Din2
FF2
PWMout2 PWMH
using the Digital Input block. As soon as a logic 1 is detected at a digital input the PWM
duty cycle of the corresponding H-bridge has to be set to zero to avoid possible damage. Faults
of the motor H-bridge are monitored at Din1 and faults of the generator H-bridge are monitored
at Din2.
In order to ensure the H-bridge is in a “drive-brake” mode (which is the usual mode used in
the labs and discussed further in the “Motor Control Options” section of Appendix A.4) it is
necessary to keep “PWML” high. Hence, be sure to set Dout2 to a high voltage. This also implies
that Initial value and Final value in the settings of the Digital Output block should be
set to 1.
When identifying the motor model parameters in Lab 2, it useful to use the so-called “coast”
mode which is enabled by setting “PWML” and “PWMH” low. This functionality should be
included in your model.
More details on the H-bridge can be found in Appendix A.4. A summary of the channels
discussed above are listed in Table 1.1.
Tasks
• Design and implement a PWM output block for the motor H-bridge in Simulink that
satisfies all requirements discussed in this section. The input of this custom block should
be the average voltage v̄. Also include a binary input for enabling “coast” mode. See
Figure 1.19 for the block diagram. Refer to Section 1.2 for how to compute duty cycle d
from this voltage. Test your PWM output block with a duty cycle of d = 0.5. Use sample
time of Ts = 1 ms. Important: include a saturation block to limit your average voltage to
24 V. This will prevent potential damage to the system.
• Test the PWM output block by applying sufficiently large voltage with both, positive and
17
1. Lab 1: The Hardware and Software Platform
Analog
Input 1/5
1
Analog Input
i
Humusoft
MF634 [auto] offset
2
calibration
C_i
negative signs and check if the motor behaves as expected. Verify your “coast” mode
functions by rotating the shaft quickly and feeling the reduced resistance.
18
1. Lab 1: The Hardware and Software Platform
Tasks
• Calibration of the parameter offset is done by applying zero output voltage across the
motor and generator terminals so that current is zero. Measure the current for a couple
of seconds. Average the signal over the measurement period and the result is the offset.
Assign this value to a variable offset in your scripts. Use sample time of Ts = 1 ms.
• Provide plots of your current measurements with and without offset compensation.
s · 2π75
D (s) = .
s + 2π75
Use this transfer function along with the other blocks shown in Figure 1.21 for your velocity
estimation. The constant K_enc calibrates the output of the encoder in pulses to units of radians.
The data sheet of the encoder in Section A provides the information required to obtain this
constant. Additionally, note that we operate the encoder in a quadruple Quadrature mode
which means that the number of counted pulses is multiplied by four (see Figure 1.17b). w_cal
represents another calibration parameter which is necessary since the differentiaton is not exact.
The differentiator gain depends on the sample time parameter T_s, and has to be recalibrated
when a different T_s is used.
Tasks
• The procedure to determine w_cal is as follows: Apply a constant (positive) voltage at the
motor terminals for a couple of seconds, set w_cal to one and measure position and velocity
of the motor shaft with the block diagram shown in Figure 1.21. After the experiment is
terminated read the steady state velocity estimate from the scope. Then, take two position
data points from the linear region of the position waveform. Determine the real value of
the velocity by computing the slope. Finally, adjust w_cal such that the velocity estimate
matches the real value of the velocity. Take care that velocity resulting from a positive
voltage being applied should be also positive by convention. Hence, a sign change may be
introduced to w_cal. Perform the computation for w_cal with two different sample times
Ts = 1 ms and Ts = 50 µs. You can use the fit(x,y,’poly1’) command to obtain the
velocity from a linear fit of the position data.
19
1. Lab 1: The Hardware and Software Platform
Encoder 2*pi*75s
Input K_enc w_cal
s+2*pi*75
E ncoder Input LP Derivitive
Humusoft Velocity
MF634 [auto]
Tasks
• Position the ball at the endpoints of the beam and record the corresponding voltages using
ADin4. Obtain a linear calibration relationship between voltage and ball position. Take the
positive ball position corresponding to positive voltage. You can use the fit(x,y,’poly1’)
command to obtain the linear relation between ball position and voltage from ADin4.
Important: be sure to keep a copy of all your models in this lab as they will be used in
subsequent labs.
20
2. Lab 2: Modelling a Permanent
Magnet DC (PMDC) Motor and
Drive
The purpose of this lab is to make you familiar with the dynamic model of the PMDC motor and
its operation with the H-bridge drive introduced in Lab 1. The motor model involves a number of
model parameters which are commonly found in data sheets supplied by the manufacturer. As an
engineer specifying a PMDC motor in some application, you will be expected to understand the
meaning of the model parameters in order to ensure your motor meets the design specifications of
your entire system. This lab will demonstrate how the values of the model parameters can be
determined from various experiments. This is useful if data sheets are unavailable or incomplete.
Most importantly however, the experiments build an appreciation of the physical meaning of the
parameters and how they affect motor performance. Lab provides an important basis for work in
subsequent labs. Hence, special care should be taken to understand its content.
Important note: Download the files relating to Lab 1 from the ECE 360 Lab eclass site.
J ω̇ = τ − τf − τl , (2.1)
where J is the effective inertia of the motor system which is due to all rotating components (i.e.,
the shaft, rotor, and encoder), ω is the output shaft velocity, τ the electrical torque generated by
the PMDC motor, τf frictional torque and τl load torque. The latter is sometimes treated as an
unknown disturbance.
The electrical torque τ generated by the PMDC motor is linearly related to the armature
current i:
τ = Kt i, (2.2)
21
2. Lab 2: Modelling a Permanent Magnet DC (PMDC) Motor and Drive
R L
i
+ +
ω, τ τf , τl
v eA − Jl
+ Js
− −
Figure 2.1.: Electro-mechanical equivalent circuit of PMDC motor. The inertia of the shaft is Js and
load Jl . The effective inertia of the system J = Js + Jl .
where Kf is the Coulomb friction torque, b the viscous friction coefficient, and
−1,x<0
sgn(x) = 0, x = 0
1, x > 0
dω
J = Kt i − bω − Kf − τl (2.4)
dt
The dynamics for armature current i can be found by application of KVL and is given by
di
L + Ri = v − Km ω, (2.5)
dt
v is the input voltage, Km the motor’s back-emf constant, L armature inductance and R armature
resistance. We denote the back-emf voltage as eA = Km ω. It can be shown that Km = Kt if stated
in MKS units. Hence, to simplify notation we replace Km with Kt from here on. Differential
equations (2.4) and (2.5) give the time domain dynamic model of the PMDC motor for ω > 0.
In order to reduce current ripple we add an additional external inductor L1 to the armature
circuit. This is discussed further in Section 2.5. The external inductor introduces a parasitic
22
2. Lab 2: Modelling a Permanent Magnet DC (PMDC) Motor and Drive
resistance R1 which adds to the armature resistance of the motor. The model parameters L and
R discussed above will include the circuit parameters of the external inductor. The values used
are L1 = 3.3 mH and R1 = 1.27 Ω. These values are taken from the data sheet in Appendix A
(Model No. 1130-332K-RC).
Depending on the sign of ω and τ the motor operates in four different modes that are denoted
as quadrants Q I, Q II, Q III, and Q IV. The forward motoring mode or Q I occurs when ω and
τ are positive. Consider a motor driving an inertial load which accelerates from rest in a positive
direction. During this period of acceleration eA and i are greater or equal to zero or in other
words power is transferred from the voltage source to the mechanical load.
Now consider the problem of decelerating the motor from a positive velocity to rest. This
process of braking requires a negative electrical torque which means a negative i which can be
obtained by adjusting v < eA . Initially ω, and therefore eA , remain positive until rest. Hence,
the motor is operating in forward braking mode or Q IV. Since τ · ω < 0, power is absorbed into
the voltage source from the mechanical system. As expected eA · i < 0 since the voltage source
absorbs power.
The two aforementioned modes of operation can be also explained if the motor is turning in
negative direction. This corresponds to reverse motoring (Q III) and reverse braking (Q II).
Evidently, in generating modes Q II and Q IV the motor transfers power from the mechanical
system to the voltage source. In contrast, in Q I and Q III the motor is in motoring mode since
power is fed to the mechanical system from the voltage source.
23
2. Lab 2: Modelling a Permanent Magnet DC (PMDC) Motor and Drive
determined by exciting the electrical subsystem by an input voltage v such that output angular
velocity ω remains zero. This is possible due to the non-zero friction at zero velocity provided |v|
is sufficiently small. Furthermore the PMDC motor has no disturbance load (i.e., τl = 0). Under
these assumptions and in steady state R is determined by
v
R= , (2.6)
i
Tasks
• Modify the script armature_resistance, which includes code to calibrate the current
measurement, to estimate R ten times and average the values obtained for R in every run.
Set the average voltage to v = 2.5 V to obtain your current measurements and rotate the
shaft to obtain a range of measurements. The reason for this are the brushes that make R
dependent on the rotor position. Discard measurements that indicate extraordinary high
resistance values and repeat them at a different angle. You should attach a gear to the
shaft so that you can prevent the motor from rotating.
• Compare your result to the reference value provided in the motor data sheet and take
the parasitic resistance of the smoothing inductor into account. See Section A and motor
No. 353239.
In the next step the coefficients of the friction model (2.3) are determined. This can be accom-
plished by means of (2.4) and if torque constant Kt and armature resistance R are known. Then,
under the assumption of steady state conditions, ω > 0, and an unloaded shaft (τl = 0) (2.4)
becomes
Kt i = Kf + bω. (2.8)
24
2. Lab 2: Modelling a Permanent Magnet DC (PMDC) Motor and Drive
In order to obtain values for b and Kf we excite the motor with a range of voltages and measure
the current and speed. Using (2.8) and averaging the measurements, we can obtain an estimate
for b and Kf . Figure 2.3 shows a sample identification of b and Kf . The values given there might
not be the same as your motor. and data obtained from a sample experiment using e.g. fit.
Tasks
• Modify the script torque_constant, which performs current calibration using the model
experiment_i.slx, to compute the torque constant Kt . The script torque_constant relies
on the model exp2_torque_constant.slx to obtain necessary measurements. Insert the pre-
viously determined value for R in the script
torque_constant. Determine the duty cycle required to apply an average constant voltage
of v̄ = 24 V. Compute Kt by averaging i and ω and using (2.8).
• Compare your result for Kt to the reference value provided in the data sheet in Section A.
• The script friction_coefficients collects the data for ω and i. Modify the script
friction_coefficients to perform a linear curve fit for Kf and b. For example, you can
use Matlab’s fit.
1.25
1.00
τf (mN m)
0.75
0.50
0.25
Figure 2.3.: Friction torque sample data. First order polynomial curve fitting yielded Kf = 0.9677 mN m
and b = 4.1 × 10−4 mN m s.
25
2. Lab 2: Modelling a Permanent Magnet DC (PMDC) Motor and Drive
ω measured
600 Curve fit
ω (rad s−1 )
400
200
0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
t (s)
Figure 2.4.: Inertia experiment waveform and curve fitted linear model.
To estimate J we initially operate the PMDC motor at some steady state velocity ω. In order
to see a full transient deceleration we choose the initial velocity corresponding to the nominal
v = 24 V. At some instant the voltage supply is disconnected from the motor terminals. We
assume that armature current i instantly vanishes. This is a valid assumption since the time
constant of the electrical system is much smaller than the time constant of the mechanical
subsystem. From (2.4), after we disconnect the power supply the dynamics of the mechanical
subsystem dominate and are governed by the differential equation
For simplicity if we take b as negligible then for ω > 0, the solution to (2.9) with b = 0 is given
by
Kf
ω (t) = ω0 − (t − t0 ) (2.10)
J
where ω0 denotes the initial velocity before the power supply was disconnected at instant t = t0 .
Throughout the experiment ω is captured (see Figure 2.4). This is followed by a curve fit to the
linear model (2.10).
Tasks
• Complete the script moment_of_inertia with your previously determined value for Kf and
make sure the parameters in the Calibration section are defined. Identify J by performing
a linear curve fit and (2.10).
26
2. Lab 2: Modelling a Permanent Magnet DC (PMDC) Motor and Drive
• Compare your results to the values provided in the data sheets in Appendix A.
di
L + Ri = v − eA (2.11)
dt
The solution to this differential equation can be obtained assuming unipolar PWM and constant
eA :
− τt Vd −eA − τt
Imin ·e + 1−e , 0 < t ≤ dTsw
e e
R
i (t) = t−dTsw
t−dTsw
(2.12)
Imax
· e− τe − eA
R
1 − e− τe , dTsw < t ≤ Tsw
where τe = L/R is an electrical subsystem time constant. Figure 2.5 shows the values of Imin and
Imax . The non exponential shape of the current waveform in Figure 2.5 will be explained later.
Since eA was assumed constant, this implies constant average armature current. This in turn
requires zero average voltage drop across the inductor. In order to comply with these assumptions
Vd
Imin
Imax
0
dTs Ts 2Ts 3Ts 4Ts t
27
2. Lab 2: Modelling a Permanent Magnet DC (PMDC) Motor and Drive
d has to satisfy
eA + iR
d= (2.13)
Vd
where
Vd − eA
− dTτsw dTsw
Imax = Imin · e e + 1 − e− τe (2.15)
R
eA
− Tsw −dT sw − Tsw −dT sw
Imin = Imax · e τ e − 1−e τe . (2.16)
R
It can be shown that the maximum ripple ∆Ippm occurs if d = 1/2. In this case the ripple current
is given by
Tsw
Vd 1 − e− 2τe
∆Ippm = · . (2.17)
R 1 + e− T2τswe
In practical applications (2.17) can be simplified because the PWM switching frequency is chosen
such that Tsw < τe . Then the maximum ripple current is given as
Vd Tsw
∆Ippm = (2.18)
4L
The relation Tsw < τe is also the reason for the triangular current waveform in Figure 2.5. Suffi-
ciently high switching frequency ensures that the current stays within the linear region of the
exponential. The validity of Tsw < τe for our experimental setup can be shown since fsw = 30 kHz:
τe = 3.85 mH
5.26 Ω
= 526 µs, Tsw = 1/fsw = 33.3 µs.
Tasks
• Connect the BNC connection labelled “OSC” on the interface box to a scope to measure
the unfiltered current waveform. Run armature_inductance and measure measure the
∆Ippm and compute L by means of (2.18). The output of “OSC” is a voltage which must
be converted to current in Amps. The gain for this conversion is 0.2 A/V. You must use
this gain when calculating your value for ∆Ippm .
• Compare your result to the armature inductance value provided in the data sheets in
28
2. Lab 2: Modelling a Permanent Magnet DC (PMDC) Motor and Drive
Section A. The external inductor is manufactured by Bourns and has a model number
1130-332K-RC.
Kt sL+R
LJ LJ Kf
Ω(s) = K2
V (s) − K2
. (2.19)
s2 + sR + t
s + sR
2 + LJt s
L LJ L
Since for most motors τe = L/R 1, we obtain an approximate first order model
1 R
Kt Kt2 Kf
Ω(s) = JR V (s) − JR (2.20)
Kt2
s +1 Kt2
s +1 s
Defining the gain KV = 1/Kt and mechanical time constant τm = JR/Kt2 , we can transform
(2.20) into a standard time constant format
R
KV Kt2 Kf
Ω(s) = V (s) − (2.21)
τm s + 1 τm s + 1 s
Tasks
• Collect the velocity response using the script and model from Experiment IV where a
v = 24 V input was applied.
• Implement a Simulink model for the 1st and 2nd order models described above. You can
perform this simulation after the lab and the results will be included in the lab report. Use
a constant input voltage of v = 24 V. You should run these Simulink models from a script
which defines your model parameters.
• Compare these simulation plots with experimental data for the velocity response.
• Compare the open-loop no-load steady state velocity to the one provided in the data sheet
in Appendix A.
29
3. Lab 3: Closed-loop Speed Control
for a PMDC Motor
In this lab we consider two closed-loop velocity controls for the PMDC motor:
The design method used in this lab involves time domain specification formulas for the transient
response of second order systems and the notion of System Type. The goal is to perform two
control designs for regulating constant velocity references while rejecting constant load torque
disturbances.
Although current mode requires a measurement of armature current, it is a common choice
of velocity control structure for PMDC motors for a number of reasons. It is based on a two
loop controller structure where an inner loop controls current and an outer velocity loop provides
the reference current to the inner loop. Current Mode control is popular since the outer loop
can readily limit the armature current reference fed to the inner loop. This provides a means to
prevent overcurrent situations (e.g. during startup when inertia is large) which can damage the
PMDC drive, motor, and attached loads. The Current Mode control admits a relatively simple
design since two designs are performed on lower order subsystems. As well, controller tuning
is simplified since it is performed subsystem-at-a-time. Moreover the inner current control can
be used to implement torque control of a PMDC motor. Current mode also shows performance
improvement in face of voltage dead-zone which exists in H-bridge amplifiers.
30
3. Lab 3: Closed-loop Speed Control for a PMDC Motor
Electrical Subsystem
The dynamics of the electrical subsystem of the PMDC motor are given by
di
v − eA = R · i + L (3.1)
dt
Taking the Laplace transform of (3.1) assuming zero initial conditions yields
For the problem of current control we denote V as the control input, I as the controlled output,
and EA as a disturbance input. Although we measure velocity and therefore could compute
EA , this would complicate the current control. The objective of current control is to regulate a
prescribed reference current I ∗ while rejecting disturbance input EA . Solving for I in (3.2) gives
1 1
I(s) = V (s) − EA (s) (3.3)
sL + R sL + R
I(s) K
Pi (s) = = , (3.4)
V (s) τe s + 1
where τe = L/R is the electrical subsystem time constant and K = 1/R the gain of the electrical
subsystem.
Mechanical Subsystem
According to Section 2.1 the dynamics of the mechanical subsystem obey Newton’s Law. Hence,
taking the Laplace transform of (2.4) and assuming the current dynamics are negligible (i.e.,
τe = L/R ≈ 0) yields
Kf
sJΩ(s) = Kt I(s) − − Tl (s) ω > 0. (3.5)
s
Here, Ω is treated as the system output whereas I is the control input. Static friction Kf /s is
assumed to be negligible. Load torque Tl represents an unknown disturbance which should be
31
3. Lab 3: Closed-loop Speed Control for a PMDC Motor
ei v
i∗ Ci Pi i
− −
eA
Kt 1
Ω(s) = I(s) − Tl (s) (3.6)
sJ sJ
The control design for the outer loop is based on the transfer function
Ω(s) Kt
Pω (s) = = . (3.7)
I(s) Js
V (s) kp s + ki
Ci (s) = = (3.8)
Ei (s) s
where kp is the proportional gain, ki the integral gain, and ei = i − i∗ denotes current error, where
i∗ is the current reference. Figure 3.1 depicts the current control with PI-controller.
Tasks
• Derive the closed loop transfer function of the current control loop by neglecting the
disturbance and bring it into standard form:
ωn s
αζ
+ ωn2
Hi (s) =
s2 + 2ζωn s + ωn2
32
3. Lab 3: Closed-loop Speed Control for a PMDC Motor
• Run an experiment with the actual physical system using the same controller and reference
step input. Pick sample time Ts = 50 µs. Important: Current increases fast so take care
that the simulation time is limited to a maximum value of 10 ms. If you do not limit
the simulation time the motor will accelerate until the velocity saturates. This can cause
irreversible damage to the brushes and has to be avoided. Collect and plot experimental
data of the current step response.
• In order to improve the step response PO we reduce the value of ki . Attempt to find a
value of ki which reduces PO to about 10 %.
• Simulate the current control system shown in Figure 3.1 in Simulink using the transfer
function model (3.4). For the controller, use Simulink’s built-in PID block and set the
derivative gain to zero to realize the PI controller. Perform the simulation with a step
i∗ = 1 A. Plot the current response using the same gains as the previous step.
• Introduce a Transport Delay block in front of your transfer function block for Pi . Use a
Time delay value of around 5 · Ts so that the experimental and simulated curves coincide.
The Transport Delay models delay introduced by the control system (i.e., AD and PWM
output delays). Plot the step response using the same gains as the previous step.
k̄p s + k̄i
Cω (s) =
s
33
3.
3. Lab
Lab 3:
3: Closed-loop
Closed-loop Speed Control for
Speed Control for aa PMDC
PMDC Motor
Motor
τl
e i∗ i τe −
ω ∗ Cω Hi (s) ≈ 1 Kt 1/(Js) ω
−
• Derive note:
Important The loop
the closed following designs
transfer should
function be carefully
of the velocity saved
controlforloop
future labs whereHyou
by assuming i (s) will
=1
be required to reuse the
and neglecting the designs.
disturbance torque. Bring it into standard form
ωn s
Tasks + ωn2
Hω (s) = 2 αζ
+ 2ζω
• Derive the closed loop transfer function ofsthe velocity ωn2
n s + control loop by assuming Hi (s) = 1
and neglecting the disturbance torque. Bring it into standard form
• Identify α, ζ and ωn in terms of k̄p , k̄i , Kt , and J.
ωn s 2
√ αζ + ωn
Hωζ(s)
• Design the PI controller such that == 1/ 22 and ωn = 2π2 · 25 rad s−1 .
s + 2ζωn s + ωn
• Simulate the velocity control system shown in Figure 3.2 with Hi (s) = 1 in Simulink
using the transfer function model (3.7). For the controller, use the PID block and set the
• Identify α, ζ and ωn in terms of k̄p , k̄i , Kt , and J.
derivative gain to zero to realize the PI controller. Perform the simulation with a step
∗ √
• ω
Design the
= 200 PIs−1
rad controller
. Plot thesuch that ζresponse.
velocity = 1/ 2 and ωn = 2π · 25 rad s−1 .
•• Implement
Simulate the thevelocity
completecontrol
cascadesystem shown
control in Figure
system 3.2 with Combine
in experiment. Hi (s) = 1thein PI velocity
Simulink
using the transfer function model (3.7). For the controller, use the PID block and set3.1.2.
controller used in the previous item with the PI current control designed in the Section the
∗
derivativethe
Perform gain to zero towith
experiment realize theωPI
a step 200 rad s−1 .Perform
=controller. the simulation
Superimpose with
the velocity a step
response
ω ∗ = the
with rad s−1 . Plot
200 simulated onethe
on velocity response.
a time scale which shows the transient performance. Comment
on any differences in velocity tracking performance relative to the previous item.
• Implement the complete cascade control system in experiment. Combine the PI velocity
controller the
• Compute usednumerical
in the previous item
value of α. with
Whatthe PIyou
can current controlthe
say about designed
impactinofthe
theSection
zero on3.1.2.
the
Perform
PO in thethe experiment
step response?with a step ω = 200 rad s . Superimpose the velocity response
∗ −1
33
34
3. Lab 3: Closed-loop Speed Control for a PMDC Motor
• Design an input feed forward filter that cancels the zero of the velocity control loop transfer
function. Its transfer function is given as follows:
ωn2
ωn s
αζ
+ ωn2
Now add this feed forward filter to your control system model in Simulink and repeat the
simulation. Provide a plot of the velocity step response.
• Test your velocity control system with feed-forward filter in an actual experimental setup.
Pick Ts = 50 µs. Collect and plot data of two velocity step responses with ω ∗ = 200 rad s−1
and ω ∗ = 500 rad s−1 and compare it to your previously obtained simulation result.
We assume Kf = 0. In (3.9) KV = 1/Kt and τm = JR/Kt2 . From (3.9) the transfer function
model is obtained:
Ω(s) KV
Pω,V (s) = = (3.10)
V (s) τm s + 1
Figure 3.3 shows the closed-loop velocity control system in Voltage Mode. Unlike in Current
Mode, here the PI controller
kp0 s + ki0
Cω,V (s) =
s
with proportional gain kp0 and integral gain ki0 directly generates a voltage that is fed to the motor.
Important note: The following designs should be carefully saved for future labs where you will
be required to reuse the designs.
35
3. Lab 3: Closed-loop Speed Control for a PMDC Motor
τl KRt
−
e v
ω∗ Cω,V Pω,V ω
−
Tasks
• Derive the closed loop transfer function of the velocity control loop shown in Figure 3.3 by
neglecting the disturbance torque. Bring it into standard form
ωn s
αζ
+ ωn2
Hω,V (s) =
s2 + 2ζωn s + ωn2
• In order to compare with the Current Mode design take the gains of the PI controller kp0
√
and ki0 such that ζ = 1/ 2 and ωn = 2π · 25 rad s−1 .
• Compute α and provide a solution to minimize the PO. Implement it in Simulink and run
and identify
theα, ζ and again.
simulation ωn inCould
kp0 , kthe
0
i , τm
PO, and KV . and why?
be minimized
• In order •toRun
compare withwith
an experiment thethe
Current Modesystem
actual physical design take
using the controls
the same gains of andthe PI controller
reference
step inputs. √
Pick T = 50 µs. Collect and plot experimental data of the step response.
and ki0 suchCompare
that ζyour 2 and ω .
rad s−1results
s
= 1/
experimental n = to
results · 25
2πthe simulation from the previous task.
• Implement• Inand
a lastsimulate thethevelocity
step compare control
experimental systemfrom
results obtained shown in Figure
the Voltage 3.3 in Simuli
Mode velocity
using the transfer function model (3.9). For the controller, use the PID block and set t
control to the ones from the Current Mode velocity control.
derivative gain to zero to realize the PI controller. Perform the simulation with a st
ω ∗ = 200 rad s−1 .
• Compute α and provide a solution to minimize
36 the PO. Implement it in Simulink and r
the simulation again. Could the PO be minimized and why?
4. Lab 4: Disturbance Rejection and
Advanced PI Control
This lab includes three experiments which investigate
• a motor-generator setup where the generator applies a controlled load torque. We investigate
the disturbance rejection performance of a closed-loop motor velocity control.
• an advanced PI control for velocity which reduces the negative effect of a saturated PI
controller.
• a position controller which is based on the velocity controls you performed in Lab 3.
I(s) K
Pi (s) = = , (4.1)
V (s) τe s + 1
Tl (s) Kt K
Pτl (s) = = (4.2)
V (s) τe s + 1
The generator is an identical copy of the PMDC motor but without an attached encoder. Hence,
its plant parameters are the same as those of the PMDC motor determined in Lab 2.
Tasks
37
4. Lab 4: Disturbance Rejection and Advanced PI Control
Coupling
Motor
Generator
Encoder
• Write down the closed-loop disturbance to velocity transfer function into a form
Ω (s) As
Hd (s) = = 2 (4.3)
Tl (s) s + 2ζωn s + ωn2
Use the current mode control you derived in Section 3.1.3 where the dynamics of the current
loop are neglected. Express ωn , ζ, A in terms of Kt , J, k̄i , k̄p .
• What is the System Type relative to the disturbance input τl ?
• When determining your k̄p and k̄i use the same design as in Section 3.1.3 but take twice
the inertia used there to model combined inertia of the PMDC motor-generator. Compute
mp , tp , and ts .
• Simulate the velocity control system with a step load torque disturbance. You can ignore
the inner loop current control in your simulation.
Take a pulse waveform load torque disturbance with amplitude of 35.2 mN m (1 A), frequency
0.1 Hz, and 50 % duty cycle. In the Pulse Generator settings use a Phase delay of 5 s
to allow the motor to reach a steady-state velocity before a load torque is applied. Use a
reference velocity of 300 rad s−1 . Record the output velocity and current waveforms. Also,
determine settling time, peak time, and minimum value of the velocity response.
• Use the current control you designed in Section 3.1.2 to implement a torque control loop
for the generator system. No modifications to your design is required since τe and K are
the same as in the PMDC motor.
• Run the experiment under the same conditions as the simulation. Extract settling time,
peak time, and minimum value from the velocity response. Compare the results with the
simulation.
38
4. Lab 4: Disturbance Rejection and Advanced PI Control
Tasks
• Edit your Simulink model from Experiment I to include antiwindup in the velocity PI
controller for the motor. Follow the block diagram in Figure 4.4.
• Take a constant load disturbance of i∗ = 1 A for the generator (i.e., rated load for the
ei u us
i∗ PI e−sTtot Pi i
− −
eA
Figure 4.2.: Block diagram of saturated PI control with plant containing a delay.
39
4. Lab 4: Disturbance Rejection and Advanced PI Control
2
Unsaturated
1.5 Saturated
i (A)
1
0.5
0
18 19 20 21 22 23 24 25 26
80
Unsaturated
60 Saturated
uI (V)
40
20
0
18 19 20 21 22 23 24 25 26
60
Unsaturated
us − u (V)
40 Saturated
20
0
18 19 20 21 22 23 24 25 26
t (ms)
Figure 4.3.: Closed-loop step responses of saturated and unsaturated PI controller. The saturated
controlled shows the characteristic of integrator windup: longer periods of overshoot and longer
settling time.
motor). Use a 2 A saturation level for your anti-windup velocity PI controller. Use a step
input reference for motor velocity which starts at 100 rad s−1 and moves to 400 rad s−1 at
t = 1 s.
• Run the experiment with an anti-windup gain ka = 0. Then run with ka = ki initially, and
tune ka to optimize the transient velocity response PO to about zero.
Once you have tuned the anti-windup scheme plot the following responses for both the
ka = 0 and tuned ka cases: the velocity response, integral (I) component of the controller
output ui , and the difference across the saturation block u − us . Combine the three graphs
40
4. Lab 4: Disturbance Rejection and Advanced PI Control
uP
kp
ei u us
1
uI
ki s
−
ka
τl
−
τ
P ω Pθ θ
−
i∗ ω∗ e
Kt · Hi Hω C θ∗
Figure 4.5.: Block diagrams of cascade position control based on Current Mode velocity controllers.
If we assume the inner loops are tracking their references perfectly, the position control is based
on single integrator model
Θ(s) 1
Pθ (s) = = (4.4)
Ω(s) s
41
4. Lab 4: Disturbance Rejection and Advanced PI Control
Θ(s) 1
Hθ (s) = ∗
= (4.5)
Θ (s) 1 + s/kp
which has a DC gain of 1 for perfect step reference tracking and a bandwidth of kp . We choose
kp = 2π · 5 for a bandwidth of 5 Hz.
Task
• Verify your position controls in experiment. Use the Current Mode Design you performed
in Lab 3, Section 3.1. This controller was used in Experiment I of this lab. Use a pulse
waveform position reference with amplitude of 30°, frequency 1 Hz, and 50 % duty cycle.
Use the load torque controller you designed in Experiment I of this lab to apply a torque
disturbance to the PMDC motor shaft. For a reference torque use a pulse waveform with
amplitude of 35.2 mN m (1 A), frequency 0.1 Hz, and 50 % duty cycle. Provides plots of θ,
current i, and velocity ω.
42
5. Lab 5: Controlling the Ball and
Beam using Root Locus and
Frequency Domain Methods
5.1. Transfer Function Modeling of the Ball and Beam
The Ball and Beam system is shown in Figure 5.1. It consists of a two link mechanism which is
coupled to the PMDC motor. We refer to the link of length `1 as the “Beam” on top of which a
steel ball can roll. One side of the beam is attached to a fixed support which allows the beam
to rotate in a vertical plane. We define the angle of rotation as α. The purpose of the Ball and
Beam system is to control the position ξ of the ball on the beam by varying motor shaft position
θ. This is possible since one end of the second link of length `2 is attached to the shaft of the
PMDC motor. The other end of the second link is connected to the Beam. Hence, by varying
motor shaft position θ we can vary α. Non-horizontal beam configurations α 6= 0 imply gravity
acts on the ball and this allows us to control its motion.
In this section we derive a transfer function model of the Ball and Beam. We treat the system
input as motor position θ and ball position ξ as the system output. Effectively we take an two
loop controller structure as in Current Mode control in 3. But here ball position ξ is the outer
loop output and θ is the inner loop output (and outer loop input). For the inner loop we chose
the Current Mode position controller from 4 to track θ.
Neglecting friction between the ball and beam, Conversation of Energy gives
V = Kt + Kr , (5.1)
where V is potential energy of the ball due to gravity, Kt is translational kinetic energy of the
ball, and Kr is rotational kinetic energy of the ball. Using (5.1) we have
1 1
mg ξ sin α = mv 2 + Jb ω 2 (5.2)
| {z } |2 {z } |2 {z }
V Kt Kr
where m is mass of the ball, g is gravitational acceleration, ξ is the ball position on the beam,
v = ξ˙ is velocity of the ball’s center of mass, Jb is moment of inertia of the ball and ω is angular
43
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency Domain Methods
ℓ1
ξ
α
Beam
y
b
ℓ2
Beam support
a
r θ
x
Gear
velocity of the ball. We define ξ = 0 at the middle of the beam. Since the ball rotates without
slipping ω = v/R where R is the radius of the ball.
Differentiating (5.2) with respect to ξ yields the force equation
!
Jb dv 2
mg sin α = m + 2 (5.3)
R dξ
where the differential dξ can be rewritten as dξ = v dt. Substituting this into (5.4) yields
!
Jb ¨
mg sin α = m + 2 ξ. (5.5)
R
ξ¨ is the acceleration of the ball’s center of mass. We remark mg sin α corresponds the component
of gravitational force in ξ-direction.
44
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency Domain Methods
Since the control input to the ball-beam system is the rotational position of the motor shaft θ,
we require a relation between beam angle α and θ. To achieve this we use the (x, y)-coordinate
system shown in Figure 5.1. We define a vector to the position where the beam assembly attaches
to the gear and a vector b which points to the end of the beam. We have
q
where kpk = p21 + p22 , p = (p1 , p2 ) ∈ R2 denotes the Euclidean norm. Combining (5.6) - (5.8)
yields an expression relating α to θ:
The expression (5.9) can be solved for α and is nonlinear in θ. To obtain a linear model we derive
an approximate linear relationship using a small angle assumption sin θ ≈ θ and cos θ ≈ 1:
r
α= θ (5.10)
l1
!
Jb
mgα = m + 2 ξ¨ (5.11)
R
Substituting (5.10) into (5.11) yields the equation of motion for the system output ξ in terms of
the system input θ:
mgr
ξ¨ = θ (5.12)
l1 m + RJb2
45
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency Domain Methods
m 65.9 g
g 9.81 m s−2
`1 42.5 cm
R 1.27 cm
r 1.27 cm
Table 5.1 contains the parameters of the Ball and Beam system. Note that the inertia of a ball
about its centre is Jb = mR2 2/5
Since the bandwidth of the motor position loop was designed to be 5 Hz we take 1/τθ = 2π·5 rad s−1 .
In the experimental validation of our design we use the current mode-based inner motor position
loop (5.14) designed in Lab 4, Section 4.3. The closed-loop system used for design is shown in
Figure 5.2. Later in Experiment II, Section 5.3 we repeat the control design for Ball and Beam
e θ∗ 1 θ
ξ∗ C Pθ = τθ s+1 Pbb ξ
−
Figure 5.2.: Cascaded ball position control system (velocity and current loop not shown).
46
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency Domain Methods
1 + τ αs s−z
C(s) = K = αK = K̄ C̄(s), α > 1, τ, K > 0 (5.15)
1 + τs |{z} s−p
K̄
α−1
φm = arg(C(jωm )) = arcsin
α+1
which occurs at
1
ωm = √ . (5.16)
ατ
√
|C(jωm )/K| = α
The bode magnitude and phase plots are shown in Figure 5.4.
Tasks
• We use root locus design to place a pair of complex conjugate dominant closed-loop poles at
a desired location. These two poles will determine the response of the closed-loop system.
Clearly, the closed-loop system is 4th order and it is therefore essential that we verify the
two remaining poles be either canceled by a zero or be far into the LHP (i.e., fast). We
choose the dominant pole pair to have the following parameters
– a damping ratio ζ = 0.7
– and natural frequency ωn = 1.2 rad s−1 .
Determine the real and imaginary parts of these poles. We remark that ωn = 1.2 rad s−1 is
chosen sufficiently lower than the inner motor position loop bandwidth of 5 Hz.
47
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency Domain Methods
30
26
20 · log α
C(s) / dB
20
√
20 · log α
13
10
0
90
ωm
arg(C(s)) / °
60
30 φm
z p
0
10−3 10−2 1
ατ
10−1 √1
ατ
1
τ
101 102
ω / rad s−1
We choose the zero of (5.15) as z = −1/(ατ ) = −1/2 which pulls the uncompensated root
locus sufficiently far into the LHP. This leaves the design of the pole p = −1/τ and gain K
of C to be determined.
The design method ensures that a pair complex conjugate closed-loop poles lies on the
system’s root locus. This is guaranteed by using the phase condition
48
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency Domain Methods
Im
sd
Im(sd)
𝜙 (2)
Re
-1/𝜏𝜃 p r1 z
r2
Since
we require the phase contribution φ = arg(s − p) from the pole of C to satisfy (5.17). Hence,
where sd denotes the desired pole location. Use (5.18) to determine a value for φ.
• Use the magnitude condition to determine the lead controller gain. That is
¯ = 1
K̄ (5.19)
|Pθ (sd ) · Pbb (sd ) · C̄(sd )|
49
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency Domain Methods
• Compute the root locus of the system and verify that your root locus passes through the
point sd . Compute the closed-loop poles and zeros. Are the poles at sd dominant? Use
Matlab’s rltool command and related features to execute this task. For example to obtain
a root locus of L(s) = 1/(s + 1) we use the command
s=t f ( ’ s ’ ) ;
r l t o o l ( 1 / ( s +1) )
• Compute the closed-loop output step response of the system by simulation. Use the first
order system Pθ to simulate the inner motor position control loop. Use a step reference
input of amplitude 0.1 m.
Collect trajectories for the ball position ξ, reference ball position ξ ∗ , and motor position θ.
• Using the same model as in the simulation, implement your design in experiment and obtain
the output step response for the same reference used in simulation above. Use the current
mode-based inner motor position loop (5.14) designed in Lab 4. For safety, add a ±75°
saturation block after you lead controller to limit the motor angle reference.
Provide plots of ball position ξ, desired ball position ξ ∗ , motor position θ, voltage input
v, and current i. Superimpose your simulation results for ξ and θ on your experimental
results.
Use subplot to plot your graphs on one figure and superimpose your experimental graphs
on those obtained in simulation.
Tasks
50
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency Domain Methods
The design is performed by considering the definition of the desired phase margin
The procedure to compute the lead controller uses (5.20) with PMd = 35° and ωcg =
π · 1 rad s−1 and the constraint ωm = ωcg . We obtain
α−1
arcsin − arctan(τθ ωcg ) = PMd = 35° (5.22)
α+1
The relation (5.22) determines a value for α. Next, from (5.21) we can compute K since
Kbb 1 √
|Pbb (jωcg )Pθ (jωcg )C(jωcg )| = 2
q K α=1 (5.23)
ωcg τθ2 ωcg
2 +1
• Validate your design by plotting the Bode magnitude and phase of C · Pbb Pθ . Show the
phase margin is obtained. To perform this step use the Matlab command tf and bode.
For example you can obtain the bode plots of 1/(s + 1) using
s=t f ( ’ s ’ ) ;
bode ( 1 / ( s +1) ) ;
Once the Bode plot appears in the figure window, you can right click and choose
Characteristics → All Stability Margins.
• Determine the closed-loop bandwidth using the Matlab command bandwidth. How does
it compare with the crossover frequency?
• Use Simulink to implement the closed-loop position control system for the Ball and Beam.
Use a step reference input of 10 cm and plot the closed-loop step response.
Provide plots of ball position ξ, reference ball position ξ ∗ , and motor position θ. Use
subplot to plot your graphs on one figure.
• Create a Simulink model to validate your design experimentally. We use the motor position
control from Lab 4 as an inner loop. We suggest that you confirm the operation of this
motor position control before you add your Ball and Beam position control outer loop.
Obtain the output response for the same reference input as in the previous item.
51
5. Lab 5: Controlling the Ball and Beam using Root Locus and Frequency Domain Methods
Provide plots of ball position ξ, desired ball position ξ ∗ , motor position θ, voltage input v, and
current i. Use subplot to plot your graphs on one figure and superimpose your experimental
graphs on those obtained in simulation. Compare the simulated and experimental responses.
52
A. Appendix: Datasheets
A.1. A-max 32 motor
53
-max 32 ∅32 mm, Graphite Brushes, 20 Watt
High Power
maxon -max
M 1:2
Stock program Part Numbers
Standard program
Special program (on request)
Mechanical data (sleeve bearings) maxon Modular System Overview on page 20–25
23 Max. permissible speed 6000 rpm
24 Axial play 0.12 - 0.22 mm Planetary Gearhead Encoder MR
25 Radial play 0.012 mm ∅32 mm 256 - 1024 CPT,
26 Max. axial load (dynamic) 5.0 N 0.75 - 6.0 Nm 3 channels
27 Max. force for press fits (static) 110 N Page 272–277 Page 320
(static, shaft supported) 2000 N Spur Gearhead Encoder HED_ 5540
28 Max. radial load, 5 mm from flange 10.5 N ∅38 mm 500 CPT,
0.1 - 0.6 Nm 3 channels
Other specifications Page 282 Page 326/327
29 Number of pole pairs 1 Spindle Drive
30 Number of commutator segments 13 ∅32 mm Recommended Electronics:
31 Weight of motor 240 g Page 301–303 ESCON 36/2 DC Page 342
ESCON Module 50/5 343
Values listed in the table are nominal. ESCON 50/5 344
Explanation of the figures on page 79. ESCON 70/10 344
EPOS2 24/2 350
Option EPOS2 Module 36/2 350
Sleeve bearings in place of ball bearings EPOS2 24/5, EPOS2 50/5 351
EPOS2 P 24/5 354
EPOS3 70/10 EtherCAT 357
MAXPOS 50/5 360
Notes 22
144 maxon DC motor April 2014 edition / subject to change
A. Appendix: Datasheets
55
Encoder HEDL 5540 500 CPT, 3 Channels, with Line Driver RS 422
Cycle C = 360°e
Pulse P = 180°e
UHigh
maxon sensor
Channel A
ULow
Phase shift 90°e
UHigh
Channel B
ULow
UHigh
Channel I
ULow
s3 s4 s1 s2 s 1..4 = 90°e
∆ s < 45°e
Line receiver
Output signal EIA Standard RS 422 VCC
2 VCC Recommended IC's:
driver used: DS26LS31 2 1 3 GND GND - MC 3486
4 N.C. - SN 75175
Phase shift Φ 90°e ± 45°e 5 Channel A
- AM 26 LS 32
Signal rise time 6 Channel A Channel A
(typically, at CL = 25 pF, RL = 2.7 kΩ, 25 °C) 180 ns 7 Channel B R
The index signal Ι is synchronized with channel A or B. Terminal resistance R = typical 120 Ω
57
NT
IA
PL
CO
M High Current Chokes
HS
Ro
†
1130 Series
Special Features L (µH) DCR Dim. Dim.
• Very high current capacity Part ±20 % Ω I, dc* C D
• Low DCR Number @ 1 KHz Max. (A) Approx. Nom.
• Epoxy coated ferrite bobbin core 1130-1R0M-RC 1.0 0.003 21 0.80 0.081
• VW-1 rated shrink tubing to cover winding 1130-1R2M-RC 1.2 0.003 21 0.80 0.081
1130-1R5M-RC 1.5 0.003 21 0.80 0.081
• Self-leaded
1130-1R8M-RC 1.8 0.003 21 0.80 0.081
• Fixed lead spacing 1130-2R2M-RC 2.2 0.003 21 0.80 0.081
• Center hole for mechanical mounting 1130-2R7M-RC 2.7 0.003 21 0.80 0.081
• Dielectric withstanding voltage: 1130-3R3M-RC 3.3 0.003 21 0.80 0.081
2500 Vrms terminal to shrink tube cover; 1130-3R9M-RC 3.9 0.003 21 0.80 0.081
1000 Vrms terminal to core 1130-4R7M-RC 4.7 0.003 21 0.80 0.081
1130-5R6M-RC 5.6 0.003 21 0.82 0.081
• Operating temperature -55 to +105 °C
1130-6R8M-RC 6.8 0.004 21 0.82 0.081
1130-8R2M-RC 8.2 0.004 21 0.82 0.081
Notes ± 10 %
* Rated current to cause 50 °C max. temperature 1130-100K-RC 10 0.006 17 0.82 0.081
rise and 5 % max. inductance drop 1130-120K-RC 12 0.008 13.5 0.80 0.072
1130-150K-RC 15 0.009 13.5 0.80 0.072
1130-180K-RC 18 0.010 13.5 0.80 0.072
† RoHS Directive 2002/95/EC Jan 27 2003 1130-220K-RC 22 0.011 13.5 0.79 0.064
including Annex. 1130-270K-RC 27 0.012 13.5 0.79 0.064
1130-330K-RC 33 0.017 13.5 0.79 0.064
1130-390K-RC 39 0.022 11.4 0.79 0.057
1130-470K-RC 47 0.024 9 0.79 0.057
1130-560K-RC 56 0.026 9 0.79 0.057
1130-680K-RC 68 0.029 9 0.79 0.057
1130-820K-RC 82 0.032 9 0.79 0.051
1.1
1130-101K-RC 100 0.034 9 0.79 0.051
Max.
1130-121K-RC 120 0.046 7.2 0.79 0.051
1130-151K-RC 150 0.064 5.5 0.77 0.045
1130-181K-RC 180 0.072 5.5 0.77 0.045
0.84
Max. 1130-221K-RC 220 0.080 5.5 0.77 0.040
1130-271K-RC 270 0.110 4.5 0.77 0.040
1130-331K-RC 330 0.122 4.5 0.77 0.040
1130-391K-RC 390 0.169 4 0.77 0.036
0.5 Lead tinned 1130-471K-RC 470 0.187 4 0.77 0.036
to within 1/8" 1130-561K-RC 560 0.205 4 0.77 0.032
of body 1130-681K-RC 680 0.256 2.8 0.77 0.032
1130-821K-RC 820 0.288 2.8 0.77 0.032
1130-102K-RC 1000 0.426 2 0.75 0.029
C 1130-122K-RC 1200 0.426 2 0.75 0.029
1130-152K-RC 1500 0.518 2 0.75 0.025
1130-182K-RC 1800 0.705 1.6 0.75 0.025
1130-222K-RC 2200 1.02 1.3 0.75 0.025
1130-272K-RC 2700 1.14 1.3 0.75 0.023
1130-332K-RC 3300 1.27 1.3 0.75 0.020
D (Dia)
1130-392K-RC 3900 1.67 1 0.75 0.020
0.196 ± 0.016 1130-472K-RC 4700 1.86 1 0.75 0.020
0.236 ± 0.020
“-RC” suffix indicates RoHS compliance.
Note: Major diameter of #8 screw = 0.164 ”
Dimensions: Inches
A.4. H-bridge
59
RB-Pol-169
This discrete MOSFET H-bridge motor driver enables bidirectional control of one high-power DC
brushed motor. The compact 1.8×1.2-inch board supports a wide 5.5 to 50 V voltage range and is
efficient enough to deliver a continuous 20 A without a heat sink. This version outputs an analog
voltage proportional to the motor current, and an extra control input allows for coasting in addition to
the driving and braking offered by the other Pololu high-power motor drivers.
Overview
The Pololu high-power motor driver is a discrete MOSFET H-bridge designed to drive large DC
brushed motors. The H-bridge is made up of one N-channel MOSFET per leg, and most of the board’s
performance is determined by these MOSFETs (the rest of the board contains the circuitry to take user
inputs and control the MOSFETs). The MOSFET datasheet is available under the “Resources” tab. The
board has an absolute maximum voltage rating of 50 V; higher voltages can permanently destroy the
motor driver. Under normal operating conditions, ripple voltage on the supply line can raise the
maximum voltage to more than the average or intended voltage, so a safe maximum voltage is
approximately 44 V.
Note: Battery voltages can be much higher than nominal voltages when they are charged, so the
maximum battery voltage we recommend is 36 V unless appropriate measures are taken to limit the
peak voltage.
The versatility of this driver makes it suitable for a large range of currents and voltages: it can deliver
up to 20 A of continuous current with a board size of only 1.8" by 1.2" and no required heat sink. With
the addition of a heat sink, it can drive a motor with up to about 32 A of continuous current. The
module offers a simple interface that requires as few as two I/O lines while allowing for both sign-
magnitude and locked-antiphase operation, and an optional third control input unique to this board
allows for coasting. This board also features a current-sensing circuit that measures bidirectional motor
current with a magnitude up to 30 A and outputs an analog voltage.
Integrated detection of various short-circuit conditions protects against common causes of catastrophic
failure; however, please note that the board does not include reverse power protection or any over-
current or over-temperature protection. We recommend you use the integrated current sensor to keep
the driver from delivering more current than it can safely handle.
Connections
The motor and motor power connections are on one side of the board, and the control connections (5V
logic) are on the other side. The motor supply should be capable of delivering the high current the
motor will require, and a large capacitor should be installed between V+ and ground close to the motor
driver to decrease electrical noise. Two axial capacitors are included and one or both can be installed by
soldering them into the V+ and GND pins (labeled '+' and '-' on the bottom silkscreen) along the long
edges of the board. Such installations are compact but might limit heat sinking options; also, depending
on the power supply quality and motor characteristics, a larger capacitor might be required. There are
two options for connecting to the high-power signals (V+, OUTA, OUTB, GND): large holes on 0.2"
centers, which are compatible with the included terminal blocks, and pairs of 0.1"-spaced holes that can
be used with perfboards, breadboards, and 0.1" connectors.
Warning: Take proper safety precautions when using high-power electronics. Make sure you know
what you are doing when using high voltages or currents! During normal operation, this product can
get hotenough to burn you. Take care when handling this product or other components connected to it.
The logic connections are designed to interface with 5V systems (5.5 V max); the minimum high input
signal threshold is 3.5 V, so we do not recommend connecting this device directly to a 3.3 V controller.
In a typical configuration, only PWMH and DIR are required, but PWML can be used to enable
coasting if both PWML and PWMH are driven low. PWML is pulled high and PWMH is pulled low
internally. The two fault flag pins (FF1 and FF2) can be monitored to detect problems (see the Fault
Flag Table below for more details). The RESET pin, when held low, puts the driver into a low-power
sleep mode and clears any latched fault flags. The V+ pin on the logic side of the board gives you
access to monitor the motor’s power supply or pass it on to low-current devices (it should not be used
for high current). The board also provides a regulated 5V pin which can provide a few milliamps (this
is typically insufficient for a whole control circuit but can be useful as a reference or for very low-
power microcontrollers). This pin can be shorted to VCS to power the current sensor, or VCS can be
supplied with 5 V externally. If the 5V output pin is used to power VCS, it should not be used for any
other purpose as the current sensor will draw close to the limit of the current the 5V pin can supply.
When the current sensor is powered by applying 5 V to VCS, the CS pin outputs 66 mV/A for currents
between -30 and 30 A centered at 2.5 V (typical error is less than 1.5%).
Pinout
Included Hardware
A 20-pin straight breakaway male header, two 100 uF capacitors, and two 2-pin 5mm terminal
blocks are included with each motor driver. (Note: The terminals blocks are only rated for 15 A; for
higher power applications, use thick wires soldered directly to the board.) Connecting large capacitors
across the power supply is recommended; one way to do it is between the '+' and '-' holes, as shown
below. The four mounting holes are intended to be used with #2 screws (not included).
• Sign-magnitude (drive-coast): Connect the same PWM signal to both the PWMH and PWML
pins. The duty cycle of the PWM controls the speed of the motor and the DIR pin controls the
direction. During the active (high) portion of the PWM, the motor outputs drive the motor by putting
the full V+ voltage across the motor in the direction determined by the DIR pin; during the low portion
of the PWM, the motor outputs are disconnected and the motor is allowed to coast. This means that the
motor alternates between drive and coast at the PWM frequency with the percentage of the driving time
determined by the duty cycle. Drive-coast operation can draw less power than drive-brake operation,
but drive-brake operation can produce a more linear relationship between duty cycle and motor speed.
• Variable braking (brake-coast): With PWMH disconnected or held low, apply a PWM signal to
the PWML pin (the state of the DIR pin has no effect on this mode). During the active (high) portion of
the PWM, the motor outputs brake the motor by shorting both motor terminals to ground; during the
low portion of the PWM, the motor outputs are disconnected and the motor is allowed to coast. This
means that the motor alternates between brake and coast at the PWM frequency with the percentage of
the braking time determined by the duty cycle.
• Locked-antiphase: With PWML disconnected or held high and PWMH held high, apply a PWM
signal to the DIR pin. In locked-antiphase operation, a low duty cycle drives the motor in one direction
and a high duty cycle drives the motor in the other direction; a 50% duty cycle turns the motor off. A
successful locked-antiphase implementation relies on the motor inductance and PWM switching
frequency to smooth out the current (e.g. making the current zero in the 50% duty cycle case), so a high
PWM frequency might be required.
Motor Driver Truth Table
PWMH PWML DIR OUTA OUTB Operation
H H L GND V+ Forward
H H H V+ GND Backward
L H X GND GND Brake Low
H L X V+ V+ Brake High
L L X Z Z Coast
X = don’t care (same for input H or L); Z = high impedance (outputs disconnected)
PWM Frequency
The motor driver supports PWM frequencies as high as 40 kHz, though higher frequencies result in
higher switching losses in the motor driver. Also, the driver has a dead time (when the outputs are not
driven) of approximately 3 us per cycle, so high duty cycles become unavailable at high frequencies.
For example, at 40 kHz, the period is 25 us; if 3 us of that is taken up by the dead time, the maximum
available duty cycle is 22/25, or 88%. (100% is always available, so gradually ramping the PWM input
from 0 to 100% will result in the output ramping from 0 to 88%, staying at 88% for inputs of 88%
through 99%, and then switching to 100%.)
The motor driver can tolerate peak currents in excess of 200 A. The peak current ratings are for quick
transients (e.g. when a motor is first turned on), and the continuous rating of 20 A is dependent on
various conditions, such as the ambient temperature. The main limitation comes from heating and
power dissipation; therefore, at high currents, the motor driver will be extremely hot, and performance
can be improved by adding heat sinks or otherwise cooling the board. The driver’s printed circuit board
is designed to draw heat out of the MOSFETs, but performance can be improved by adding a heat sink.
The MOSFETs have a theoretical maximum continuous current of 90A at 25°C, but dissipating enough
heat to keep the MOSFET at this temperature is impractical for most applications; close to 35 A of
continuous current should be achievable without too extravagant of a heat sink. For more information
on power dissipation see the data sheet for the MOSFETs on the Resources tab.
Because there is no internal temperature limiting on the motor driver, the entire system should be
designed to keep the load current below the 20 A limit. An easy way to achieve this is to select a motor
with a stall current below that limit. However, because a good motor can have stall currents dozens of
times higher than the typical operating current, motors with stall currents that are hundreds of amps can
be used with this driver as long as the running current is kept low. For example, a motor with a 100 A
stall current might run well at 10 A, leaving a safe margin for the current to double for several minutes
at a time or to triple for several seconds. If the motor does stall completely for a prolonged period,
however, the motor or driver are likely to burn out.
Warning: This motor driver has no over-current or over-temperature shut-off. Either condition can
cause permanent damage to the motor driver. We recommend you use the current-sense output CS to
monitor your current draw if your application will put the driver close to its limits of operation.
Fault Conditions
The motor driver can detect three different fault states, which are reported on the FF1 and FF2 pins.
The detectable faults are short circuits on the output, under-voltage, and over-temperature. A short-
circuit fault is latched, meaning the outputs will stay off and the fault flag will stay high, until the board
is reset (RESET brought low). The under-voltage fault disables outputs but is not latched. The over-
temperature fault provides a weak indication of the board being too hot, but it does not directly indicate
the temperature of the MOSFETs, which are usually the first components to overheat. The fault flag
operation is summarized below.
Flag State
Fault Description Disable Outputs Latched Until Reset
FF1 FF2
L L No fault No No
L H Short Circuit Yes Yes
H L Over Temperature No No
H H Under Voltage Yes No
Note: Please consider our Simple Motor Controllers as alternatives to these motor drivers. They have
very similar power characteristics and offer high-level interfaces (e.g. USB, RC hobby servo pulses,
analog voltages, and TTL serial commands) that make them much easier to use for many applications.
Dimensions
General specifications
Motor channels: 1
Minimum operating voltage: 5.5 V
Maximum operating voltage: 50 V
Continuous output current per channel: 20 A2
Current sense: 0.066 V/A3
Maximum PWM frequency: 40 kHz4
Maximum logic voltage: 5.5 V
MOSFET on-resistance (max per leg): 4.8 mΩ
Reverse voltage protection?: N
Notes:
1 Without any connectors or through-hole capacitors.
2 Typical results with 100% duty cycle at room temperature.
3 Bidirectional centered at 2.5 V with VCS of 5 V.
4 Higher frequencies are possible, but duty cycle will be limited by dead time of approximately 3 μs
per cycle.
Bibliography
[1] HUMUSOFT, MF 634 Multifunction I/O Card: User’s Manual, 2013. [Online]. Available:
[Link]
67