Project Info
What it does Our system predicts muscle failure up to 40 seconds before it happens. We use an electromyography (EMG) sensor to measure muscle activation, and process this data using Python. We calculate the Root Mean Square (RMS) of the voltage and Median Domain Frequency (MDF), and using these values we can estimate the time duration before a muscle fails. These values and the estimated time are provided in a web dashboard.
Inspiration
Since we each have medical backgrounds, we explored medical devices to address unsolved problems. We found an opportunity in muscle fatigue detectors: there are expensive options available for athletes, but none targeted towards other professions. We decided to focus on high precision occupations where the likelihood of muscle fatigue is high and may lead to dangerous outcomes. With our tool, we hope that injuries or mistakes can be prevented before they occur!
How we built it
The hardware includes an ESP32, Myoware 2.0, ECG pads, and code written in Python. At a high level, a calibration step records the strength of an individual, and then python records the EMG signal in distinct batches. From there we obtain Root Mean Square values (the number of motor units firing), and the Median Domain Frequency (the frequency at which motor units fire). These are used to create a global trend which is then updated further using Bayesian statistics. The global trend allows us to infer the Time to Failure.
Challenges we ran into
The biggest challenges included dealing with a weak signal, tuning parameters, how to measure TTF appropriately, and defining what failure is. Experimentation and iteration allowed us to identify solutions to each of these issues, but there is still space for improvement. We are excited to expand our prediction model to non-isometric movements in the future.
Accomplishments we're proud of
Since none of us have software backgrounds, we were nervous to take on a project that would push us far outside our comfort zones. However, we were able to work together effectively and use the provided tools to make a product that works better than we imagined. Additionally, it was the first hackathon experience for all of our team members! We had lots of fun and made great memories!
What we learned
We have powerful tools around us A lot can be accomplished within a weekend Go outside of your comfort zone Splitting up work and trying different strategies at the same time can help for quick iteration Fitting for data without a trained model is difficult Variation between subjects can be hard to account for
What's next
We are all graduating from Stanford following this quarter! Nathan will be working at SpaceX where he will help send the next generation of rockets to space as a Components Engineer. Eric will be pursuing medical school at the University of Alberta where he will bridge the gap between cutting edge research and clinical practice. Lastly, Dhruv will be entering into the medical devices industry, hoping to help push the boundaries of bio-innovation through cutting edge medical devices.
Treehacks 2026 - EMG Fatigue Analysis Dashboard
This project implements a real-time EMG fatigue analysis dashboard using Streamlit. It captures EMG data, processes it to calculate RMS and Median Frequency (MDF), and visualizes muscle fatigue indicators.
Features
- Real-time EMG Monitoring: visualizes raw EMG signals.
- Fatigue detection: Calculates RMS and MDF to detect muscle fatigue.
- Time-to-Failure Prediction: Estimates time remaining before muscle failure based on MDF trends.
- Calibration: Automates calibration based on the first 5 seconds of stable data.
- Data Recording: Saves session data to CSV files for further analysis.
Hardware Requirements
- ESP32 with EMG sensor
- Serial connection to the PC
Installation
- Clone the repository.
- Install the required dependencies:
pip install -r requirements.txt
Usage
To start the dashboard, run:
streamlit run src/dashboard.py
Project Structure
src/: Contains the source code (dashboard.py,core_logic.py,session.py).data/: Directory for storing recorded EMG data (ignored by git).- Contains CSV files with raw EMG recordings.
- Columns include:
Timestamp,Value(ADC reading). - Used for playback mode and data analysis.
agents/: Contains agent-related documentation.firmware/: Contains ESP32 firmware code.
License
Creative Commons Attribution-NonCommercial 4.0 International License
Analysis
View
Metric
- 45
- 1
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- PythonIn code
- StreamlitIn code
- Google GeminiClaimed
2 of 3 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
39 KB
Source files
7
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
ericyin23/Flexion-Detection-TreeHacks-2026
14 files · 1.1 MB · @ 7357289
Structure
Application logic
10 files · 71%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python95%
- Markdown5%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
requirements.txt
pypi · 8- matplotlib
- numpy
- openpyxl
- pandas
- pyserial
- scikit-learn
- scipy
- streamlit
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.