Fundamentals of Motion Control
Fundamentals of Motion Control
Overview
This tutorial is part of the National Instruments Measurement Fundamentals series. Each tutorial in this series teaches
you a specific topic of common measurement applications by explaining theoretical concepts and providing practical
examples. In this tutorial you learn the fundamentals of a motion control system including software, motion controller,
drive, motor, feedback devices and I/O.
You can also view an interactive presentation that takes you through this tutorial's material at your own pace.
Application software – You can use application software to command target positions and motion control profiles.
Motion controller – The motion controller acts as brain of the of the system by taking the desired target positions and
motion profiles and creating the trajectories for the motors to follow, but outputting a ±10 V signal for servo motors, or
a step and direction pulses for stepper motors.
Amplifier or drive – Amplifiers (also called drives) take the commands from the controller and generate the current
required to drive or turn the motor.
Motor – Motors turn electrical energy into mechanical energy and produce the torque required to move to the desired
©National Instruments. All rights reserved. LabVIEW, National Instruments, NI, ni.com, the National Instruments corporate logo, and the Eagle logo are trademarks of National Instruments. See
ni.com/trademarks for other NI trademarks. Other product and company names are trademarks or trade names of their respective companies. For patents covering National Instruments products, refer
to the appropriate location: Help>>patents in your software, the patents.txt file on your CD, or ni.com/patents .
Document Version 12
target position.
Mechanical elements – Motors are designed to provide torque to some mechanics. These include linear slides, robotic
arms, and special actuators.
Feedback device or position sensor – A position feedback device is not required for some motion control applications
(such as controlling stepper motors), but is vital for servo motors. The feedback device, usually a quadrature encoder,
senses the motor position and reports the result to the controller, thereby closing the loop to the motion controller.
Application software is divided into three main categories: configuration, prototype, and application development
environment (ADE). The following diagram illustrates the motion control system programming process and the
corresponding National Instruments product designed for the process:
Configuration
One of the first things to do is configure your system. For this, National Instruments offers Measurement & Automation
Explorer (MAX), an interactive tool for configuring not only motion control, but all other National Instruments
hardware. For motion control, MAX offers interactive testing and tuning panels that help you verify your system
functionality before you program.
2 www.ni.com
Figure 3. NI MAX is an interactive tool for configuring and tuning your motion control system.
App Notes:
Prototyping
When you have configured your system, you can start prototyping and developing your application. In this phase, you
create your motion control profiles and test them on your system to make sure they are what you intended. For
prototyping, National Instruments offers a tool called the NI Motion Assistant. The NI Motion Assistant is an
interactive tool with which you can configure moves using a point-and-click environment and generate NI LabVIEW
code based on the moves you configure. The key benefit of the NI Motion Assistant lies in the difference between
configurable and programmable environments. With configurable environments, you can start your development
without programming. You can think of the tasks available in the NI Motion Assistant as prewritten blocks of code that
you simply configure to meet your needs. Programmable environments, on the other hand, require you to use standard
programming languages such as LabVIEW, C, or Visual Basic to accomplish your tasks. Unfortunately, many
3 www.ni.com
configurable environments may be limited in functionality or in the ability to integrate with other I/O outside of motion.
The NI Motion Assistant bridges the gap between programmable and configurable environments by offering all
configurable system features as well as LabVIEW code generation.
Figure 4. The NI Motion Assistant helps you quickly prototype your application and then convert your project into
LabVIEW VIs or C code for further development.
Evaluation Software:
Development
After the prototyping phase, the next step is to develop the final application code. For this, you use driver-level software
in an application development environment (ADE) such as LabVIEW, C, or Visual Basic. For a National Instruments
motion controller, you use NI-Motion driver software.
The NI-Motion driver software contains functions with which you can communicate with NI motion controllers in
Windows or LabVIEW Real-Time. NI-Motion also includes MAX to help you easily configure and tune your motion
system.
For non-Windows systems, you can develop your own driver using the Motion Control Hardware DDK manual. It
explains how to communicate on a low level with NI motion controllers. If you do not have the expertise or time to
develop your own driver, National Instruments Alliance Partner Sensing Systems offers a Linux®¹ and VxWorks
driver, and can create drivers for other OSs, such as Mac OS X or RTX.
App Notes:
4 www.ni.com
Understanding Variable Arithmetic in Onboard Programming
Motion Controller
A motion controller acts as the brain of the motion control system and calculates each commanded move trajectory.
Because this task is vital, it often takes place on a digital signal processor (DSP) on the board itself to prevent
host-computer interference (you would not want your motion to stop because your antivirus software starts running).
The motion controller uses the trajectories it calculates to determine the proper torque command to send to the motor
amplifier and actually cause motion.
The motion controller must also close the PID control loop. Because this requires a high level of determinism and is
vital to consistent operation, the control loop typically closes on the board itself. Along with closing the control loop,
the motion controller also manages supervisory control by monitoring the limits and emergency stops to ensure safe
operation. Directing each of these operations to occur on the board or in a real-time system ensures the high reliability,
determinism, stability, and safety necessary to create a working motion control system.
Learn more about the FlexMotion architecture of National Instruments DSP-based motion controllers.
The motion trajectory describes the motion controller board control or command signal output to the driver/amplifier,
resulting in a motor/motion action that follows the profile. The typical motion controller calculates the motion profile
trajectory segments based on the parameter values you program. The motion controller uses the desired target position,
maximum target velocity, and acceleration values you give it to determine how much time it spends in the three primary
move segments (which include acceleration, constant velocity, and deceleration).
For the acceleration segment of a typical trapezoidal profile, motion begins from a stopped position or previous move
and follows a prescribed acceleration ramp until the speed reaches the target velocity for the move.
5 www.ni.com
Figure 5. A Typical Trapezoidal Velocity Profile
Motion continues at the target velocity for a prescribed period until the controller determines that it is time to begin the
deceleration segment and slows the motion to a stop exactly at the desired target position.
If a move is short enough that the deceleration beginning point occurs before the acceleration has completed, then the
profile appears triangular instead of trapezoidal and the actual velocity attained may fall short of the desired target
velocity. S-curve acceleration/deceleration is a basic trapezoidal trajectory enhancement where the acceleration and
deceleration ramps are modified into a nonlinear, curved profile. This fine control over ramp shape is very useful for
tailoring motion trajectory performance based upon the inertial, frictional forces, motor dynamics, and other mechanical
motion system limitations.
App Notes:
Velocity Profiling
NI offers three main families of DSP-based motion controllers, including the low-cost NI 733x series, the mid-range NI
734x series, and the high-performance NI 735x series. The NI 733x series low-cost controllers offer four-axis stepper
motor control and most of the basic functions you need for a wide variety of applications, including single and multiaxis
6 www.ni.com
point-to-point motion. The NI 734x series is the mid-range series that offers up to four axes of both stepper and servo
control, as well as some higher-performance features such as contouring and electronic gearing. The NI 735x series is
the most advanced series that offers up to eight axes of stepper and servo control, extra I/O, and many powerful features
including sinusoidal commutation for brushless motors and 4 MHz periodic breakpoints (or position triggers) for
high-speed integration.
Selection Guides:
While current motion controllers with DSPs are suitable for many applications, when it comes to high-precision motion
control with servo update rates as fast as 200 kHz, machine builders turn to designing their own motion controllers on a
custom printed circuit board (PCB). Not only is the development expensive in terms of time and cost, but the fixed
personality of the motion controller makes the system inflexible for future redesigns or for accommodating variations in
the motion control algorithms at runtime. Some applications that need such a high level of precision and flexibility
include wafer processing machines in the semiconductor industry, or in-line vehicle sequencing (ILVS)
reconfigurable-at-run-time assembly line for the automotive industry. National Instruments reconfigurable I/O (RIO)
technology coupled with NI SoftMotion technology provides the right tools for machine builders who want
high-precision customized motion control with the complete flexibility of a field-programmable gate array (FPGA). In
addition to high-precision applications, machine builders and OEMs also can use the NI SoftMotion Development
Module to implement multiaxis coordinated motion control using NI LabVIEW on a variety of platforms – from NI
plug-in M Series DAQ devices for industrial PCs and PXI to rugged systems using NI CompactRIO and NI Compact
FieldPoint programmable automation controllers (PACs).
Tutorials:
White Paper: Create Your Custom Motion Controller on Any Platform with LabVIEW
Move Types
Single-Axis, Point-to-Point Motion
One of the most commonly used profiles is the simple, single-axis, point-to-point move, which requires the position to
which the axis needs to move. Often, it also requires the velocity and acceleration (usually supplied by a default setting)
at which you want the motion to move. The following diagram shows how to move a single axis in LabVIEW using the
default velocity and acceleration.
7 www.ni.com
Figure 6. Single-Axis, Point-to-Point Motion in LabVIEW
Another type of motion is coordinated multiaxis motion, or vector motion. This move is often point-to-point motion, but
in 2D or 3D space. Vector moves require the final positions on the X, Y, and/or Z axes. Your motion controller also
requires some type of vector velocity and acceleration. This motion profile is commonly found in XY-type applications
such as scanning or automated microscopy. The following diagram shows how to accomplish a two-axis move using
LabVIEW. For more information on coordinated motion, view the examples in the LabVIEW Multiaxis.llb library in
NI-Motion driver software.
Blended Motion
Blended motion involves two moves fused together by a blend that causes the moves to act as one. Blended moves
require two moves and a blend factor that specifies the blend size. Blending is useful for applications requiring
continuous motion between two different moves. However, in blended motion, your system does not pass through all of
the points in your original trajectory. If the specific position along the path is important to you, consider a contouring
motion.
8 www.ni.com
Figure 8. Blended Motion
The figure below explains blending between two vector moves in LabVIEW. For more information on blending, view
the Sequence of Blended Vector Moves example program in NI-Motion driver software.
Contoured Motion
9 www.ni.com
With contouring, you can supply a position buffer and create a smooth path or spline through them. Contouring holds
an advantage over blending in that it guarantees that the system passes through each position.
The diagram below explains a contoured move using LabVIEW. For more information on contouring, view the
examples in the Countouring.llb example library found in NI-Motion driver software.
10 www.ni.com
Electronic Gearing
With electronic gearing, you can simulate the motion that would occur between two mating gears without using real
gears. You use electronic gearing by supplying a gear ratio between a slave axis and a master axis, encoder, or ADC
channel.
The diagram below shows how to configure a slave axis to follow a master axis. For more information on electronic
gearing, view the Gearing.llb example library found in NI-Motion driver software.
App Notes:
Stopping Modes
Spherical Interpolation
Circular Interpolation
11 www.ni.com
much current, you risk damaging your motor. If your drive supplies too little current, your motor does not reach full
torque capacity. If your voltage is too low, your motor cannot run at its full speed.
You should also consider how to connect your amplifier to your controller. Some motor companies sell drives that
easily connect to the motors they offer. National Instruments offers drives for both two-phase stepper motors and DC
brushed servo motors. These drives have screw terminals with which you can connect to many different motors. The
figure below describes the difference between NI motor drives.
For connecting to third-party drives and amplifiers, National Instruments offers the universal motion interface (UMI) –
the standard UMI-7764 with screw terminal connectivity, and the industrial UMI-7774 with 24V logic digital I/O and
D-SUB connectivity.
Selection Guides:
App Notes:
AC Servo Amplifiers
DC Servo Amplifiers
Changing the Voltage Output on a FlexMotion Controller for Drives That Do Not Accept ±10 V
How to Connect the 73xx Inhibit and Command Signal Outputs to Third-Party Drives
After determining which technology you want to use, you need to determine the torque and inertia at the motor shaft.
12 www.ni.com
For more information on calculating system torque, read the Motor Fundamentals article at zone.ni.com.
Something else to consider when selecting your motor and other mechanics is whether an off-the-shelf actuator (such as
a stage) might work for your application. Stages offer the power transmission to obtain useful rotary or linear motion
without designing it yourself. You can find many National Instruments Alliance Partners offering stages in the Stage
Advisor at ni.com/motion/advisors.
Selection Guides:
Stage Advisor
App Notes:
Motor Fundamentals
Feedback Devices
Feedback devices help the motion controller know the motor location. The most common position feedback device is
the quadrature encoder, which gives positions relative to the starting point. Most motion controllers are designed to
work with these types of encoders. Other feedback devices include potentiometers that give analog position feedback,
tachometers that provide velocity feedback, absolute encoders for absolute position measurements, and resolvers that
also give absolute position measurements. When using National Instruments motion controllers, you can use quadrature
encoders and potentiometers.
App Notes:
Basics of Feedback
Encoders
13 www.ni.com
Absolute Encoders
Resolvers
Tachometers
Magnetic Encoders
Optical Encoders
Quadrature Encoders
How to Choose Among LVDT, RVDT, Potentiometer, Optical Encoder, Ultrasonic, Magnetostrictive, and Other
Technologies
Motion I/O
Other I/O that is important in motion control includes limit switches, home switches, position triggers, and position
capture inputs. Limit switches provide information about the end of travel to help you avoid damaging your system.
When a motion system hits a limit switch, it typically stops moving. Home switches, on the other hand, indicate the
system home position to help you define a reference point. This is very important for applications such as
pick-and-place.
Triggers such as position trigger outputs or position capture inputs help when integrating with other devices. With
position trigger outputs (also called breakpoints and position compare), you can set up a trigger that executes at a
prescribed position. This type of action is very useful in operations such as scanning, where you might want to trigger a
system to take measurements at a series of prescribed positions. Position capture inputs, on the other hand, cause the
motion controller to immediately capture an event occurrence position and store it in memory. This is useful if you have
an external trigger and would like to know the position at which it occurs in your system.
App Notes:
Breakpoints/Triggers
14 www.ni.com
Relevant NI Products
Customers interested in this topic were also interested in the following NI products:
• LabVIEW
• Data Acquisition (DAQ)
• Signal Conditioning
¹ Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.
15 www.ni.com