Skip to content

Anu13lol/Real-Time-AI-Biosensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🫀 Real-Time Edge AI Biosensor (ECG/PPG)

An edge-computing biosensor system built on a Raspberry Pi Zero 2W. This system handles real-time I2C data polling, signal processing, and local Long Short-Term Memory (LSTM) neural network inference to predict and analyze Heart Rate Variability (HRV).

Biosensor Enclosure The 3D-printed enclosure featuring the MAX30102 PPG/SpO2 sensor.


🏗️ System Architecture

This project bridges physical hardware sensors with edge AI inference, operating entirely on a constrained ARM architecture.

  • 🧠 Compute Node: Raspberry Pi Zero 2W.
  • 📡 Sensors: MAX30102 (PPG/SpO2) via I2C, BioAmp EXG Pill (ECG) via Arduino Nano ADC buffer.
  • 🖥️ Display & UI: 0.96" I2C OLED display with hardware-debounced GPIO interrupts.
  • 🤖 AI Engine: TensorFlow LSTM sequence prediction for RR-interval forecasting and HRV time-domain metric extraction (SDNN, RMSSD).

⚡ Hardware Setup & Pinout

image

Internal layout showing the Pi Zero 2W, OLED display, BioAmp EXG Pill, and physical UI switches.

Key Connections (Pi Zero 2W):

  • I2C Bus (OLED & MAX30102): SDA $\rightarrow$ GPIO 2 | SCL $\rightarrow$ GPIO 3
  • UI Buttons: UP (GPIO 17), DOWN (GPIO 26), SELECT (GPIO 22), MENU (GPIO 10)
  • ECG Interface: Serial parsing via connected Arduino Nano handling the BioAmp EXG Pill analog outputs.

🔌 Schematic Diagram

image

Full system wiring diagram generated in EasyEDA.


⚙️ Signal Processing & Threading

To prevent the I2C polling loop from bottlenecking the GUI, the system utilizes isolated threading:

  1. 📊 Sensor Thread (heartrate_monitor.py): Continuously fills a 100-sample buffer at 25Hz.
  2. 🧮 DSP Pipeline (hrcalc.py): Applies a 4-point moving average filter, removes DC shift, and calculates local maxima/minima for SpO2 calibration.
  3. 🎛️ Main Thread (main.py): Handles OLED screen rendering, GPIO state machines, and synchronized data logging via threading locks.

🚀 Installation & Execution

1. Clone and Install Dependencies:

git clone <https://github.com/Anu13lol/Real-Time-AI-Biosensor>
cd <repo-folder>
pip3 install -r requirements.txt

About

Edge computing biosensor capturing I2C ECG/PPG data and executing local TensorFlow LSTM predictions for time-series signal analysis.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages