Projects/STM32 EMG acquisition

EMG Acquisition & Monitoring System

STM32 firmware and a Python GUI that turn raw forearm EMG into stable RMS/MAV features at a nominal 4 kHz.

Role
Firmware & GUI
Platform
STM32F411CEU6
Sensor
DFRobot SEN0240
Stack
C · Python / Tkinter
Original test-setup photograph with illustrative signal trace
01 / Problem

Problem

Our team built a rehabilitation-hand system for an undergraduate thesis. It needed a dependable way to acquire surface EMG (the electrical activity of muscles), turn it into stable features, and show the whole system's state to an operator.

My part was the EMG acquisition and signal-processing subsystem, plus the full monitoring interface. Aldin focused on the stimulator and Zain on fuzzy-control design.

02 / Approach

Approach

SEN0240sEMG sensor, analog 0–3.0 V
STM32 ADC12-bit, timer-triggered DMA, nominal 4 kHz
Digital filters20 Hz HPF · 500 Hz LPF · 50 Hz notch
FeaturesRMS & MAV over 400 samples (~100 ms)
UART → GUI115200 baud · Python/Tkinter · CSV

Firmware processes ADC samples in half/full DMA buffers, filters them and computes RMS/MAV per window, then streams telemetry over UART. The Tkinter GUI parses the serial stream, plots EMG features, monitors status and logs to CSV. Coding agents assisted the implementation, and I reviewed and tested what they produced.

03 / Build gallery

Build gallery

04 / Results

Results

4 kHzNominal sampling (configured)
12-bitADC resolution
400Samples per feature window
Parser / loggerGUI self-test scope

The plots are from my thesis testing. Sampling rate and window size are firmware configuration. The GUI self-test checks the parser, safety logic and logger. It does not demonstrate clinical validity, rehabilitation effectiveness or full device safety.

05 / Lessons

Lessons

  • Breaking a sensor-to-screen problem into acquisition, processing, transport and display made each part testable.
  • Mains interference at 50 Hz is visible in the spectrum, so the notch filter earns its place.
  • Program configuration and measured results are separate claims, and I keep them separate.
  • AI assistance is useful when I read and check what it produces. I disclose it.

Original contribution notes (Bahasa Indonesia)

Source audit

The public repository contains signal-inspection tools and a binary-capture logger. It does not publish the complete thesis firmware or establish clinical validity.

15 November 2026. Reviewed source 9d822cf849cc. Source evidence index.

Navigate with arrow keys. Enter opens a result. Escape closes search.