How raghavsai-tirupati/emg works
This firmware recognizes five hand gestures from forearm EMG and reports the label, confidence, and features over BLE and serial. Its principal workflow is 1 kHz acquisition, 256-sample window processing, feature extraction, and nearest-centroid classification. A separate control task supports serial-driven calibration, with the model persisted in NVS. The README documents these runtime stages, but the main sketch was not sampled, so internal task wiring beyond documented responsibilities is not inferred.
Main entry points: emg_firmware.ino Feature extraction · classifier.h Gesture classifier · fft.h Radix-2 FFT
Components 14
Signal acquisition
- Sampler task
emg_firmware/emg_firmware.ino - Sampling timer ISR
emg_firmware/emg_firmware.ino - Sample windows
emg_firmware/emg_firmware.ino
Gesture recognition
- DSP task
emg_firmware/emg_firmware.ino - Feature extraction
emg_firmware/emg_firmware.ino - Radix-2 FFT
emg_firmware/fft.h - Gesture classifier
emg_firmware/classifier.h
Calibration and output
- Control task
emg_firmware/emg_firmware.ino - Calibration model
emg_firmware/classifier.h - BLE task
emg_firmware/emg_firmware.ino
Other components
- MyoWare sensor
- Serial console
- BLE client
- NVS storage
Connections 12
- MyoWare sensor → Sampler task: provides signal
- Sampling timer ISR → Sampler task: clocks sampling
- Sampler task → Sample windows: fills windows
- Sample windows → DSP task: supplies samples
- DSP task → Feature extraction: extracts features
- Feature extraction → Radix-2 FFT: computes spectrum
- Feature extraction → Gesture classifier: classifies vector
- Control task → Serial console: reads commands
- Control task → Calibration model: collects samples
- Calibration model → Gesture classifier: provides model
- Gesture classifier → NVS storage: saves or loads
- BLE task → BLE client: notifies results