AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Troubleshooting

Why a PID robot arm joint buzzes at setpoint

Servo and stepper motion Published 9 min read By AutomateDirectUSA engineering team

Short answer

A brushed-DC arm joint that buzzes at setpoint is almost never short of inertia data: the buzz is derivative gain acting on a quantized encoder count, or a stiction-and-integrator limit cycle. Read the raw count with the motor disabled, zero Kd, then zero Ki and watch for a slow hunt, and accept a one-count flicker as the measurement floor.

On this page
  1. The check order
  2. Read the raw count with the motor disabled
  3. Is the flicker one count or real motion
  4. Worked example: a 12 CPR encoder on a 1:19 printed joint
  5. Zero the derivative first
  6. Zero the integral and watch for a slow hunt
  7. Retune at the worst arm pose
  8. The fix order and the hold test
  9. Questions asked

A brushed-DC robot arm joint that buzzes at its setpoint is almost never short of moment-of-inertia data. On a printed arm with cheap DC motors and incremental encoders, the buzz comes from one of two places: derivative gain amplifying a quantized encoder count, or stiction and backlash fighting an integrator with no clamp. Zero the derivative term first, then the integral term, and read the raw encoder count with the motor disabled before you change anything else. A one-count flicker at rest is the measurement floor, not a fault; anything larger is the loop driving the joint. The checks below isolate the branch, the worked example turns one count into degrees at the joint, and each check ends with the fix for what it finds.

The check order #

Work the checks in this order. Each one rules out a branch before you spend time on the next, and the cheap checks come first.

  1. Disable the motor driver and read the raw encoder count at rest. Flicker with the motor off points at the signal path; a stable count clears the encoder and its wiring.
  2. Convert one count to degrees at the joint, then decide whether the flicker you see at setpoint is the measurement floor or real motion.
  3. Set Kd to zero. A buzz that stops dead was the derivative term amplifying quantization.
  4. Set Ki to zero and watch for a slow hunt. A hunt that stops was stiction and backlash feeding an unclamped integrator.
  5. Repeat the hold test with the arm extended. A joint that sits still folded and oscillates extended needs gains retuned at the worst pose.

Do not retune Kp against a noisy count. Fix the signal path first, because no gain set hides a wiring fault.

Read the raw count with the motor disabled #

Disable the driver output, move the joint by hand, let it rest, and watch the raw count in your debugger or serial console. Three outcomes, three different branches.

If the count flickers or jumps while the motor is unpowered, the fault is in the signal path. Separate the encoder A and B leads from the motor leads, twist and shorten them, confirm the encoder supply is clean, and tighten the encoder mount. PWM drive on brushed motors radiates into unshielded encoder lines, so phantom counts that appear only while the motor is driven point at this branch. If the encoder is driven through a printed coupling that has slipped or gone sloppy, remount it, or replace it with a flexible shaft coupling and re-run this check before touching any gain.

If the count sits still at rest and only moves when you move the joint, the encoder is sound. Move on to the gain checks.

If the count returns to a different value at the same pose after repeated moves, you are dropping quadrature edges. Check the counter configuration and the pulse rate against the loop speed before touching any gain.

Signal-path fixes cost an hour and no tuning effort, which is why this check comes first.

Is the flicker one count or real motion #

At rest, a flicker of one count is quantization, not a fault. The controller cannot see anything finer than one count, so at setpoint it nudges the joint back and forth across the last bit of the measurement. Accept it, and give the controller a deadband of one to two counts so it stops reacting to that last bit.

A flicker that grows into two counts or more of sustained travel is different: the loop is actively driving the joint, and the cause sits in the gains or the mechanics. Judge this from the count trace and the commanded output, not by ear, because cheap brushed motors whine under PWM at rest and that sound is not the fault.

The same floor, behind sound mechanics, is why servo systems can look like they hunt on CNC paths. And if you are choosing the encoder for a joint rather than diagnosing one, size its resolution to the loop's step response instead of taking the biggest count available, as worked through for stepper encoders matched to step response.

Worked example: a 12 CPR encoder on a 1:19 printed joint #

Example inputs for a typical printed-arm joint: take your encoder CPR from its datasheet and your gear ratio from your gearbox drawing; the loop time is an example for a 200 Hz loop.

  • Encoder resolution: 12 CPR on the motor shaft
  • Quadrature decode: ×4
  • Gear ratio, motor to joint: 19:1
  • Loop time: 5 ms

The rule, in words: counts per joint revolution equal encoder CPR times the decode factor times the gear ratio, and the joint resolution in degrees is 360 divided by that count. The factor of 4 assumes you decode A and B in quadrature; if your datasheet already quotes decoded counts, drop it.

The arithmetic:

  • 12 CPR × 4 = 48 counts per motor revolution
  • 48 × 19 = 912 counts per joint revolution
  • 360° ÷ 912 = 0.39° per count at the joint
  • 1 count ÷ 0.005 s = 200 counts per second of apparent velocity, which is what the derivative term sees each time the count steps once

Result: one count is worth 0.39° at this joint, and a single-count flicker at setpoint reads to the derivative term as 200 counts per second of velocity. At a 1 kHz loop the same flicker reads as 1000 counts per second, five times larger, so a faster loop amplifies the spike rather than smoothing it. This is a calculated example for these inputs, not a measured result.

Decision: a flicker held to one count is the loop running at its measurement floor, so deadband it and stop chasing it. Sustained travel of two counts or more is the loop driving the joint, and the next two checks find which gain is responsible.

Zero the derivative first #

Derivative gain acting on a quantized position is the most common cause of a buzzing joint. The derivative term computes roughly the change in counts per loop time, so a one-count step between samples becomes a large apparent velocity, and multiplying that by Kd turns every count transition into a command yank on the joint. Zero Kd and compare.

If the buzz stops, the derivative term was amplifying quantization. Take the derivative on the measurement rather than on the error, low-pass filter it, or estimate velocity across several samples, then bring Kd back up gradually until the buzz returns and back off from there.

If the buzz stays with Kd at zero, the oscillation is a limit cycle, and the integral check is next.

One caution on hardware: fitting an encoder does not settle a loop by itself. Even a motor that carries its own closed-loop hardware still needs tuned PID gains, which is the point why a phantom closed-loop stepper still needs PID gains makes for steppers with onboard encoders.

Zero the integral and watch for a slow hunt #

Command a setpoint, let the joint settle, and log the control output and the count together for a minute. A stiction-and-integrator limit cycle has a visible signature: the output ramps while the joint sits stuck, the joint breaks loose and jumps past setpoint, the integrator unwinds, and the cycle repeats as a slow hunt.

Brushed motors need a breakaway voltage to start moving, and printed gear trains add backlash, so the joint resists small corrections and then obeys them too well. An integrator without limits winds up through the stuck phase and guarantees the overshoot.

Zero Ki and watch the trace:

  • Hunt gone: clamp the integrator, reduce Ki, and add the standstill deadband. The integrator should hold the last bit of steady-state error, not swing the joint around setpoint.
  • Hunt still there with Ki at zero: the play is mechanical. If the encoder sits on the motor shaft, backlash in the gear train sits outside the feedback loop, and no gain set can close it. Tighten the gear mesh or move the sensing point onto the joint side. Moving the feedback to the load changes the loop enough that you must retune afterward, the same lesson as tuning a closed-loop stepper with linear scale feedback, where the loop is measured at the scale rather than the motor.

Retune at the worst arm pose #

Move the arm from folded to fully extended and repeat the same hold. Reflected inertia at the base joint rises as the arm extends, and the shoulder and elbow carry a gravity load that changes with angle, so gains tuned in one pose can oscillate in another.

Symptom at setpoint Likely cause Fix
Count flickers with the motor disabled Wiring or loose encoder mount Separate leads, secure mount, replace a worn coupling
Buzz at rest, gone at Kd = 0 Derivative on a quantized count Derivative on measurement, filtered
Slow hunt at setpoint, gone at Ki = 0 Stiction or backlash plus integrator Clamp the integral, deadband, lower Ki
Stable folded, oscillates extended Pose-dependent inertia Retune at the extended pose or schedule gains
Shoulder or elbow sags, then hunts Gravity load Gravity feedforward

Gravity feedforward on the shoulder and elbow removes the steady load the integrator would otherwise wind up and unwind through, which is what feeds the hunt on those joints.

Moment-of-inertia data earns its place after these checks pass. It feeds acceleration feedforward and gain scheduling and cuts following error during motion; it does nothing for a joint that buzzes at rest, because that jitter lives in the measurement chain and in how the controller differentiates it.

The fix order and the hold test #

Apply the fixes in this order and verify before you call it done. Keep a hand near the power switch while you change gains: an arm joint that starts hunting can swing hard the moment the integrator unwinds.

  1. Fix the signal path: separate encoder leads from motor leads, secure the mount and coupling, and re-run the disabled-motor count check until the raw count is stable at rest.
  2. Set Kd and Ki to zero and raise Kp until the joint responds without oscillating at the extended pose.
  3. Add Kd back with a low-pass filter or a multi-sample velocity estimate, taken on the measurement.
  4. Add Ki with an integrator clamp, plus the deadband if a slow hunt remains.
  5. Add gravity feedforward on the shoulder and elbow, and inertia-based acceleration feedforward if following error during motion is the next limit.

Verify with three logged runs, capturing count, commanded output and following error each time:

  • Hold test: a fixed setpoint for a long dwell. The count stays inside the deadband and the output stays quiet.
  • Pose test: repeat the hold folded and extended. No pose-dependent oscillation.
  • Step test: small and large steps in both directions. Overshoot and settling match, and the joint returns to the same count after a reversal; a mismatch means backlash or dropped edges.

Three efforts to skip:

  • Raising the loop rate to smooth the count: it makes the derivative spike larger.
  • Retuning Kp to hide a noisy encoder line: fix the wiring first.
  • Swapping motors to cure the buzz: the buzz is in the loop and the measurement, not the motor.

Worked in this order, the buzz resolves to one of three fixes: a clean count, a filtered derivative, or a clamped integrator, and the joint holds still.

Questions asked

Does moment-of-inertia data stop a robot arm joint buzzing at setpoint?

No. Inertia data improves feedforward accuracy and keeps gains valid across poses, so it cuts following error while the arm moves. Standstill buzz comes from the measurement chain and the gains acting on it: quantization, derivative action, or stiction with an unclamped integrator. Fix those first, use inertia data for motion quality, and rework the numbers whenever the payload or end-effector changes.

Why does the buzz get worse when I speed up the control loop?

The derivative term divides the change in counts by the loop time, so the same one-count flicker reads as a larger velocity at a shorter loop time. One count per millisecond reads as 1000 counts per second, ten times the reading of the same flicker at a 100 Hz loop. Shortening the loop amplifies quantization; filter or spread the velocity estimate instead.

How wide should the standstill deadband be?

Start at one to two counts and convert that to degrees so you know what you are accepting at the joint. In the worked example, two counts of standing play is about 0.8°, which is fine for a hobby arm and too loose for a pointer that must repeat tightly. If the application needs tighter, the answer is higher-resolution feedback at the joint or a finer gear ratio, not a wider deadband.

Should I filter the encoder count itself to calm the joint?

Filter the velocity or the derivative term rather than the position signal that feeds the loop. Filtering position inserts delay between the joint and the controller, and delay costs phase margin in a position loop, which shows up as overshoot and oscillation that look exactly like the fault you started with. A low-pass filter on the derivative or a velocity estimate averaged across several samples calms the derivative without shifting the position feedback.

Keep reading

  • Troubleshooting

    Servo Drive Over-Speed Alarm: Causes and Checks

    An over-speed alarm means the drive measured motor speed above the limit configured in its speed-limit parameter, not that the motor is broken. Confirm whether the limit, the command, the ramps, false encoder feedback, unstable tuning or a load that back-drives the motor put it there, cheapest first, and never raise the limit to silence a trip whose cause you have not confirmed.

    Servo and stepper motion

  • Troubleshooting

    Fix Servo Travel Error After Swapping Resolver and Encoder

    Travel that does not match the position display after a resolver-to-encoder swap is a scaling fault: the drive or the technology axis is still converting counts with the other feedback's increments per revolution. Measure one commanded move and divide actual by displayed travel; a constant ratio equal to the resolution ratio names the encoder data. Fix both layers, re-home, then re-tune.

    Servo and stepper motion

  • Explainer

    Mounting a Motor Encoder Behind a Belt Reduction

    No, not for commutation: field-oriented control switches phase current against the rotor's electrical angle, which only a sensor on the motor shaft reports directly. Behind a 10:1 belt, a 4096-count encoder gives about 410 counts per motor revolution — enough counts per pole to turn a 6-pole motor, but belt lash and multiplied noise put a load-dependent error inside the current loop. Use the belt-side sensor for velocity only; commutate from the motor shaft and add an output encoder if you need load position.

    Servo and stepper motion

Torque mode DAC voltage capped with load cell feedback