EMG Wristband

Static README snapshot; an interactive deployment can be added later.

EMG Wristband Data Tools

This repo contains two Python tools for an 8-channel UART EMG wristband:

Install

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt

Tkinter is included with most Windows Python installs. If the GUI fails to import `tkinter`, install a Python distribution that includes Tcl/Tk.

UART Format

The collector expects one ASCII CSV row per sample:

sample_idx,ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8

Example:

1024,512,498,503,510,520,507,499,501

Raw samples are saved unchanged. Filtering, scaling, and feature extraction are only used for the live display.

Collect Data

python tools\emg_collect_label.py

Default hotkeys:

The automatic session cycles through:

rest, thumb_tap, thumb_swipe_left, thumb_swipe_right, index_flex, pinch

Each trial is saved with active-phase row indices in `trials.csv`. The training script uses only that active phase by default.

Train Models

After saving `samples.csv` and `trials.csv`:

python tools\train_emg_models.py --samples data\samples.csv --trials data\trials.csv --epochs 40

The script trains and tests:

It prints accuracy, a confusion matrix, parameter counts, and saves the best model to `runs/best_model.pt`.