TokyoTinker
Running ARC directly on a Radxa Rock Pi X (Windows, WiFi) mounted in a small rover. I’m using the Frequency Detector skill to move a pan servo on an EZB v4 over WiFi when a 440 Hz tone is played (tuning fork or phone tone generator). In the skill config, I set Min 200 Hz / Max 1000 Hz, mapped to D0 with servo Min 30 / Max 150, and I also set the variable output to $detectedHz. Windows default recording device is the Rock Pi X 3.5mm headset mic input (TRRS). Enhancements (AGC/Noise Suppression) are off, Exclusive Mode off, tried 16bit 44.1 kHz and 48 kHz.
The issue: the frequency readout jumps around (e.g., 430-470 Hz) even with a steady 440 Hz sine from 10 cm away, and the servo jitters constantly. Min/Max in the skill quickly widens, implying it’s seeing extra peaks. If I switch to a USB condenser mic, it’s better but still drifts a few Hz and occasionally spikes. The waveform looks reasonably clean, but numeric output is still bumpy. I understand multiple frequencies cause noise, so I muted all playback to avoid feedback and tried moving the mic away from the Rock Pi’s tiny speaker; still jittery.
I tried smoothing with a JavaScript loop that reads the skill’s variable and averages it before moving the servo:
let samples = [];
function loop() {
const f = getVar("$detectedHz");
if (typeof f === "number" && f > 0) {
samples.push(f);
if (samples.length > 8) samples.shift();
const avg = samples.reduce((a,b)=>a+b,0)/samples.length;
const clamped = Math.min(Math.max(avg, 200), 1000);
const pos = Math.round(30 + (clamped - 200) * (120 / (1000 - 200)));
Servo.setPosition("D0", pos);
}
setTimeout(loop, 50);
}
loop();
Questions: Is there a recommended way within the Frequency Detector to set a minimum amplitude/peak lock or add median filtering, and are there known Windows/driver tweaks specific to the Rock Pi X headset mic that help produce a more stable singlefrequency read for servo control?
Related Hardware (view all EZB hardware)
