EMG-Controlled Communication

Translating muscle contractions into Morse code with analog EMG circuitry, adaptive signal processing, and a Python game interface. BE 3100 (MAD Lab).

Overview

Morse is a communication prototype that turns short and long muscle contractions into dots and dashes. For our BE 3100 final project, we combined an analog electromyography (EMG) circuit with wireless acquisition and an interactive letter-decoding game. The motivation was to explore muscle activity as an alternative input for people who find speech or conventional controls difficult to use.

Source code

Morse code game showing a target letter, live raw and smoothed EMG signals, and the input area
The Morse game, with a target letter, live EMG signal, and decoded input.

My Contribution

I developed the Python/PyQt5 Morse game, integrated incoming Bluetooth Low Energy EMG data with the game’s input and decoding logic, and built the calibration tool for recording rest, short flexes, and long flexes. I focused on making the live signal usable in the game, with adjustable detection settings and clear feedback.

From Muscle Activity to Symbols

The analog circuit conditions the electrode signal through filtering, differential amplification, buffering, rectification, and a final amplification stage. The Arduino streams samples at 1 kHz over Bluetooth Low Energy to a Python application.

A single threshold crossing is a poor representation of a contraction: noise can trigger spurious events, and a sustained flex can briefly dip below threshold. Our software therefore detects contraction segments before interpreting their duration:

  1. Smooth the signal. A moving average reduces rapid fluctuations, while an adaptive baseline tracks the resting signal between contractions.
  2. Detect a segment. Activity begins when the smoothed signal exceeds a margin above the baseline. Brief dropouts are tolerated so one flex does not become several symbols.
  3. Reject weak events. Very short events are discarded, and an accepted segment must spend a sufficiently large fraction of its duration above threshold.
  4. Decode its duration. The default 100 ms boundary separates dots from dashes. A pause completes the letter, which is checked against the game’s target.

The PyQt5 interface provides hints, scoring, and a challenge mode that hides the Morse pattern. A separate calibration tool captures rest, short flexes, and long flexes, then recommends detection thresholds and timing settings. These parameters are adjustable because the resting signal and contraction timing vary between users and recording sessions.

Presentation diagram of EMG filtering, amplification, rectification, Arduino acquisition, and Raspberry Pi motor circuitry
Our circuit design, from EMG signal conditioning to acquisition and peripheral control.

Results

In our classroom evaluation, the system correctly interpreted 39 of 40 trials (97.5%) across short-flex, long-flex, and no-flex actions. This was a small prototype test; understanding how well it works across users would need a larger study.

The main design challenge was preserving the timing of intentional contractions while suppressing noise. Smoothing and dropout tolerance help stabilize detection, but they also affect measured duration and must be tuned together. Extending the prototype to word entry would require evaluating longer sequences, error correction, fatigue, and performance after recalibration.

Skills Used

  • Hardware: analog EMG signal conditioning, Arduino, Raspberry Pi, Bluetooth Low Energy
  • Software: Python, PyQt5, Bleak, asynchronous event handling
  • Signal processing: moving averages, adaptive baselines, event segmentation, duration-based decoding