Skip to content

Masters-Halmstad/EarlySepsisDetection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Early Sepsis Detection System (ESDS) – Embedded Prototype

1. Project Introduction

This project is an embedded early sepsis detection prototype built on an Arduino Nano ESP32 running MicroPython.
It integrates multiple biomedical and environmental sensors and a 1.3" OLED display to acquire and visualize:

  • Core body temperature (TMP117)
  • Pulse waveform + SpO₂ estimate (GY-MAX30102)
  • Motion/orientation data (BMI160 IMU)
  • Real-time status and readings on an SSD1306-based OLED

The goal is to create a small, low-power, I²C‑based sensing platform that can be extended into a more advanced early warning system for sepsis.


2. Key Technical Details

  • MCU: Arduino Nano ESP32 (MicroPython firmware)
  • Language: MicroPython
  • Buses:
    • I²C0 for all sensors + OLED (shared bus)
  • Sensors:
    • TMP117 high-accuracy digital temperature sensor (Texas Instruments)
    • MAX30102 optical pulse oximeter + heart-rate sensor module (GY-MAX30102)
    • BMI160 6‑axis IMU (accelerometer + gyroscope, DFRobot SEN0250)
  • Display:
    • 1.3" 128×64 OLED using SSD1306-compatible controller over I²C
  • Signal processing:
    • Rolling buffers for pulse data
    • AC/DC separation and ratio‑of‑ratios (R) for SpO₂ estimation
  • Architecture:
    • Each sensor wrapped in its own MicroPython class
    • Shared utility functions for SpO₂ processing
    • OLED used as a simple real‑time UI

3. Key Concepts and Algorithms

3.1 Temperature Measurement (TMP117)

  • Digital I²C temperature sensor.
  • Raw reading is a signed 16‑bit value with 0.0078125 °C/LSB resolution.
  • Conversion:
    [ T_{C} = \text{raw} \times 0.0078125 ]

3.2 Pulse and SpO₂ Measurement (MAX30102)

The MAX30102 provides raw optical signals from Red and IR LEDs measured through the fingertip.

Steps:

  1. Raw data acquisition

    • Read 18‑bit samples from the MAX30102 FIFO: red[n], ir[n].
  2. Window / rolling buffer

    • Maintain a buffer of N samples (e.g. N ≈ 100) for Red and IR:
      • red_buf = [red_0, ..., red_{N-1}]
      • ir_buf = [ir_0, ..., ir_{N-1}]
    • On each new sample: append new, drop oldest.
  3. Separate AC and DC components

    • DC component ≈ mean value over the window:
      • dc_red = mean(red_buf)
      • dc_ir = mean(ir_buf)
    • AC component = signal – DC; we use RMS of AC:
      • ( AC_{\text{red,RMS}} = \sqrt{\frac{1}{N}\sum (red_i - dc_{red})^2} )
      • ( AC_{\text{ir,RMS}} = \sqrt{\frac{1}{N}\sum (ir_i - dc_{ir})^2} )
  4. Ratio-of-ratios (R) [ R = \frac{AC_{red} / DC_{red}}{AC_{ir} / DC_{ir}} ]

  5. SpO₂ approximation

    • Use an empirical linear fit (approximate): [ SpO_2 \approx 104 - 17 \cdot R ]
    • Clamp / reject values outside physiological range (0–100%).

This implementation is only a non‑medical, approximate estimator, for development and research purposes.

3.3 Motion Sensing (BMI160)

  • Read raw accelerometer and gyro data (16‑bit signed) from BMI160.
  • Configuration: typical ±4 g, ±2000 °/s, ~100 Hz ODR.
  • Provides basic motion awareness (activity, movement artifacts affecting PPG, etc.).

3.4 OLED Text Rendering

Using the SSD1306 driver:

  • Create I²C instance → create SSD1306_I2C(width, height, i2c, addr=0x3C) object.
  • Render logic:
    • oled.fill(0) – clear screen
    • oled.text("Message", x, y) – draw text starting at pixel (x, y)
    • oled.show() – update the physical display

Typical UI loop:

  • Read sensors → compute values → format strings → draw text → oled.show().

4. File / Folder Structure

Example structure on the MicroPython filesystem:

/
├── boot.py
├── main.py
└── Firmware
    ├── __init__.py
    ├── Sensors
    │   ├── __init__.py
    │   ├── tmp117.py        # TMP117 temperature sensor class
    │   ├── max30102.py      # MAX30102 pulse oximeter sensor class
    │   ├── bmi160.py        # BMI160 IMU sensor class
    │   └── ssd1306.py       # SSD1306 OLED driver (copied library)
    └── utils.py             # Shared utilities (SpO₂ calc, helpers)
/

5. Setup and Usage

5.1 Hardware Connections (summary)

Common

  • All sensors + OLED on the same I²C bus.
  • Example (Arduino Nano ESP32):
    • SDA → GPIO 11
    • SCL → GPIO 12

TMP117

  • VCC → 3.3 V
  • GND → GND
  • SDA/SCL → shared I²C lines
  • ADD0 → GND (address 0x48)

GY-MAX30102

  • VCC → 3.3 V
  • GND → GND
  • SDA/SCL → shared I²C lines
  • Typical I²C address: 0x57

BMI160 (DFRobot SEN0250)

  • VCC → 3.3–5 V (per module rating)
  • GND → GND
  • SDA/SCL → shared I²C

1.3" OLED (SSD1306)

  • VCC → 3.3 V or 5 V (according to module)
  • GND → GND
  • SDA/SCL → shared I²C
  • Typical I²C address: 0x3C or 0x3D

5.2 Software Setup

  1. Flash MicroPython to Arduino Nano ESP32 (using Arduino Lab for MicroPython or esptool). [web:102]
  2. Upload project files:
    • boot.py, main.py
    • Firmware/ folder with Sensors/ and utils.py
    • Ensure __init__.py exists in Firmware/ and Firmware/Sensors/.
  3. SSD1306 driver:
  4. Run:
    • Reset the board.
    • The display should show boot text (e.g. “Early Sepsis Detection – Initializing…”).
    • Main loop will show temperature, SpO₂ estimate, and possibly raw R / Red values.

6. Reference Libraries and Resources

6.1 OLED Driver

6.2 MAX30102

6.3 TMP117

6.4 BMI160

  • Datasheet: BMI160 Small, low-power IMU (Bosch Sensortec). [web:35]
  • DFRobot module docs (Gravity: BMI160 6-Axis IMU, SEN0250): [web:32][web:38]

7. Notes and Limitations

  • The SpO₂ algorithm is a simplified, non‑medical approximation based on DC/AC ratio-of-ratios and a linear mapping, and is not calibrated for clinical use.
  • Motion, poor finger contact, ambient light, and sensor placement will strongly affect accuracy.
  • This project is intended for research, learning, and prototyping, not for diagnostic or therapeutic decisions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages