XV Lidar Bridge icon XV Lidar Bridge — Neato XV LIDAR integration for ARC with live radar, 8-zone obstacle detection, NMS support, calibration, and scan watchdog monitoring Try it →
Asked
1 Participant
PWM Servo Feedback jitter on EZ-B v4

PWM Servo Feedback Jitter On EZ-B V4

I’m adding positional feedback to a pan/tilt rig on an EZ-B v4 over WiFi and using the PWM servo Feedback (ADC) robot skill to read a modified MG996R’s pot. The tilt servo signal is on D1, and I’ve soldered a 4th wire from the pot wiper to ADC0. Servos are powered from a 6V BEC, EZ-B v4 is powered from the same 2S LiPo, and grounds are tied at the EZ-B. In the skill’s config I set ADC0 for the servo on D1 and ran Auto-Calibrate. It finds a range, but the reported position jitters a lot when the servo is holding load or moving slowly. For example, at a fixed physical angle, the reading flutters 5-10% and sometimes spikes momentarily to an extreme, which throws off my mapping and occasionally triggers the min/max limit in the control.

I tried manual calibration, moving the feedback to ADC1, different routing for the wiper lead, and swapping to a different MG996R. I also added a 0.1 F cap from ADC0 to GND which reduced the fast noise but added noticeable lag. As a test, I averaged 10 samples in a small JavaScript script and it looks smoother, but the robot skill UI still shows the jumpy value:

var sum=0;
for (var i=0; i<10; i++) { sum += getADC(0); Sleep(5); }
var avg = sum/10;
print("ADC0 avg: " + avg);

Another wrinkle: the angle reported by the PWM servo Feedback (ADC) control doesn’t line up with commanded angles. After calibrating, Servo(D1, 90) tends to report ~60-70 on the feedback, and this offset varies with load and after the servo warms up.

What’s the recommended wiring/filtering and calibration workflow for stable, correctly scaled feedback on EZ-B v4 with PWM servo Feedback (ADC)-should I add a series resistor and specific RC filter to the wiper, or a divider, and are there ARC settings to smooth without adding unacceptable lag?



Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4 with Synthiam ARCx controls servos, sensors, camera and audio over Wi-Fi or USB serial, no firmware needed.
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

Related Robot Skill (view all robot skills)
Add ADC positional feedback to hobby PWM servos via minor mod to EZ-B/Arduino; enables real-time position readout, calibration and puppet mirroring

ARC Pro

Upgrade to ARC Pro

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#1  

You’re very close - but PWM servo Feedback (ADC) is only as stable as the servo’s pot signal and power integrity, and on an MG996R-class analog servo it’s normal to see some jitter. That said, 5-10% flutter and occasional spikes are not something I’d consider "good enough" for a pan/tilt feedback loop in ARC.

What’s happening

Your symptoms point to a combination of:

  • potentiometer noise from the servo itself
  • power rail noise / current spikes when the servo is holding load or moving slowly
  • a long or noisy feedback wire acting like an antenna
  • load-dependent mechanical slop/backlash in the servo gears
  • possible ADC input instability from the feedback line being too "raw"

The key point: the robot skill is reading the ADC directly, so if the analog signal jitters, the skill will display it. Your JS averaging test proves the hardware signal can be smoothed, but the skill itself does not apply that kind of filtering by default.

For PWM hobby servo feedback on EZ-B v4 ADC ports, the best practice is:

1) Use a short feedback wire

Keep the wiper lead as short as possible.

2) Add a small series resistor to the ADC input

Put a 1k to 4.7k resistor in series between the servo wiper and ADC0.

This helps isolate the ADC input and reduce spikes without heavily delaying the signal.

3) Add a small capacitor at the ADC pin, not a huge one

Instead of 0.1 F, use something in the 0.01 F to 0.1 F range from ADC0 to GND as a noise filter.

  • 0.1 F is far too large for this use case
  • a large capacitor will absolutely create lag and make the feedback sluggish

A good starting point is:

  • 1k series resistor
  • 0.1 F capacitor to ground

If the signal is still too noisy, try:

  • 2.2k series resistor
  • 0.047 F capacitor

About the offset and scaling mismatch

This part is important: the feedback position will not perfectly match the commanded servo angle unless the mechanical center, pot travel, and servo travel are aligned.

Reasons include:

  • servo gear backlash
  • pot nonlinearity
  • internal deadband in the servo’s control board
  • load shifting the physical stop point
  • "90" command not being the true center of that specific servo

So if Servo(D1, 90) reports 60-70, that usually means one of these is true:

  • the feedback range is calibrated against the wrong end points
  • the servo’s physical neutral is not centered
  • the gear/pot relationship is offset
  • the servo is under load and not reaching the exact expected position

Best calibration workflow

Here’s the workflow I recommend in ARC:

1) Disconnect external load first

Calibrate the servo with the pan/tilt arm unloaded if possible.

2) Manually center the servo mechanically

Set the servo to a known midpoint and mount the horn so the mechanism is centered physically, not just in software.

3) Use Auto-Calibrate with clean extremes

Move the servo to its true safe minimum and maximum under light/no load, then run auto-calibration again.

4) Verify the feedback endpoints

Check what ADC values correspond to:

  • full one direction
  • center
  • full other direction

Then map those values in ARC to the servo range you actually want.

5) Expect some load drift

If the arm is holding weight, the reported angle may shift a little. That’s normal for analog hobby servos.

Should you use a divider?

Usually no, not for the pot wiper feedback on a servo that is already powered from the EZ-B-compatible range.

A divider is generally only needed if:

  • the feedback signal exceeds ADC limits
  • you’re interfacing a nonstandard sensor voltage

For a servo pot wiper, the better solution is series resistance + small capacitor + good grounding + short wire.

ARC settings to smooth it

The PWM servo Feedback (ADC) skill itself does not give you the kind of configurable digital filtering you’re looking for.

The better ARC approach is:

  • let the robot skill do the raw feedback reading
  • use a JavaScript script to read the ADC and apply averaging, median filtering, or a moving average
  • use that filtered value for your logic instead of the raw UI reading

That is the more reliable and standard solution in ARC.

Example of a simple moving average:

var samples = 10;
var sum = 0;

for (var i = 0; i < samples; i++) {
  sum += ADC.get(ADC0);
  sleep(5);
}

var avg = sum / samples;
print("ADC0 avg: " + avg);

If you want to reject spikes, a median filter is often better than a plain average.

My recommendation for your setup

For a stable pan/tilt rig, I’d do this:

  • short wiper wire
  • 1k series resistor
  • 0.047-0.1 F capacitor to GND at the ADC pin
  • solid shared ground
  • calibrate unloaded
  • use script-side filtering for anything that must not spike
  • don’t expect load-bearing analog servos to report perfectly identical positions at all times

One more important note

If your application depends on precise, repeatable position feedback under load, a modified hobby servo is not the best platform. A smart servo or a servo system with true position reporting will be much more stable. In ARC, that’s where a driver like Dynamixel or another feedback-capable servo skill becomes a much better choice than hacking an MG996R.

You may want to look at the servo docs here as well:

If you want, I can help you with either of these next steps:

  1. design a better RC filter for your exact wire length and servo, or
  2. write a JavaScript filter in ARC that smooths the feedback without too much lag.

What’s the end goal for the pan/tilt - object tracking, camera aiming, or just position hold?

I am a customer support AI and still learning. Please verify important answers in our support documentation. For advanced AI features, use the AI Script Agent built into ARC.