Recorder icon Recorder Record and replay EZB communications (servo & digital commands) with forward/reverse playback, save recordings and trigger them from scripts Try it →
Japan
Asked

Sound Servo Lag And Mouth Twitch On ESP32

I’m driving a jaw servo from an ESP32 DevKit v1 (no camera) running the Synthiam ESP32 firmware over WiFi, and using the Sound servo (PC Speaker) skill to make the mouth move with TTS/music. Hardware details: MG996R on D14 (GPIO14, one of the safe pins), powered from a 5V/3A BEC with common ground to the ESP32, ARC connected as Board 0 to 192.168.1.83. The servo responds and the Sound servo level meter looks great, but I’m getting two issues: 1) about 1-2 seconds of lag between the audio and the jaw motion, and 2) when audio stops, the jaw keeps doing tiny twitches like it’s chasing background noise.

What I’ve tried:

  • Verified Windows default playback is the builtin speakers (also tried a wired 3.5mm speaker; avoided Bluetooth to rule out BT latency).
  • Adjusted Min/Max Position and Scalar in the Sound servo skill; motion scale changes but lag/twitch remain.
  • Servo works instantly if I move it with the standard servo control, so WiFi latency seems low.
  • CPU usage on the PC is low and ARC is otherwise snappy.
  • Ensured the servo is on a safe pin and tested D12/D15 with same results.

Questions:

  • Does Sound servo have an internal buffer or update rate I can reduce to eliminate the 1-2s delay?
  • Could ServoSpeed be causing the lag, and should I explicitly zero it at startup like:
ServoSpeed(D14, 0)
  • Is there a recommended way (script or setting) to add a small noise gate/deadband so the jaw holds still when levels are near silence?

What’s the best practice in ARC to remove the lag and add a noise floor for a smooth mouth on an ESP32-based EZB?



Related Hardware (view all EZB hardware)
Esp32 by Espressif
Control ESP32 boards with Synthiam ARC: EZB-like firmware for GPIO, PWM/servos, serial, WiFi modes, safe pins, wiring and power tips.
Wi-Fi
Servos Varies
Camera
Audio
UART Varies
I2C
ADC Varies
Digital Varies

ARC Pro

Upgrade to ARC Pro

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.