Guest post by Adam Reynolds, Application Engineer, LineStream technologies
Have you wondered how to design real-time velocity and position control applications? In this blog post, we’re going to show you, step by step, how to achieve optimal dual-axis speed and position control on a bench-top router (Figure 1) using the TI C2000™ Piccolo™ F2806x InstaSPIN-MOTION™ LaunchPad development kit.
Figure 1. 15"x15" bench-top router
In less than 20 hours, the router was drawing squares, triangles and circles.
Project Timeline | |
Monday 2 hours | Received CNC router table |
Tuesday 4 hours | Connected servo motors to X & Y stages Used InstaSPIN-MOTION software to:
|
Wednesday 6 hours | Create a square Motion Profile |
Thursday 6 hours |
|
Figure 2. Timetable for bench-top router to create motion profiles
Step 1 – Connect servo motors to the X and Y stages
If you’re working on a multi-axis application, you’ll need to design your own board. We took a preliminary step using two TI InstaSPIN-MOTION LaunchPad development kits. The LaunchPad includes hardware to interface to two BoosterPacks which can each control a motor, but the software framework to do so is still being finalized and will be released in a future version of MotorWare.
Material List:
- 2 C2000 Piccolo F2806x InstaSPIN-MOTION LaunchPad development kits (LAUNCHXL-F28069M)
- 2 DRV8301 Motor Drive BoosterPacks (BOOSTXL-DRV8301)
- 2 Low Voltage Servo Motors with encoder (LVSERVOMTR)
- MotorWare™ software
We used the InstaSPIN-MOTION Position Plan Component to create and execute the state transitions for the X and Y axes. When using two LaunchPad development kits, the Position Plans communicates over GPIO, which introduces a small amount of delay. When you design your own board, you’ll still run two Plan components, but they will communicate through variables rather than over GPIO, which will produce a more precise start. In addition, you will be able to control both axes from a single TI C2000 Piccolo TMS320F28069M microcontroller, which is quite a cost savings.
Step 2 – Identify the system inertia of each axis
Inertia includes anything that is rigidly coupled to the motor shaft. It includes anything that moves directly with the motor. For the CNC Router, the X axis has different and independent inertia than Y axis.
We used the InstaSPIN-MOTION Velocity Identify component to identify the inertia. We set each stage so that it had the entire range of positive motion because the inertia identification always rotates the motor in positive direction. We then used the InstaSPIN-MOTION MotorWare Lab 12a software, which identified both the inertia and the friction. The inertia value is an input to the InstaSPIN-MOTION position controller, which uses it to provide the appropriate torque to get the application moving.
Here’s a quick video of the Inertia identification process for the X axis. It moves fast, so watch closely!
Step 3 – Tune the controller
Speed and position are tuned at the same time, using a single gain called bandwidth. Each axis is tuned independently. The tuning process is simple and straightforward. Using MotorWare Lab 13a software, we adjusted the bandwidth, injected a disturbance and evaluated the position hold. This process was repeated until the axis demonstrated good holding position at 0 speed when the system was disturbed. We set the initial bandwidth to 10 rad/s, and then manually injected a disturbance. The arm moved easily at this setting. As we increased the bandwidth, it became more difficult to move the axis. At 40 rad/s, the router table’s X axis was holding the position really well.
Here’s a video of the tuning process.
Step 4 – Optimize acceleration and jerk
We then set out to optimize acceleration and jerk (jerk is the rate of change of acceleration). The trapezoidal curve was used to optimize acceleration because this curve ignores jerk. Each axis was commanded to move back and forth while the acceleration was slowly increased. Optimal acceleration occurs just prior to the point when the motor fails to reach the commanded value.
Once we found the optimal acceleration, we then optimized the jerk, using the st-curve, which features continuous jerk. The jerk was adjusted so that the router exhibited smooth starts and stops with a very high degree of reliability.
Step 5 – Create a square motion profile
It’s pretty easy to make the router draw a square – only one axis moves at a time. A Position Plan was created for each axis. In our configuration, the X axis was the master. The X axis plan signaled the Y axis to start moving. The Y axis plan signaled X when its move was complete.
X Axis Position Plan:
| Y Axis Position Plan:
|
Figure 3. Creating a square motion profile
Step 6 – Create a triangular motion profile
Drawing a triangle was more difficult. The X and Y axes had to be coordinated to draw the sloping sides. A few calculations were required to generate the motion plan for each axis, using the equation:
Vel = dposition_step/t
Vel = velocity
d = distance
t = time
Each axis was required to complete the move at the same time, therefore:
tx=ty
The travel distance (dposition_step) was known. By fixing the velocity for the X axis, this gave us a known time (tx) and from there we were able to calculate the velocity of the Y axis (Vely).
Figure 4. Creating a triangular motion profile
Step 7 – Create a circular motion profile
The circular motion profile is the most complex of the three shapes. We cheated a little bit on this one. The actual shape is a 32-sided polygon. It approximates a circle but is less computationally intensive. We used Matlab to calculate the X and Y axis positions. From there, we used the same procedure used in the triangle motion profile to ensure that each X and Y movement ended at the same time.
Figure 5. Creating a circular motion profile
Watch a video of the finished project.
The InstaSPIN-MOTION LaunchPad
The InstaSPIN-MOTION LaunchPad has a 90-MHz C2000 Piccolo F28069M MCU, an emulator and the InstaSPIN-MOTION software all in one package. You can use it to develop sensorless or sensored motor control applications. It also comes with hardware design package including gerbers, schematics and a bill of materials. It features MotorWare example software that has everything needed to get your motor running.
Perhaps the best part is the price. The LaunchPad is only MSRP $25 USD from the TI Store and authorized distributors. It can connect with most of the BoosterPacks, including the DRV8301 Motor Drive BoosterPack featuring a 240W 3- phase inverter, which is available for $49.
Be sure to post a description of your LaunchPad projects below. I can’t wait to hear about the cool applications that you can develop with this tool!