Wiring and Configuring Yaskawa CACR-SR Servo Drives with KMotion

Tom Garrett14 min read
Motion ControlTutorial / How-toYaskawa
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

This reference covers the wiring, commissioning, and tuning of a Yaskawa CACR-SR series analog-command servo drive controlled by a Dynomotion KMotion controller equipped with a Kanalog I/O daughter board. The same procedure applies to any third-party analog torque/velocity servo amplifier that accepts a ±10 V velocity or current command and returns an A/B (and optional Index/Z) differential quadrature encoder signal.

The Yaskawa CACR-SR is an older-generation Sigma-series analog drive family that is still widely deployed in retrofits of CNC mills, lathes, plasma tables, and routers. The drive expects a bipolar analog command on its speed/torque reference input, supplies 24 VDC logic power to its inputs, and reads a differential line-driver encoder from the motor. Because KMotion exposes a 16-bit DAC and dedicated encoder counters on the Kanalog board, the two products form a common low-cost retrofit pairing.

Safety: Always remove mains power and verify DC bus discharge before changing encoder wiring or signal-level jumpers. The CACR-SR's internal bus capacitors retain lethal voltage for several minutes after power-off. Consult the Yaskawa CACR-SR product manual for the exact discharge time on the specific amplifier rating in use.

System Architecture

The signal path for a single axis is:

  1. KMotion PC host issues a trajectory command (Jog, G-code, MDI).
  2. KMotion DSP closes the position loop using encoder counts from the Kanalog encoder counter.
  3. KMotion writes a 16-bit DAC value (range 0-2047 positive, bipolar with offset) to the Kanalog DAC.
  4. Kanalog outputs ±10 V on JP7/OPx pins into the CACR-SR analog command input (CN1 or 1CN, depending on variant).
  5. The CACR-SR drives the brushless servomotor; the motor's incremental encoder returns to Kanalog A/B inputs on JP2.
  6. Position loop error (commanded - actual) is computed in firmware and limited by MaxErr.

The default 3-axis initialization file included with KMotion (KMotionDef.h and the user main() routine) configures all three axes as analog-DAC servos with encoder feedback. This is the canonical starting point for CACR-SR retrofits.

Prerequisites

  • KMotion controller (KFlop, KStep, or earlier KBoard) with Kanalog board populated.
  • Yaskawa CACR-SR (or CACR-SR_BE / CACR-SR_S) amplifier with matching servomotor.
  • Differential line-driver encoder on the motor (typically 8192 counts/rev for retrofit applications).
  • KMotionCNC host application for plot capture and trajectory execution.
  • Scope or KMotion Console's built-in time-capture for step response and following-error plots.
  • 24 VDC supply for relay-board enable logic.

Review the installation best-practices guide before energizing the system: Servo Drive Installation Best Practices (Rockwell Automation publication MOTION-AT004). Although written for Allen-Bradley drives, the document's grounding, shielding, and encoder-cabling guidance applies to any analog servo installation including Yaskawa CACR-SR retrofits.

Hardware Wiring

Analog Command

Connect Kanalog JP7 OP outputs to the CACR-SR speed/torque reference input:

Kanalog JP7 CACR-SR terminal Function
OP0 (pin 1) Speed ref + (typically pin 3 of 1CN) Axis 0 ±10 V command
AGND (pin 2) Speed ref - (typically pin 4 of 1CN) Analog ground
OP1 (pin 3) Speed ref + axis 1 Axis 1 command
AGND (pin 4) Speed ref - axis 1 Analog ground

Use a shielded twisted pair with the shield bonded to chassis ground at the drive end only. Avoid routing the analog pair in the same conduit as AC servo power.

Encoder Feedback

The CACR-SR encoder is a differential line driver (26LS31/32 equivalent). Wire it to Kanalog JP2 dedicated encoder inputs:

Encoder signal Wire color (typical) Kanalog JP2 pin
A+ Blue JP2-Ax+
A- Blue/White JP2-Ax-
B+ Green JP2-Bx+
B- Green/White JP2-Bx-
Z+/Index Yellow (optional) JP2-Cx+
Z-/Index Yellow/White (optional) JP2-Cx-
5 V supply Red JP2 +5V
GND Black JP2 GND

The differential inputs on Kanalog are RS-422 compatible and terminate at 120 Ω inside the FPGA. With the Yaskawa 8192-count encoders used in most retrofit applications, the resulting counts per motor revolution is 4 × 8192 = 32768 in quadrature mode.

Drive Enable (24 V Relay Enable)

Many retrofit machines have a series of relay boards that require 24 VDC to be applied at their coil input in order to enable the drive's contactor or to enable the axis enable line on the CACR-SR. KMotion's Kanalog board provides eight 0-24 V general-purpose outputs on connector JP5. Each output can sink or source up to 350 mA, which is sufficient for a small interposing relay.

  1. Assign a digital bit (for example, bit 152 as suggested in KMotionDef.h) to the enable function.
  2. In main(), drive the bit low during boot so the drive is not enabled at controller start-up.
  3. Use SetBit(152) in the enable handler and ClearBit(152) in the disable handler.
  4. Wire the JP5 output through an interposing relay: KMotion output → relay coil → 24 V common.
  5. Use the relay's normally-open contact to drive the CACR-SR's servo-on (S-ON) input.

Ensure the bit is cleared (output low) before the controller leaves reset, otherwise the drive will energize unexpectedly during boot. This is the same logic sequence followed in the stock 3-axis initialization file.

Initial Servo Parameters

The default parameters shipped in KMotionDef.h provide a safe but slow starting point. Key fields and the values appropriate for a CACR-SR retrofit are:

Field Symbol Starting value Notes
InputMode ENCODER_MODE Set Encoder feedback on this channel.
OutputMode DAC_SERVO_MODE Set Position loop output to DAC.
Vel Velocity limit 60000 Counts/sec; raise after tuning.
Accel Acceleration limit 300000 Counts/sec².
Jerk Jerk limit 250000 Counts/sec³.
P Proportional gain 1.0 Reduce to 0.75 for first runs.
I Integral gain 0 Add after P/D is stable.
D Derivative gain 0.2 Increase first when raising bandwidth.
FFAccel Feed-forward accel 0 Leave off during initial tuning.
FFVel Feed-forward vel 0 Add last, after feedback loop.
MaxI Integrator clamp 200 Limits integrator windup.
MaxErr Output clamp 2000 Limits DAC output swing.
MaxOutput Final clamp 2047 Full ±10 V swing.
InputGain0/1 Encoder sign -1 / 1 Flips direction.
MaxFollowingError Fault threshold 10000 Reduce after tuning.

With these starting values the servo produces up to MaxErr × P = 2000 × 1 = 2000 DAC counts, well above the saturation point of 2047. The actual usable DAC output at start is limited by the integrator clamp and the integral term; with I = 0 the steady-state output is purely proportional to position error.

PID Tuning Methodology

Follow this ordered procedure. Do not skip steps or combine them; each step exposes instability caused by the previous gain.

Step 1 - Verify Direction and Magnitude

Use KMotion Console with a small position command (for example, 1000 counts). Verify the motor rotates in the commanded direction and that the encoder counter returns the matching sign. If direction is reversed, toggle InputGain0 between -1 and 1. Confirm that the commanded position equals the reported position.

Step 2 - Scale to Engineering Units

Determine the proper invDistPerCycle for the axis. With an 8192-count encoder, a 1:1 pulley, and a ballscrew of 5 mm pitch, the counts per millimeter are:

counts_per_mm = (encoder_counts_per_rev × gear_ratio) / ballscrew_pitch
             = (32768 × 1) / 5 = 6553.6 counts/mm

In KMotion, invDistPerCycle is the inverse of counts per user unit. For millimeter units:

invDistPerCycle = 1 / 6553.6 ≈ 0.0001526

Run a 10 mm jog in KMotionCNC and measure the actual motion with a dial indicator. Adjust invDistPerCycle until commanded and actual match.

Step 3 - Raise P Until Buzz

Start with P = 0.75, D = 0, I = 0, FFAccel = 0, FFVel = 0. Issue a small step or jog. Slowly raise P until the motor begins to buzz or oscillate audibly. Reduce P by 30 %.

Step 4 - Add D Gain

Damping is what allows higher P. Increase D from 0.2 in 0.05 increments. After each increase, attempt a small step response and observe the captured plot. A well-damped response shows a fast rise with one small overshoot and settles within 2-3 cycles. Continue until increasing D further causes noise or oscillation.

Step 5 - Add I Gain

Integral gain removes steady-state error. Start at I = 0.001 and double until response becomes oscillatory, then halve the final value.

Step 6 - Add Feed-Forward

Only after the feedback loop is stable and quiet should FFAccel and FFVel be added. Begin with FFAccel = 1.0 and observe whether the following error during acceleration drops. FFVel is typically the inverse of the velocity command scaling.

Following Error Diagnostics

The most common commissioning failure is a MaxFollowingError trip during fast jogs. The default threshold of 10000 counts is appropriate for a mill with 6553 counts/mm but tight for a 0.1 mm following error. If the axis faults at high jog:

  1. Capture a time-plot of the axis position, the commanded position, the following error, and the DAC output.
  2. Look at the following error curve. If it grows linearly during acceleration, the loop is bandwidth-limited: P is too low or D is too low.
  3. If the curve oscillates at a fixed frequency, the loop is unstable: reduce P first, then D.
  4. If the curve spikes sharply, the motor is hitting a mechanical hard stop or the DAC is saturating at MaxOutput.

Use KMotion Console's built-in capture buffer (up to several MB at high sample rates) to record the response, then export it to a CSV file for offline analysis. Exporting via the host PC application avoids the file-size limits imposed by forum attachment rules.

Tip: Always capture at least 1 second of pre-fault data. Most instability symptoms appear 100-500 ms before the fault is raised.

Index Pulse and Homing

Many Yaskawa CACR-SR motors have a once-per-revolution index (Z or C) channel on the encoder. The index is not required for normal operation, but it enables single-revolution homing accuracy. The C channel may be labeled X or Index on the encoder datasheet; it is a single narrow pulse at one absolute position per motor revolution.

Wire the index channel to any unused Kanalog A/B differential input pair (for example, JP2 channel 2 if axes 0 and 1 already use channels 0 and 1). In KMotionCNC's configuration, set the home search to first find a home switch (which locates the axis within one motor revolution) and then find the index pulse to establish an absolute reference.

For most retrofit applications where repeatability of 1 motor revolution is acceptable, the home switch alone is sufficient. Wire the index only if the application requires sub-revolution repeatability.

Drive Enable Circuit Detail

The CACR-SR's servo-on (S-ON) input is a 24 V logic signal referenced to the drive's internal 24 V supply. The KMotion Kanalog outputs are open-collector / open-drain drivers that can sink to ground when active. The recommended interposing circuit is:

JP5 output bit N → 1N4148 → relay coil (24 V) → 24 V common
                   (relay N.O.) → CACR-SR S-ON input
                   (relay N.O.) → CACR-SR DGND (return)

Use a relay rated for continuous duty at 24 VDC with a coil current under 100 mA. Add a flyback diode (1N4007) across the relay coil in reverse-bias. Sequence the enable logic in main():

  1. Define bit N as an output with SetBitDirection(N, 1).
  2. Drive the bit low during boot so the drive stays disabled until firmware initializes.
  3. After the PID gains and trajectory limits are loaded, call EnableAxis(0) and then SetBit(N) to energize the relay and assert S-ON.
  4. On any disable event, ClearBit(N) and then DisableAxis(0).

Encoder Noise and Position Drift

If KMotionCNC's DRO varies between two values (for example, 0.000 and 0.006 mm) when the axis is stationary, the encoder has noise on at least one of the differential pairs. Possible causes and remedies:

  • Missing shield termination: Bond the encoder cable shield to chassis ground at the drive end only. Do not bond at both ends; this creates a ground loop.
  • Routing: Keep the encoder cable at least 150 mm away from VFD output cables and AC servo power wiring.
  • Termination: The Kanalog encoder inputs are internally terminated for RS-422. If the encoder cable is very long (> 10 m), add an external 120 Ω resistor across A+/A- and B+/B- at the drive end of the cable.
  • Index pulse noise: If the index is connected, a noisy index line can inject noise into the home routine even when not in use. Tie the index lines to ground at the Kanalog end if they are not used.

An optical differential encoder (the type shipped with CACR-SR servomotors) is normally quiet if the cable is properly shielded. Magnetic or capacitive encoders can show 1-2 count jitter without external filtering.

Verification and Commissioning Checklist

Step Check Pass criterion
1 Direction +10 mm command moves DRO +10 mm
2 Scaling Measured motion within 0.02 mm of commanded
3 Step response One overshoot, settles in < 200 ms
4 Following error at max Vel < 50 counts steady state
5 Following error during Accel < 200 counts
6 MaxFollowingError trip Does not trip at 100 % rapid
7 Drive enable at boot Drive stays disabled until EnableAxis
8 Drive disable on stop S-ON clears within 50 ms of DisableAxis
9 Index homing (if used) Index found within 1 rev after home switch
10 E-stop S-ON clears, drive drops torque, no regen fault

Troubleshooting Matrix

Symptom Likely cause Remedy
Motor does not move on command S-ON not asserted; enable bit not set Verify SetBit(N) in enable handler; check 24 V at S-ON terminal
Motor runs away at enable Encoder sign inverted; feedback positive Toggle InputGain0 between -1 and 1
Axis trips MaxFollowingError at slow jog Encoder not connected; counter not incrementing Verify A/B signals with scope; check JP2 wiring
Axis trips at fast jog only Loop bandwidth too low Increase D, then P; raise MaxFollowingError temporarily
Buzz at standstill P too high; D too low Reduce P by 30 %; add D gain
Position drifts at standstill (1-2 counts) Encoder noise Improve shield termination; separate encoder and power cables
Step response oscillates with growing amplitude Loop unstable Reduce P first, then D; check InputGain0 sign
Following error offset during accel Missing feed-forward Add FFAccel after feedback is tuned
Following error offset during constant velocity FFVel missing or wrong sign Add FFVel equal to commanded velocity / DAC scale
Drive faults on enable S-ON rise time too fast; CACR-SR expects soft start Add 100 ms delay between SetBit and EnableAxis

Field-Proven Notes

  • The CACR-SR's speed reference input has an input impedance of approximately 20 kΩ. The Kanalog DAC can drive this directly without buffering.
  • The Yaskawa 8192-count encoders are four-edge-counting in KMotion, yielding 32 768 counts per motor revolution.
  • The default MaxFollowingError = 10000 corresponds to roughly 1.5 mm at the typical 6553 counts/mm scaling. Lower this to 500-1000 for production cuts to catch mechanical issues earlier.
  • When using a ballscrew with backlash greater than 0.05 mm, set BacklashMode = BACKLASH_OFF initially; add backlash compensation only after the basic loop is stable.
  • For feed-forward tuning, the rule of thumb is FFVel = 1 / (counts_per_unit_per_second_at_full_DAC). Calibrate empirically by adjusting FFVel to flatten the constant-velocity portion of the following-error plot.

What causes MaxFollowingError faults only at fast jog speeds?

The PID loop does not have enough bandwidth to keep up with the higher commanded velocity. Capture a following-error plot during the jog. If the error grows linearly during acceleration, the loop gain is too low. Increase D first (which adds damping and allows higher P), then increase P. Reduce MaxFollowingError only after the loop is stable; do not mask a real instability by raising the fault threshold.

How do I verify the encoder is wired correctly?

Use KMotion Console to read the encoder counter for axis 0 while manually rotating the motor by hand. The counter should increment smoothly in one direction, and the sign should match the commanded direction. If it decrements when you expected it to increment, invert InputGain0. If the counter does not change, check A+ and A- with an oscilloscope at the JP2 connector.

Can I use the encoder's Index (Z) channel for homing?

Yes. The Z channel provides one pulse per motor revolution and allows homing repeatability better than one motor revolution. Wire Z+ and Z- to an unused Kanalog A/B input pair (for example, channel 2 if axes 0 and 1 use channels 0 and 1). Home by first seeking a home switch, then seeking the index pulse within one motor revolution. If sub-revolution accuracy is not required, the home switch alone is sufficient.

How do I enable a 24 V relay coil from KMotion without an external supply?

KMotion Kanalog's JP5 outputs can sink up to 350 mA to ground. Wire the relay coil between the JP5 output and an external 24 VDC supply. Drive the output low to energize the relay. Add a 1N4007 flyback diode across the coil in reverse-bias. Set the bit low in main() before EnableAxis so the drive does not energize at boot.

Why does the position drift between two values at standstill?

The encoder signal has electrical noise. Optical differential encoders (such as those on Yaskawa CACR-SR motors) are quiet if the cable is properly shielded. Bond the cable shield to chassis ground at the drive end only, keep the encoder cable at least 150 mm from VFD and AC servo power wiring, and verify that 120 Ω termination is present on the Kanalog input. If the drift persists, capture raw encoder data with a scope to identify which edge is bouncing.

Should I tune Feed-Forward before or after PID?

Always tune PID first. Feed-forward is an open-loop correction that hides feedback problems rather than fixing them. If the position error remains non-zero during constant-velocity motion with PID only, the feedback loop is not actually settled; raising FFVel will mask that issue and produce poor low-speed performance. After P, I, and D are stable, add FFAccel and FFVel in that order, using the following-error plot to verify each addition.

Back to blog