FastBond体外检测之血氧心电检测
本次项目采用美信的MAX30102来监测血氧和体温,ADI的AD8232来进行心电检测,主控使用的是简单易上手的Arduino
标签
嵌入式系统
PCB设计
lxb
更新2021-11-24
1287

活动主题:      

      体外诊断,也就是国际上统称的IVD(In Vitro Diagnostic),原理是通过试剂和体内物质在体外的反应强度或速度来判断体内物质的性质和数量,从而判断人体的生理状态,为医生治疗方案及用药提供重要的参考指标,是保证人类健康的医疗体系中不可或缺的一环。

     

项目功能介绍:

      本次是一个很简单的小项目,主要功能一是心电检测,二是监测血氧和体温。

     

项目硬件及使用介绍:

      本次我采用的是以Arduino为主控,以美信的MAX30102来监测血氧和体温,ADI的AD8232来进行心电检测的方案实现血氧心电体外检测检测。

      心电监测中需注意RA的采集信号所用的贴应贴在右锁骨中线与第二肋间之交点;LA的采集信号所用的贴应贴在左锁骨中线与第二肋间之交点;RL的采集信号所用的贴应贴在右下腹。血氧与体温检测只需将手指紧贴放置至传感器上即可(这样其实测的是手指温度)。

      

关键代码:

Arduino主控代码:

void setup() {
  // put your setup code here, to run once:
      pinMode(10, INPUT); // Setup for leads off detection LO +
      pinMode(11, INPUT); // Setup for leads off detection LO -
      Serial.begin(9600);
      Serial.print("AT+SERRUP+90\r\n");delay(500);
      Serial.print("AT+SERRDOWN+60\r\n");delay(500);
      Serial.print("AT+SP+1\r\n");delay(500);
      while(Serial.read()>=0){}
}

int k=0;
char terminator = 'T';
char res_0,res1;
String T="";
int t;
String spo2="";
int sp2;
void loop() {
  // put your main code here, to run repeatedly:
  Serial.print("AT+T\r\n");
      while(Serial.available()){ 
           T=T+char(Serial.read());
           delay(2);
      }
      if(T.length()>0){
          res_0= T.indexOf('=');
          T=T.substring(res_0+1,res_0+4);
          t=T.toInt();
          Serial.print("t:");
          Serial.println(t);
          T="";
    }
    while(k<700) {
       if((digitalRead(10) == 1)||(digitalRead(11) == 1)){
        Serial.println('!');
      }
      else{
        // send the value of analog input 0:
          Serial.println(analogRead(A0));
      }
      //Wait for a bit to keep serial data from saturating
      delay(1);
      k++;
    }
    k=0;
    Serial.print("AT+SPO2\r\n");
     while(Serial.available()){ 
           spo2=spo2+char(Serial.read());
           delay(2);
      }
      if(spo2.length()>0){
          res1= spo2.indexOf('=');
          spo2=spo2.substring(res1+1);
          if (spo2 == "NU") {
              spo2 = "00";
            } else if (res1 == -1) {
              spo2 = "00";
            }
          sp2=spo2.toInt();
          Serial.print("spo2:");
          Serial.println(sp2);
          spo2="";
     }
    while(k<700) {
       if((digitalRead(10) == 1)||(digitalRead(11) == 1)){
        Serial.println('!');
      }
      else{
        // send the value of analog input 0:
          Serial.println(analogRead(A0));
      }
      //Wait for a bit to keep serial data from saturating
      delay(1);
      k++;
    }
    k=0;
}

processing上位机代码:      

import processing.serial.*;

Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph
float height_old = 0;
float height_new = 0;
float inByte = 0;


void setup () {
  // set the window size:
  size(1000, 400);        

  // List all the available serial ports
  println(Serial.list());
  // Open whatever port is the one you're using.
  myPort = new Serial(this, Serial.list()[1], 9600);
  // don't generate a serialEvent() unless you get a newline character:
  myPort.bufferUntil('\n');
  // set inital background:
  background(0xff);
}


void draw () {
  // everything happens in the serialEvent()
}


void serialEvent (Serial myPort) {
  // get the ASCII string:
  String inString = myPort.readStringUntil('\n');
  if (inString != null) {
    // trim off any whitespace:
    inString = trim(inString);
    // If leads off detection is true notify with blue line
    if (inString.equals("!")) { 
      
      stroke(0, 0, 0xff); //Set stroke to blue ( R, G, B)
      inByte = 512;  // middle of the ADC range (Flat Line)
    }
    // If the data is good let it through
    else {
      stroke(0xff, 0, 0); //Set stroke to red ( R, G, B)
      inByte = float(inString); 
     }
     
     //Map and draw the line for new data point
     inByte = map(inByte, 0, 1023, 0, height);
     height_new = height - inByte; 
     line(xPos - 1, height_old, xPos, height_new);
     height_old = height_new;
    
      // at the edge of the screen, go back to the beginning:
      if (xPos >= width) {
        xPos = 0;
        background(0xff);
      } 
      else {
        // increment the horizontal position:
        xPos++;
      }
    
  }
}

 

功能演示结果:

使用示意图:

FviCrx-OACOY592teddusuV0ZS8X

FoOBRbJ2H4g4IDesQvJyRMIuCsMK  测心电:

Fk0c3d_bRn9XtHaxKTztNlO_pPyz    测手指温度:

Flwd4SbJfqiC6usbWBKzyi80Z4Ni

测血氧浓度:

FhVxozhy0WFdTlKjyZBmVaOY-Uih

     

 

     心得体会:

      通过本次项目我有幸的了解到process这款强大的画图软件,非常适合用来与Arduino做人机交互的界面。

     我深知此次项目不足之处,一是传感器不稳定,二是没有做良好的数据分析,显得很混乱。

    改进之处:利用process的多线程完成心电图、体温(其实应该是手指温度)和血氧浓度的分别显示,而不是只显示血氧浓度。

     

  参考开源的方案链接如下:

https://github.com/sparkfun/AD8232_Heart_Rate_Monitor

sparkfun/SparkFun_MAX3010x_Sensor_Library: An Arduino Library for the MAX3015 particle sensor and MAX30102 Pulse Ox sensor (github.com)

      学习时参考的博客如下:

https://blog.csdn.net/iracer/article/details/50334041

https://blog.csdn.net/weixin_45037820/article/details/91403400?spm=1001.2014.3001.5501

https://blog.csdn.net/weixin_45037820/article/details/95666523?spm=1001.2014.3001.5501

https://blog.csdn.net/haigear/category_8380110.html?spm=1001.2014.3001.5482

https://blog.csdn.net/iracer/article/details/50334041

https://arduino.nxez.com/2016/12/22/arduino-string-class-usage-summary.html

 

 

附件下载
MAX30102芯片资料.pdf
AD8232_Heart_Rate_Monitor_v10.pdf
团队介绍
哈尔滨工业大学大三信息对抗
团队成员
lxb
哈尔滨工业大学电信学院信息对抗专业
评论
0 / 100
查看更多
目录
硬禾服务号
关注最新动态
0512-67862536
info@eetree.cn
江苏省苏州市苏州工业园区新平街388号腾飞创新园A2幢815室
苏州硬禾信息科技有限公司
Copyright © 2023 苏州硬禾信息科技有限公司 All Rights Reserved 苏ICP备19040198号