Could we improve the performance of do-it-yourself CNC machines by
integrating machine status into the CNC controller. In this video we'll read the
following-error from closed-loop stepper motors into the computer running the CNC
controller. Other videos in this series will build on this idea. The use of
stepper motors on CNC machines is criticized because stepper motors don't
require position feedback to their drives. Without position feedback the
CNC machine is assumed to be in the correct location but it's not actually know. Some
say servo motors are better than stepper motors because servo motors have
encoders, but the servo motor has an encoder because of an inherent need by the
servo drive. Nowadays closed-loop stepper motors common and they have a built-in
encoder that the drive uses to monitor the difference between the commanded
position and actual position. This is called the following-error and is the
primary variable in the control loop for a closed-loop drive. Our CNC machine is a
retrofitted Precision Matthews 25 milling machine. Each axis has a 280 ounce-inch
closed-loop Leadshine Easy Servo stepper motor with built-in encoder. These attach
to Leadshine Easy Servo drives which monitor the following-error and respond
using both a position and a current control loop. Step and direction pulses are
generated for the drives by a Pico Systems Universal Stepper Controller.
This board receives velocity commands from LinuxCNC and uses those to
generate step and direction pulses. This is more efficient than sending step
and direction pulses directly from the controller. Virtual position error derived from
a machine model and a count of the pulse sent is returned to LinuxCNC for its own control loop.
A desktop computer running LinuxCNC serves as our CNC
controller and this is where we want to monitor the following-error. The Easy Servo
drives only report following-error from a serial port via a diagnostics protocol.
Unfortunately, the diagnostics protocol is not published so to create
interoperability with LinuxCNC we must first reverse-engineer the protocol. This
program is an implementation of a reverse engineered protocol and the
program is plotting the following-error from the easy servo drive connected to
the Z-axis. As we exercise the axis, you can see the effect on the following-error.
In addition to every reading of the following-error, we're plotting the average and
the maximum. The program requests the drive to record following-error for 200
milliseconds and then retrieves the values with a
readout overhead of 100 milliseconds. The most recent data is 300 milliseconds
delayed. While sampling duration is configurable, 200 values are always
returned and the readout overhead is fixed. So we select the sampling duration
that's short enough to be near real-time but not too short to be dominated by the
readout overhead. The read out overhead is shown by the spaces between the
measurements of following-error. Actual position will generally lag commanded
position while the machine is in motion, and some amount of following-error is
realistic. Too little following-error and the machine will be stiff and jerky. As the
load on the machine is increased so will the following-error. And we can demonstrate
this by increasing the load on the head by putting additional 40 pounds of
weight on it.
Exposing the following-error to a machine operator might help them to optimize the
aggressiveness of machine operation similar to spindle load meter. but
integrated into a CNC controller might enable automatic optimization and
that idea is what we're exploring with these videos. For my experiments I only
need certain commands reverse-engineered and none of the configuration commands were
implemented. I also have only tested the software on Leadshine Easy Servo 508 drives
and no other drives are expected to work. The software is available on
Github with a link in the video description.
Like all software on the Internet, the best advice would be not to use it at
all, but if you do use it, you use it at your own risk. In the next video we'll look at how
the diagnostics protocol was a reverse engineered and go through the software.
And in the third video we'll integrate this software with LinuxCNC. Thank you for
watching and I always enjoy reading your comments. We'll talk again soon.