Skip to content

GCY/Pulse-Oximeter-with-MAX3010X

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pulse-Oximeter-with-MAX3010X

This project is MAX3010x library for STM32F4, currently supported MAX30100、MAX30102.
The Pulse Oximeter Monitor is a simple PC-Host tool for PPG signal used in pulse oximetry for the computation of oxygen saturation(SpO2).

MAX30102

USE

1. Pulse Oximeter Monitor Compile:

  • g++ -o2 -o main.app main.cpp mathplot.cpp connectargsdlg.cpp serialport.cpp `wx-config --cxxflags --libs` --std=c++11 -m64

2. Build stm32f4 project :

First, select MAX3010x type.

 #define _MAX30102_
//#define _MAX30100_
  • Make "./MAX3010x/src/stm32f4 project max3010x" or include "./Library/MAX3010x.h" into your project.
  • Load main.elf file to STM32F4

Demo:


Audi R8


Near-Infrared Rpectroscopy (NIRS) measure oxygenation in a whole blood

The aim of pulse oximetry is to measure the percentage of oxygenated hemoglobin (HbO2) to the total hemoglobin (Hb) (oxygenated plus deoxygenated) in the arterial blood – this is referred to as SpO2. Oxygenated hemoglobin in the blood is distinctively red, whereas deoxygenated hemoglobin in the blood has a characteristic dark blue coloration. measures light absorbance at one wavelength (or more wavelengths) where there is a large difference between Hb and HbO2 and at another wavelength (or more wavelengths) to quantify oxygen saturation

Absorption spectroscopy – oxygen saturation Biomedical Photonics Handbook, Figure 29.2

For SpO2 measure the ratios between our two readings(IR and RED), on base level their DC levels should be nearly identical.

MAX30100 adjustment strategy (step 0 to 15 = 0mA to 51mA):

  • If RED_DC > IR_DC then decrease RED current (-1)
  • If RED_DC < IR_DC then increase RED current (+1)

MAX30102 adjustment strategy (step 0 to 255 = 0mA to 51mA): decay_coeff = adjustment decay rate. decay_counter = count(ordinal) of adjustment. decay_factor = exp(decay_coeff * decay_counter);

  • If RED_DC > IR_DC then decrease RED step of decay_factor value, decay_counter += 1
  • If RED_DC < IR_DC then increase RED step of decay_factor value, decay_counter += 1
  • If (RED_DC - IR_DC) < Threshold(MAGIC_ACCEPTABLE_INTENSITY_DIFF) then decay_counter = 0, done

If decay_coeff or RED_LED_CURRENT_ADJUSTMENT_NS too small, it will result in a lot of oscillation.

Adjustment Strategy

Finally, the normalized R/IR “ratio of ratios” can then be related empirically to SpO2.

The ratio R between these two wavelengths is defined with the following equations:
R = (red_ac/red_dc) / (ir_ac/ir_dc)

Or it can also be Beer-Lambert Law:
R = log(red_ac) / log(ir_ac)

Linear Regression model of SpO2 = a + b * R-ratio

Note:you’ll need to calibrate the model of computing SpO2.

Reference:

LICENSE

MIT License

Copyright (c) 2018 GCY

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.