minjun_park
Smoothing Frequency Detector Servo
I’m driving a standard 180 servo on D1 of an EZ-B v4 (Wi-Fi client mode) using the Frequency Detector skill to follow pitch. Windows default recording device is a Blue Snowball USB mic about 20 cm from a tone source (phone app sine and also an actual piano). In Frequency Detector I set Min Freq = 200 Hz, Max Freq = 800 Hz and mapped the servo range to 30-150. I also configured the skill to write the detected value to a variable named $fd_freq. The waveform shows clean input, but the Frequency Output bounces: when I play A4 (440 Hz), it jumps between ~430-470 and sometimes halves to ~220 or doubles to ~880. The servo then chatters as ARC keeps sending new positions.
What I’ve tried so far:
- Reduced Windows mic gain and disabled AGC/noise suppression; tried 44.1 kHz and 48 kHz sample rates.
- Moved mic closer and isolated it from the robot’s speaker to cut feedback.
- Narrowed the min/max range to 350-500 Hz to focus on the fundamental.
- Ticked the Pause checkboxes to confirm the jitter is coming from the detected value (it is), but that just stops motion.
Questions:
- Is there a built-in smoothing or hysteresis setting in Frequency Detector (e.g., averaging window or update interval) that I’m missing?
- If I set ServoSpeed for D1 in ARC, will that apply to movements generated by the Frequency Detector’s servo mapping, or do I need to script my own rate limit based on $fd_freq?
- Any best practices to lock onto the fundamental to avoid the (1/2x, 1x, 2x) harmonic jumps when controlling an EZ-B v4 servo from this skill?
What’s the recommended way in ARC to stabilize this setup so the servo tracks pitch smoothly without twitching?
Related Hardware (view all EZB hardware)
Related Robot Skills (view all robot skills)

Yes - what you’re seeing is typical pitch-tracking jitter from FFT-based detection, especially when a tone has strong harmonics or the detector briefly "locks" to 1/2x or 2x of the fundamental.
Short answers
1) Built-in smoothing / hysteresis?
The Frequency Detector skill does not provide a user-facing smoothing window or hysteresis control for the detected frequency output.
So if the output is bouncing, the usual fix is to smooth the value yourself before driving the servo.
2) Will ServoSpeed help?
Yes, if the servo is being moved by ARC’s servo position updates,
ServoSpeedcan help reduce chatter by slowing how fast the servo responds to rapid position changes.However, for best results, I’d still recommend rate limiting / filtering the frequency in a script before mapping it to the servo. That gives you control over:
3) How to stabilize pitch tracking?
Best practice is usually a combination of:
Recommended ARC approach
Instead of sending the detected value straight to the servo skill, use the
$fd_freqvariable in a script and smooth it first.Simple smoothing example in JavaScript
This example:
$fd_freqD1Add ServoSpeed too
If you want the servo itself to move more gracefully, set its speed as well:
You can do that once in an initialization script or at project start.
A moderate value like 4-6 is usually a good starting point.
Reducing octave jumps
Those ~220 Hz / ~880 Hz jumps are harmonic-lock issues. To reduce them:
Option A: constrain the expected octave
If you know the note should be around 440 Hz, only accept values near that range.
Example logic:
Option B: compare to last good value
If the new frequency is about:
then reject it unless it stays there for several samples.
Option C: use a stronger fundamental source
A piano can be tricky because the overtone content is strong. A pure sine tone is much easier for the detector than piano. Your phone sine app is the better test source.
Practical tuning tips
Try this progression:
ServoSpeedto 4-6That usually gives a much calmer servo response.
Best ARC setup recommendation
For a stable pitch-following servo:
Servo.setPosition(d1, pos)Servo.setSpeed(d1, 4-6)That’s generally better than relying on direct skill-to-servo mapping when you need smooth behavior.
If you want, I can help you build one of these:
If you’d like, I can write a version specifically for your D1 servo and your 200-800 Hz range.