← Back to Deep Dive

Control Model

Overview

The control system maps EMG signal amplitude to servo position commands using a threshold-based proportional control strategy. The Raspberry Pi Zero 2 W runs a Python control loop at 100 Hz, reading EMG envelope data from the Arduino Nano and sending servo commands to the Raspberry Pi Pico.

This architecture achieves end-to-end latency of ~30 ms from muscle activation to servo motion, providing responsive feedback for natural interaction. The control model includes calibration, noise rejection, and safety limits to ensure reliable operation.

Control Loop Flowchart

Control loop flowchart

State machine and control flow from EMG input to servo actuation.

Calibration Routine

  1. 1.Baseline measurement: User relaxes hand completely for 5 seconds. System records minimum EMG envelope value (noise floor).
  2. 2.Maximum voluntary contraction (MVC): User flexes forearm muscles at maximum effort for 3 seconds. System records peak EMG envelope value.
  3. 3.Threshold calculation: Activation threshold set to baseline + 20% of (MVC - baseline). This provides comfortable activation without false triggers.
  4. 4.Proportional gain: Servo range (0°–120°) mapped linearly to EMG range (threshold to MVC).

Calibration values are saved to a config file and persist across sessions. Recalibration is recommended when electrode placement changes or after ~1 hour of use to compensate for muscle fatigue.

Design Notes

  • Noise rejection: Moving average filter (window size 5 samples) smooths EMG envelope and reduces jitter.
  • Hysteresis: Activation threshold and deactivation threshold differ by 10% to prevent oscillation near threshold.
  • Safety limits: Servos limited to 120° maximum rotation to prevent over-flexion and mechanical damage.
  • Latency breakdown: EMG sampling (2ms) + serial transfer (5ms) + Python processing (8ms) + I²C to Pico (3ms) + servo response (12ms) ≈ 30ms total.

Performance Metrics

MetricValueNotes
Control Loop Rate100 Hz10ms update interval
End-to-End Latency~30 msMuscle activation to servo motion
Servo Range0°–120°Maps to ~90° finger flexion
False Activation Rate<2%With proper calibration