[Home]PWM Servo Amplifiers

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

The Pico Systems PWM servo amplifiers are voltage amplifiers, therefore they produce an effective output voltage proportional to the PWM duty cycle times the DC power supply voltage. Simply, the % duty cycle of the PWM waveform multiplied by the DC supply voltage is the output.

What this all means is that if the motor will develop 3000 RPM at 50 V DC, then a PWM duty cycle of 50% with a 100 V DC supply will get you that 3000 RPM speed. This, of course, ignores the load on the motor, which the CNC control will correct for. But, this is the first order approximation of the servo response.

OK, the first thing to get right is the motor polarity. When you enable the servo loop by pressing first F1 to power the servos up ("Estop OFF"), and then F2, which closes the positioning loop ("machine ON"), the machine has a 50% probability or running away violently. Be ready to hit E-stop if this happens. Then, reverse the motor wires or change the sign of the number in the ini file's OUTPUT_SCALE parameter for that axis.

The easiest way to do this is to start the calibration utility from Axis' Machine menu, select the axis you want to change, and then enter the new value where the current value is shown. Then, click "OK".

When you again do the F2 to get to machine on, it should no longer run away, but may vibrate or show some other sign of instability. You can increase D or reduce P to try to get some kind of stability. What you want is a balance between stability and enough loop gain to hold the following error to a small value.

One way to assess loop gain is to try deflecting the motor by hand. Be careful to never do this in such a way that your hand could be grabbed and wrapped around the pulleys. Do it so that if a violent movement occurs, you can get your hand away. By watching the actual position display on the screen, you can gauge the deflection required before the motor exerts sufficient torque to restore the position.
Then, you need to start looking at dynamic response. Halscope is the utility of choice for servo tuning. You can start Halscope from the Axis Machine pull-down menu. With the servo cycle at 1 KHz (the default) then a 1000 point log will cover one second of real time. By default, with the servo update at 1 KHz, Halscope takes a 4 second trace. You can set the HAL pins or signals to be displayed by clicking on the numbered buttons at the left bottom of the screen. Sliders just to the right of the main display window control offset of the zero value and the scale factor for the channel currently selected by the channel buttons at the bottom. At the lower right, you can select which display channel will be used to trigger the trace, and what level and direction will cause the trigger. You can see at the left of the main display window in colors matching the trace the name of the HAL pins that are being displayed, (such as ppmc.0.encoder.00.position).
This plot shows a motor unable to accelerate as fast as LinuxCNC is asking it to do. The green line is the commanded position LinuxCNC is asking for. The blue line is what the motor was actually doing.
Here is a motor connected backwards. Note that the blue and white lines are moving in OPPOSITE directions! That is a clear indication the motor is moving the opposite way it needs to move to follow the commanded position. The vertical white line is where I hit the F1 key to E-stop the runaway.
This is getting closer to what it should be. The error is modest, around .002", and there is no major instability. This means it is following fairly closely, but not quite exactly on the commanded path. Increasing P can help, but watch out for instability. Then, you can use FF1 to give a little extra velocity command proportional to velocity, to help the servo keep up. Note here that the blue trace is now showing instantaneous velocity in raw encoder count units per servo period. (Other encoder counter methods may give velocity scaled to rational units.
I have turned up the P gain, and the error while moving is smaller (note the error scale is now 500 u-inch/div). But, there is still a lot of error before the move starts, and an opposite error after the end of movement. This is due to static friction and mass, and indicates more gain is desirable. Also, you can see peaks in the error during the acceleration and deceleration parts of the move.
Here is what happens when you have too much P gain and not enough damping with the D term.
Here is with more gain, going as far as we can go with just P gain. When the P is as high as you can get without instability (using D conservatively until you have the highest P possible) you need to start adding FF1 and FF2 to improve the error during constant-speed movement and also at the accelerations. FF1 adds additional power to the motor at constant velocity, and can reduce error during the "cruise" phase of motion. FF2 adds additional power during acceleration, and should be used in VERY small amounts. Try starting with .001, and adjust for minimum error during the accel/decel part of the move. If in doubt, reduce the value to make sure you are not overdoing the amount of FF2.
You can see the spikes during acceleration and deceleration, and see that the following error was very close to zero during the constant velocity part of the move. You can also see that during the constant velocity part, the servo loop was very stable, with no vibrations or other perturbations of any significance. The worst error here was about 200 u-inches (0.0002")

This data all comes from a small brushless servo motor controlled by the Universal PWM Controller and the Pico Systems Brushless Servo Amplifier.

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited January 16, 2014 8:22 pm by Jmelson (diff)
Published under a Creative Commons License