Maestro Servo Controller icon Maestro Servo Controller — USB control for Pololu Maestro (6/12/18/24) via ARC Vx ports. Maps Vx to Maestro channels; supports position, speed, acceleration, release. Try it →
Asked
1 Participant
Sharp IR Radar spikes on InMoov head

Sharp IR Radar Spikes On Inmoov Head

I’m using ARC on Windows with an EZInMoov Robot Head (EZB v4 over WiFi). I added a Sharp GP2Y0A21YK (10-80 cm) under the chin on a micro servo so the head can do a little "who’s there?" sweep. The sensor is powered from a 5V buck (set to ~5.05V), its analog out goes to ADC0, and grounds are tied to the EZB ground. The sweep servo is on D5. In the Sharp IR Radar robot skill I’m scanning roughly 50-130 with small steps.

What I’m seeing: when the scan servo moves, the Sharp IR Radar display’s red dot will occasionally jump to near +5V or drop to 0V for a frame or two, which falsely triggers my proximity logic; when the servo is still, the readings are rock solid. Confirmed with a separate script sampling ADC0 that the spikes coincide with servo motion.

What I’ve tried so far:

  • Separate BEC for the scan servo (grounds common to EZB) - improved but not eliminated
  • Added 100 F bulk + 0.1 F decoupling at the sensor
  • Twisted pairs and moving the analog lead away from servo wires, plus a small ferrite
  • Reduced servo speed and increased step delay in the Sharp IR Radar skill
  • Left Movement Panel integration disabled (this is just a head, no drive)

A few questions: does the Sharp IR Radar skill apply any averaging or a postmove settle delay before sampling, or expose a filtered variable I can read instead of raw ADC? Is there a recommended way in ARC to synchronize sampling to occur only after each servo step settles? And on the wiring side, is it safe/wise to add a small RC filter (e.g., 1 k series + 0.1 F to GND) on the analog output given the EZB ADC input impedance, or is there a better grounding/star topology you recommend for this setup?

What’s the best ARCside approach (settings or scripting) and wiring practice to eliminate the Sharp IR Radar spikes on my EZInMoov head when the scan servo moves?



Related Hardware (view all EZB hardware)
EZ-Inmoov Robot Head by EZ-Robot & Gael Langevin
EZ-InMoov Robot Head with Synthiam ARCx: face tracking, speech recognition, Talk Servo jaw motion and AI conversation
Wi-Fi
Servos 8
Camera
Audio
UART ✕
I2C
ADC 2
Digital 8

Related Robot Skills (view all robot skills)
ADC Graph by Synthiam
Historical ADC graph and numeric readout (0-255) for 0-3.3/5V inputs; configurable board/port, sample interval, color, and pause for ezb controllers.
Sharp IR Radar by Synthiam
Radar-style Sharp IR scanner for EZB ADC: sweeps sensor, displays distance dots, logs ADC voltage, and can steer/avoid obstacles via Movement Panel

ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#1  

Yes - what you’re seeing is a classic servo-noise / ADC-sampling timing issue, and the better ARC approach is to stop relying on the Sharp IR Radar skill’s raw live sampling during motion and instead control the scan and sample timing yourself.

Short answer

  • Sharp IR Radar does not give you a special filtered output variable that replaces the raw ADC stream.
  • It also doesn’t provide a built-in "wait until servo settles, then sample" feature in the way you need here.
  • The most reliable fix is:
    1. Move the servo in small steps
    2. Wait for it to settle
    3. Take multiple ADC samples
    4. Use the median or average
    5. Ignore outliers

That gives you much better results than trying to read the sensor continuously while the servo is in motion.


Why this happens

Even if the sensor is on a separate 5V regulator, a moving servo can still inject noise through:

  • shared ground impedance
  • current spikes on the power distribution
  • EMI coupling into the analog wire
  • momentary ADC reference disturbance on the EZ-B side

So the spikes you’re seeing near 0 or +5V are very likely not "real" distance changes - they’re glitches in the ADC reading.


Best ARC-side solution

Use a custom JavaScript script instead of relying only on the Sharp IR Radar skill.

That way you can:

  • command the servo
  • wait a short time
  • take multiple ADC readings
  • reject bad samples
  • only accept stable values

Here’s a simple example:

function median(values) {
  values.sort(function(a, b) { return a - b; });
  var mid = Math.floor(values.length / 2);
  if (values.length % 2 === 0) {
    return (values[mid - 1] + values[mid]) / 2;
  }
  return values[mid];
}

function readStableAdc(port, samples, delayMs) {
  var readings = [];

  for (var i = 0; i < samples; i++) {
    var v = ADC.get(port);
    
    // Reject obvious spikes
    if (v > 5 && v < 250) {
      readings.push(v);
    }

    sleep(delayMs);
  }

  if (readings.length === 0) {
    return -1;
  }

  return Math.round(median(readings));
}

var servoPort = d5;
var adcPort = ADC0;

for (var pos = 50; pos <= 130; pos += 5) {
  Servo.setPosition(servoPort, pos);

  // Let the servo physically settle
  sleep(120);

  // Take several samples and use the median
  var stableValue = readStableAdc(adcPort, 7, 15);

  print("Servo " + pos + " => ADC " + stableValue);

  // If you want, store/use stableValue here instead of raw ADC
}

Why this is better

  • The ADC is only trusted after the servo settles
  • A single bad sample won’t trigger your logic
  • You can tune the delay and sample count for your exact head mechanics

About the Sharp IR Radar skill

The built-in Sharp IR Radar skill is useful for visualization, but it’s not the best tool for precision sampling during servo motion.

If your project goal is:

  • scan the environment
  • detect obstacles reliably
  • avoid false triggers

then a scripted scan loop with filtered reads is the proven better method.

If you want, I can help you convert your scan into a proper ARC JavaScript state machine or a custom robot skill: https://synthiam.com/Support/Create-Robot-Skill/Overview


Wiring / filtering advice

RC filter

Yes, a small RC filter can help, but use it carefully.

A common starting point is:

  • 1 k series resistor
  • 0.1 F capacitor to ground

That gives a mild low-pass filter and usually won’t hurt an analog sensor like the GP2Y0A21YK too much.

But:

Don’t make the filter too heavy or you’ll:

  • slow response
  • distort rapid changes
  • make the sensor feel "laggy"

Better practice than only RC filtering

Use this stack of improvements:

  1. Keep the analog lead short
  2. Run signal and ground as a pair
  3. Keep sensor wiring away from servo power wires
  4. Use a star-style ground return if possible
  5. Decouple near the sensor
  6. Read only after servo motion settles
  7. Median-filter the samples in software

That combination is usually much more effective than any single hardware trick.


Important note about the Sharp sensor’s power

The GP2Y0A21YK is generally happiest at 5V, so your regulated ~5.05V sounds fine.

Just make sure the sensor output is still safely within the EZ-B ADC range and that the ADC reference is not being polluted by servo noise on the shared ground path.


What I would do on your head

For an EZ-InMoov head specifically, I’d recommend:

  • Do not sample while the scan servo is moving
  • Move to position
  • Wait 100-150 ms
  • Take 5-9 ADC samples
  • Use median
  • Reject 0 and 255-style outliers
  • Optionally sample twice and confirm the reading before acting

That will be much more stable than continuous radar scanning.


One more ARC best-practice tip

If you’re already building logic around this, consider moving the behavior into a dedicated script or robot skill instead of mixing it into the radar display skill. That gives you complete control over timing, filtering, and thresholds.

Questions like this are often best handled with the ARC AI Assistant directly inside the script editor - it can help rewrite the scan logic for you: https://synthiam.com/Products/AI-Assistant


My recommendation for you

Best overall fix:

  • keep the hardware improvements you already made
  • add a small RC filter if needed
  • replace raw radar-trigger logic with a scripted scan + settle + median read

If you want, I can write you a complete ARC JavaScript scan script for your EZ-InMoov head that:

  • sweeps D5
  • waits for settling
  • reads ADC0
  • filters spikes
  • returns a clean distance value for your "who’s there?" logic

Also, what’s the end goal of the sweep - simple obstacle detection, person detection, or face/approach tracking?

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.