Creating Custom Motion Control and Drive Electronics with an FPGA-Based COTS System

Publish Date: Jan 15, 2014 | 10 Ratings | 4.10 out of 5 |  PDF

Table of Contents

  1. Overview
  2. Requirements for Custom Motion Control and Drive Electronics
  3. Components of a Motion Controller and Drive
  4. Hardware Architecture for Custom Motion Controller and Drive Electronics
  5. Software Architecture for Custom Motion Controller and Drive Electronics
  6. Summary

1. Overview

Complex machines in semiconductor, electronics, packaging, medical, biotech, and micro manufacturing often have tough performance requirements for motion control systems. When traditional programmable logic controller (PLC) or PC-based motion controllers fail to meet these requirements, machine builders turn to custom board development – a time-consuming and expensive process. Recent advances in embedded technologies have made it possible to use field-programmable gate array (FPGA)-based commercial off-the-shelf (COTS) platforms to not only meet those requirements, but also to get to market faster by using graphical system design. This white paper discusses the basic software and hardware architecture for creating your own FPGA-based motion control system and drive electronics with NI CompactRIO and LabVIEW.

Additional Resources:
Learn More about NI LabVIEW
See More Information on NI CompactRIO
View More on NI Motion 

Back to Top

2. Requirements for Custom Motion Control and Drive Electronics

Motion control involves precisely controlling the position, velocity, and torque of a rotational or linear electromechanical device.

Figure 1. Motion Control System Components

While current PLC- or PC–based motion controllers are suitable for many applications, when it comes to semiconductor wafer processing requiring high-speed servo update rates for piezo actuators, machine builders turn to designing their own motion controllers on a custom 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 run-time. Certain applications also require high speed command response and intelligent fault handling features for safety reasons. Dynamic systems with changing loads may require advanced control techniques such as use of notch filters to avoid exciting the system at resonant frequencies, or gain scheduling to adjust for changing load inertia. Certain applications may require customizing the torque loop in addition to position and velocity, while others may require custom drive electronics including custom commutation algorithms for optimal performance.

Before we dive into the hardware and software architectures for implementing such a system, let us first understand the components involved in motion control.

Back to Top

3. Components of a Motion Controller and Drive

A motion controller is at the center of a typical motion system, which consists of supervisory control, trajectory generation, and control loops for position and velocity. The drive typically includes a torque (current) loop and a commutation algorithm in the case of stepper or brushless servo motors. The controller converts high-level user commands into command signals that drives/amplifiers use to move actuators. The motion controller also monitors the system for error conditions, faults, and asynchronous events that can cause the system to change speed, direction, or start/stop the actuators. The following illustrations show the parts and processes of a typical motion controller and drive.

Figure 2. Motion Controller

Figure 3. Control Loops in a Motion Controller and Drive Electronics for a Brushed DC Motor

National Instruments reconfigurable I/O (RIO) technology coupled with LabVIEW SoftMotion technology provides the right tools for machine builders who want high-precision customized motion control with the complete flexibility of an FPGA. Let us explore the hardware and software architectures of such a system.

Back to Top

4. Hardware Architecture for Custom Motion Controller and Drive Electronics

CompactRIO is a small rugged industrial control and acquisition system powered by reconfigurable I/O (RIO) FPGA technology for ultrahigh performance and customization. NI CompactRIO incorporates a real-time processor and reconfigurable FPGA for reliable stand-alone embedded or distributed applications, and hot-swappable industrial I/O modules with built-in signal conditioning for direct connection to sensors and actuators. CompactRIO embedded systems are developed using high-productivity LabVIEW graphical programming tools for rapid development. With CompactRIO, you can rapidly build embedded control or acquisition systems that rival the performance and optimization of custom-designed hardware circuitry.

Figure 4. CompactRIO Architecture

CompactRIO combines a low-power-consumption real-time embedded processor with a high-performance FPGA chipset. The FPGA core has built-in data transfer mechanisms to pass data to the embedded processor for real-time analysis, post-processing, data logging, or communication to a networked host computer. CompactRIO provides direct hardware access to the input/output circuitry of each I/O module using LabVIEW FPGA elemental I/O functions. Each I/O module includes built-in connectivity, signal conditioning, conversion circuitry (such as ADC or DAC), and an optional isolation barrier. This design represents a low-cost architecture with open access to low-level hardware resources.

Each CompactRIO I/O module contains built-in signal conditioning and screw terminal, BNC, or D-Sub connectors. By integrating the connector junction box into the modules, the CompactRIO system significantly reduces the space requirements and cost of field wiring. A variety of I/O types are available including ±80 mV thermocouple inputs, ±10 V simultaneous sampling analog inputs/outputs, 24 V industrial digital I/O with up to 1 A current drive, differential/TTL digital inputs with 5 V regulated supply output for encoders, and 250 Vrms universal digital inputs. Because the modules contain built-in signal conditioning for extended voltage ranges or industrial signal types, you can usually make your wiring connections directly from the CompactRIO module to your sensors/actuators.

The NI 9505 module for CompactRIO is a full H-bridge servo motor drive for direct connectivity to actuators such as fractional horsepower (up to 300W at 40 °C) brushed DC servo motors, relays, solenoids, and valves. The NI 9505 plugs into the CompactRIO chassis just like any other I/O module, thus eliminating the need for an external drive when connecting to a motor. The NI 9505 drive module includes a built-in encoder interface for single-ended or differential inputs for position feedback from a quadrature encoder. It also includes a current sensor, which enables engineers to sample the current through the motor, or actuator, and read it through the FPGA in the CompactRIO chassis. You can use real-time data from the current sensor for flexible sampling time and filtering of the motor current to optimize the control loop.

The following illustration shows the hardware architecture of a custom motion controller and drive using CompactRIO COTS components.

Figure 5. Hardware Architecture for Custom Motion Controller and Drive Electronics


Additional Resources:
Configure Your CompactRIO System
Learn about the NI 9505 Full H-Bridge Brushed DC Servo Drive Module

Back to Top

5. Software Architecture for Custom Motion Controller and Drive Electronics

The LabVIEW graphical system design platform combines off-the-shelf hardware and LabVIEW real-time execution with algorithm design tools for simple to advanced control applications. LabVIEW offers the unique advantage of a high-level graphical language designed for engineers and scientists with real-time I/O platforms, so you quickly can design, prototype, and deploy your system designs.

The NI SoftMotion Development Module for LabVIEW provides VIs and functions to help you build custom motion controllers that run using LabVIEW in combination with National Instruments hardware, such as CompactRIO. The NI SoftMotion Development Module works in conjunction with the NI LabVIEW Real-Time Module, LabVIEW FPGA Module, and the LabVIEW Control Design and Simulation Bundle. The NI SoftMotion Development Module provides all of the functions that typically reside on a motion controller. With it, you can handle path planning, trajectory generation, and position and velocity loop control in the LabVIEW environment and then deploy the code on target hardware based on LabVIEW Real-Time or LabVIEW FPGA. By customizing FPGA logic on CompactRIO you can accurately control torque in addition to velocity and position and implement advanced control techniques such as use of notch filters to avoid exciting the system at resonant frequencies, or gain scheduling to adjust for changing load inertia. You can use the real-time embedded processor on CompactRIO to implement functions such as supervisory control and trajectory generation for multiaxis coordination and accurate velocity/acceleration profiles for smooth movements.

Let us understand how these motion control components are implemented in LabVIEW.

Figure 6. Software Architecture for Custom Motion Controller and Drive Electronics

Supervisory Control
The supervisory control is the main loop of the motion control system. This loop intercepts commands from the user and signals the trajectory generator to start/stop moves. The supervisory control loop also monitors all I/O needed to perform initialization tasks, such as finding the reference or origin. This loop also monitors the system for faults and aids in synchronizing moves relative to changes in external conditions. Code for supervisory control executes in the LabVIEW Real-Time environment at millisecond loop rates. The NI SoftMotion Development Module contains multiple examples for supervisory control.

Trajectory Generator
The trajectory generator is a path planner that creates set points for the control loop. It is a multiaxis, preemptive, 64-bit floating-point engine that supports coordinated motion with linear and circular interpolation. The trajectory generator creates new set points every loop period, based on move constraints provided by the user. These move constraints include the maximum velocity, maximum acceleration/deceleration, and maximum jerk that the mechanical system can tolerate. You can perform 2-D, 3-D (roll, yaw, pitch), and helical circular interpolation with contouring and registration moves. The trajectory generator also includes support for cubic splining and provides coefficients for spline interpolation.


Figure 7. Trajectory Generator Implementation with the NI SoftMotion Development Module for LabVIEW

Spline Engine
The spline engine function uses a cubic spline algorithm and four set points to calculate interpolated positions between two positions from the trajectory generator. Using the spline engine function results in smooth motion and means you can run the trajectory generator loop slower than the control loop.

Control Loop
The control loop creates the command signal based on the set point provided by the trajectory generator. In most cases, the control loop includes both a position and a velocity loop, but in some cases the control loop may include only a position loop. The position is typically read from encoders, but also may be read from analog inputs (ADCs). The velocity is calculated from the position values, and may be read directly from a velocity sensor, such as a tachometer. Because feedback is not required for stepper motors, the control loop concerts the set point generated by the trajectory generator into stepper signals (step/direction).

The NI SoftMotion Development Module contains examples for control loop implementation with PID. The example features an enhanced PID algorithm that supports dual feedback, both position and velocity loops, velocity feedforward, and acceleration feedforward parameters. The control loop can be programmed through LabVIEW Real-Time as well as LabVIEW FPGA. The complete source code for the PID control loop is provided as part of the NI SoftMotion Development Module.

Analog and digital I/O are required to send the command signals and receive feedback from the actuators. Most I/O requirements for motion controllers are digital. In most cases, position feedback is obtained from digital encoders. However, some servo motor drives require analog I/O, and the feedback is obtained from an analog source (ADC).

Drive Electronics
Instead of using a fixed personality drive or amplifier, you can create custom drive electronics with the NI 9505 full H-bridge module and NI LabVIEW FPGA.

The NI 9505 drive module returns the motor or actuator current data to the LabVIEW FPGA module for use in a current loop or for monitoring. NI 9505 status information such as drive fault status, supply power, and emergency stop status are also returned to the LabVIEW FPGA Module. Using this data you can create your own PWM generator, encoder interface, and current loop in software using LabVIEW FPGA.

Figure 8. PWM Loop in LabVIEW FPGA

Additional Resources:
See the NI SoftMotion Development Module for LabVIEW

Back to Top

6. Summary

Creating a high-performance, custom motion controller and drive electronics is no longer an expensive and time consuming process. Using off-the-shelf embedded components such as the FPGA-based CompactRIO platform coupled with the LabVIEW graphical system design environment, you can create complex control systems for your automation tasks.

Back to Top

Bookmark & Share


Rate this document

Answered Your Question?
Yes No