A Python lab project exploring NMES (Neuromuscular Electrical Stimulation) and TENS (Transcutaneous Electrical Nerve Stimulation) protocols via Bluetooth Low Energy.
Lab Project: This is experimental research software. Use responsibly with proper medical guidance. See LEGAL.md for details.
- Connects to BLE-enabled NMES/TENS devices
- Runs evidence-based stimulation protocols
- Real-time parameter control and monitoring
- GUI (PyQt6) and CLI interfaces
- Dual-device support for bilateral sessions
# Clone and setup
git clone <repository-url>
cd lab-nmes-tens-bluetooth
./setup.sh
# Run
source venv/bin/activate
python main.py # GUI
python nmes_cli.py # CLIWSL Users: Bluetooth doesn't pass through to WSL natively. See WSL_BLUETOOTH.md for workarounds.
- Python 3.8+
- Bluetooth Low Energy adapter
- Linux recommended (native BLE), also works on macOS/Windows
Research-based protocols from peer-reviewed literature:
| Protocol | Frequency | Use Case |
|---|---|---|
| Stroke Rehab | 30Hz | Upper/lower extremity recovery |
| ACL Recovery | 50Hz | Post-surgery strengthening |
| Pain Relief (TENS) | 2-100Hz | Various pain management |
| Muscle Strengthening | 20-50Hz | General conditioning |
See src/core/protocols.py for full details and citations.
src/
├── core/ # Config, protocols, safety limits
├── bluetooth/ # BLE device communication
└── gui/ # PyQt6 interface
- Parameter validation against clinical limits
- Emergency stop functionality
- Session time limits
- Connection monitoring with auto-stop
- DEVELOPMENT.md - Architecture and contributing
- DEPLOYMENT.md - Platform-specific setup
- DEVICE_SETUP.md - Device connection guide
- CLI_README.md - Command-line interface
- LEGAL.md - Disclaimers and licensing
- BLE: bleak library
- GUI: PyQt6 + qasync
- Config: pydantic
- Plotting: matplotlib
Contributions welcome! See DEVELOPMENT.md for guidelines.
Protocols are based on peer-reviewed research:
- Marquez-Chin & Popovic (2020). FES therapy for motor function restoration. Biomed Eng Online. PMC5683854
- Johnson et al. (2015). TENS for acute pain. Cochrane Database Syst Rev. CD006142
- Gibson et al. (2017). TENS for neuropathic pain. Cochrane Database Syst Rev. CD011976
- Gondin et al. (2011). High-frequency NMES for muscle performance. Eur J Appl Physiol. doi:10.1007/s00421-011-2101-2
- Bax et al. (2005). NMES for quadriceps strengthening. Sports Med. doi:10.2165/00007256-200535030-00002
- ACSM Guidelines for Exercise Testing and Prescription, 11th ed. (2021)
- IEC 60601-2-10:2012 - Safety standards for nerve/muscle stimulators
MIT License with medical disclaimers. See LICENSE.
Always prioritize safety when working with electrical stimulation devices.