A senior design project that combines embedded hardware, real-time ML classification, and a desktop GUI to guide users through breathing exercises using live pressure feedback.
This system reads pressure data from a force-sensing resistor worn against the body during breathing. The signal is sampled by an Arduino via USB serial, classified by a Random Forest model in real-time, and visualized in a PyQt6 desktop application — giving users immediate feedback on their breathing pattern.
[FlexiForce A201 Sensor]
│
▼
[Arduino UNO] ──── USB Serial ────► [Python Backend]
ADC sampling │
Serial TX ├── Random Forest Classifier
│ (breathing phase detection)
│
└── PyQt6 GUI
├── Live waveform plot
└── Guided breathing visual
- Real-time pressure signal acquisition via FlexiForce A201 + Arduino UNO
- USB serial communication between Arduino and PC
- Random Forest ML model for breathing phase classification
- PyQt6 desktop GUI with live waveform and breathing guidance animation
- Modular codebase — hardware, ML, and GUI are decoupled
| Component | Details |
|---|---|
| Arduino UNO | Microcontroller for ADC and serial TX |
| FlexiForce A201 | Thin-film pressure sensor |
| 10kΩ resistor | Pull-down for voltage divider |
| 47µF capacitor | Signal smoothing |
The FlexiForce sensor is connected to Arduino pin A0 via a 10kΩ pull-down resistor and a 47µF smoothing capacitor, powered from the 5V and GND pins.
- Python 3.9+
- PyQt6
- scikit-learn
- numpy
- pyserial
- matplotlib (for waveform rendering)
Install dependencies:
pip install -r requirements.txt-
Flash the Arduino sketch
Open
firmware/sdp_firmware.inoin the Arduino IDE and upload to your UNO. -
Connect the Arduino via USB
Plug into your PC and note the assigned COM port (Windows) or
/dev/ttyXX(Linux/macOS). -
Configure the serial port
Update the
PORTvariable inconfig.py:PORT = "COM5" # or "/dev/ttyUSB0" on Linux
-
Run the application
python main.py
SDP/
├── firmware/
│ └── sdp_firmware.ino # Arduino sketch
├── ml/
│ ├── train.py # Model training script
│ ├── model.pkl # Trained Random Forest model
│ └── data/ # Training data (pressure readings + labels)
├── gui/
│ ├── main_window.py # PyQt6 main window
│ └── breathing_widget.py # Guided breathing animation
├── config.py # Serial port and app settings
├── main.py # Entry point
├── requirements.txt
└── README.md
The Random Forest classifier was trained on labeled pressure sequences to detect distinct breathing phases (inhale, exhale, hold). Features are extracted from sliding windows of raw ADC readings.
To retrain the model on your own data:
python ml/train.py --data ml/data/
The dashboard shows real-time breathing metrics — breathing rate, I:E ratio, tidal volume, variability, and apnea detection — along with a live feedback message and the ML model's classified pattern with confidence score.
Rashad Hummatov
Computer Engineering, ADA University — Class of 2026
LinkedIn · GitHub