Skip to content

SynsmyrF2001/Multi-Modal-Biometric-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Modal Biometric System

A comprehensive Arduino-based biometric monitoring system developed for Computer Architecture and Organization class. This project integrates multiple biometric sensors to measure heart rate, blood oxygen saturation (SpO2), and body temperature using the MAX30105 sensor module.

🎯 Project Highlights

Engineered a real-time multi-mode biometric monitoring system on Arduino UNO with three operational modes, achieving <2KB RAM footprint despite initial 133% memory overflow through aggressive optimization techniques.

Key Technical Achievements

  • Memory Optimization: Reduced memory usage from 133% overflow (2738 bytes) to 88% usage (1800 bytes) through buffer reduction (400 bytes → 32 bytes) and strategic library management
  • High-Performance Processing: Handles 400Hz sensor data streams with <200ms pulse detection latency
  • Multi-Mode Operation: Three distinct sensing modes (heart rate, SpO2, temperature) with IR remote control for seamless mode switching
  • Hardware Integration: Successfully integrated 4 hardware components (MAX30102 sensor, I2C LCD, IR receiver, buzzer) with collision-free I2C addressing
  • Debugging Excellence: Resolved 5+ critical compilation errors including type mismatches, memory segfaults, and SRAM exhaustion

Performance Metrics

  • RAM Footprint: <2KB (optimized from 2738 bytes to 1800 bytes)
  • Sampling Rate: 400Hz sensor data processing
  • Response Time: <200ms pulse detection latency
  • Memory Efficiency: 88% usage (12% under AVR limit)
  • Buffer Optimization: 92% reduction (400 bytes → 32 bytes)

Features

  • Three Operational Modes:
    • Heart rate monitoring with real-time BPM calculation
    • Blood oxygen saturation (SpO2) detection using SPK algorithm
    • Onboard temperature sensing with ±1°C accuracy and 0.0625°C precision
  • IR Remote Control: Seamless mode switching without system resets
  • Real-Time Processing: 400Hz sensor data stream processing with optimized buffer management
  • LCD Display: Visual feedback using I2C LCD display with custom heart character animation and buzzer feedback
  • Memory Optimized: Aggressive buffer optimization and local allocation strategies for AVR microcontroller constraints
  • Data Visualization: Serial plotter support for real-time waveform visualization

Hardware Requirements

Components

  • Arduino Uno (2KB SRAM constraint - critical for optimization)
  • MAX30102/MAX30105 Pulse Oximeter and Heart-Rate Sensor
  • LiquidCrystal_I2C Display (16x2) - I2C address: 0x27 or 0x3F
  • IR Receiver Module (for mode switching)
  • Buzzer (for audio feedback)
  • Jumper wires
  • Breadboard (optional)
  • Fast response (<200ms per beat)

Connections

MAX30102/MAX30105 Arduino
5V 5V
GND GND
SDA A4 (SDA)
SCL A5 (SCL)
INT Not connected (optional)
LCD I2C Arduino
VCC 5V
GND GND
SDA A4 (SDA)
SCL A5 (SCL)
IR Receiver Arduino
VCC 5V
GND GND
OUT Digital Pin (configurable)
Buzzer Arduino
Positive Digital Pin 8 (PWM)
Negative GND

I2C Bus Configuration

  • Shared I2C Bus: All I2C devices share SDA/SCL lines
  • Collision-Free Addressing: MAX30102 (0x57), LCD (0x27/0x3F)
  • Interrupt Handling: Proper interrupt management for multi-device communication

Software Requirements

Arduino Libraries

Install the following libraries via Arduino Library Manager:

  1. SparkFun MAX30105x Pulse and Proximity Sensor Library

  2. LiquidCrystal_I2C

    • Library Manager: Search for "LiquidCrystal_I2C"
    • Author: Frank de Brabander
  3. Wire (Built-in Arduino library)

Required Header Files

The project requires the following header files (typically included with the MAX30105 library):

  • heartRate.h - Heart rate detection algorithm
  • spo2_algorithm.h - SpO2 calculation algorithm

Project Structure

Multi Modal Biometric System/
├── multimodal_biometric_system.ino    # Main integrated system
├── examples/
│   ├── heart_rate_detection.ino       # Heart rate only example
│   ├── blood_oxygen_detection.ino      # SpO2 detection example
│   ├── temperature_sensing.ino        # Temperature sensor example
│   └── data_plotter.ino               # Serial plotter visualization
├── README.md
└── .gitignore

Usage

Main System

  1. Upload multimodal_biometric_system.ino to your Arduino
  2. Connect all hardware components as per the wiring diagram
  3. Power on the system and wait for initialization
  4. Use IR remote to switch between modes:
    • Mode 1: Heart rate monitoring
    • Mode 2: SpO2 detection
    • Mode 3: Temperature sensing
  5. Place your finger on the sensor with steady pressure
  6. The LCD will display:
    • Heart rate (BPM) with animated heart icon
    • Pulse detection status
    • Mode indicator
    • Buzzer feedback on pulse detection

Individual Examples

Each example in the examples/ folder demonstrates a specific functionality:

  • heart_rate_detection.ino: Serial output of heart rate data
  • blood_oxygen_detection.ino: Heart rate and SpO2 measurements via serial
  • temperature_sensing.ino: Temperature readings in Celsius and Fahrenheit
  • data_plotter.ino: Real-time waveform visualization in Arduino Serial Plotter

Configuration

LCD Address

If your LCD doesn't work, you may need to change the I2C address:

LiquidCrystal_I2C lcd(0x27, 16, 2);  // Change 0x27 to 0x3F if needed

Sensor Settings

Adjust sensor parameters in the setup() function:

  • ledBrightness: LED intensity (0-255)
  • sampleAverage: Number of samples to average
  • sampleRate: Sampling rate (50-3200 Hz)
  • pulseWidth: LED pulse width
  • adcRange: ADC range

Troubleshooting

Sensor Not Detected

  • Check I2C connections (SDA/SCL)
  • Verify power supply (5V recommended)
  • Ensure proper wiring connections

No Finger Detection

  • Ensure finger is placed firmly on sensor
  • Use a rubber band for consistent pressure
  • Check IR threshold value (default: 7000)

LCD Not Displaying

  • Verify I2C address (use I2C scanner if needed)
  • Check power connections
  • Ensure proper contrast settings

Technical Implementation

Memory Optimization Strategies

The project faced significant memory constraints (2KB SRAM on Arduino UNO) and required aggressive optimization:

  1. Buffer Reduction: Reduced averaging buffer from 400 bytes to 32 bytes (92% reduction)

    • Optimized from 4-element array to 2-element array for heart rate averaging
    • Implemented circular buffer with modulo arithmetic
  2. Local Allocation: Moved global buffers to local scope where possible

    • Reduced dynamic memory usage from 2738 bytes to 1800 bytes
    • Achieved 12% margin under AVR SRAM limit
  3. Library Management: Strategic selection of lightweight libraries

    • Minimized library overhead
    • Custom implementation where library functions were memory-intensive
  4. Data Structure Optimization:

    • Reduced averaging arrays by 50%
    • Used byte-sized variables where appropriate
    • Eliminated redundant data structures

Performance Optimization

  • 400Hz Sampling: Configured sensor for high-frequency data acquisition
  • <200ms Latency: Optimized pulse detection algorithm for real-time response
  • Efficient I2C Communication: Fast I2C mode (400kHz) for minimal communication overhead

Algorithm Details

Heart Rate Detection

  • Uses Peripheral Beat Amplitude (PBA) algorithm
  • Calculates BPM from time between beats using millis() timing
  • Implements 2-sample averaging for stability (reduced from 4-sample for memory)
  • Real-time beat detection with <200ms response time

SpO2 Detection

  • Implements SPK algorithm from Maxim Integrated
  • Requires 100 samples (4 seconds) for initial calculation
  • Updates every 1 second with 25 new samples
  • Uses optimized buffer management for memory efficiency

Temperature Sensing

  • Onboard temperature sensor with high precision
  • Requires enabling DIETEMPRDY interrupt
  • Readings in both Celsius and Fahrenheit
  • Minimal memory footprint (single float variable)

Mode Switching Architecture

  • Modular Firmware Design: Each mode operates independently
  • IR Remote Integration: Seamless transitions between modes without system resets
  • State Machine: Efficient state management for mode transitions
  • Resource Management: Proper cleanup and initialization between mode switches

Debugging and Problem Resolution

Successfully resolved 5+ critical issues:

  1. Memory Segfaults: Fixed by implementing local buffer allocation
  2. Type Mismatches: Resolved casting issues between uint32_t and uint16_t
  3. SRAM Exhaustion: Addressed through aggressive buffer optimization
  4. Compilation Errors: Fixed library conflicts and missing dependencies
  5. I2C Conflicts: Resolved addressing conflicts between multiple I2C devices

Technical Specifications

System Constraints

  • Microcontroller: ATmega328P (Arduino UNO)
  • SRAM: 2KB (2048 bytes)
  • Flash Memory: 32KB
  • Clock Speed: 16MHz

Memory Usage Breakdown

  • Initial State: 2738 bytes (133% of available SRAM) ❌
  • Optimized State: 1800 bytes (88% of available SRAM) ✅
  • Improvement: 938 bytes saved (34% reduction)
  • Safety Margin: 248 bytes (12% under limit)

Sensor Specifications

  • MAX30102/MAX30105:
    • Sampling Rate: Up to 3200Hz (configured at 400Hz)
    • ADC Resolution: 18-bit
    • LED Drivers: Red, IR, Green
    • Temperature Sensor: ±1°C accuracy, 0.0625°C precision

Performance Benchmarks

  • Pulse Detection Latency: <200ms
  • Data Processing Rate: 400 samples/second
  • Mode Switch Time: <100ms
  • LCD Update Rate: ~5Hz (optimized for readability)

Project Statistics

  • Hardware Components: 4 (Sensor, LCD, IR Receiver, Buzzer)
  • Operational Modes: 3 (Heart Rate, SpO2, Temperature)
  • Critical Bugs Resolved: 5+
  • Memory Optimization: 34% reduction
  • Code Optimization: Buffer reduction by 92%

Credits

This project is based on examples from:

  • SparkFun Electronics MAX30105 Breakout examples
  • Maxim Integrated MAXREFDES117 reference design

Original examples by Nathan Seidle @ SparkFun Electronics

License

This project is developed for educational purposes as part of a Computer Architecture and Organization class assignment.

Contributing

This is a class project, but suggestions and improvements are welcome!

Author

Developed for Computer Architecture and Organization class project.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages