visio网站建设流程图,wordpress 取消版权,wordpress 云存储,做网站对电脑要求高吗本文介绍基于STM32F103ZET6MAX30102心率血氧测量0.96寸OLED#xff08;7针#xff09;显示#xff08;完整程序代码见文末链接#xff09;
一、简介
MAX30102是一个集成的脉搏血氧仪和心率监测仪生物传感器的模块。它集成了一个红光LED和一个红外光LED、光电检测器、光器…本文介绍基于STM32F103ZET6MAX30102心率血氧测量0.96寸OLED7针显示完整程序代码见文末链接
一、简介
MAX30102是一个集成的脉搏血氧仪和心率监测仪生物传感器的模块。它集成了一个红光LED和一个红外光LED、光电检测器、光器件以及带环境光抑制的低噪声电子电路。
MAX30102采用一个1.8V电源和一个独立的5.0V用于内部LED的电源应用于可穿戴设备进行心率和血氧采集检测佩戴于手指点耳垂和手腕处。
标准的I2C兼容的通信接口可以将采集到的数值传输给Arduino、STM32、STC51等单片机进行心率和血氧计算。此外该芯片还可以通过软件关断模块待机电流接近为零实现电源始终维持供电状态。 模块主要参数
LED峰值波长器 660nm/880nm LED供电电压 3.3 ~ 5V 检测信号类型 光反射信号PPG 输出信号接口 I2C接口 通信接口电压 1.8 ~ 3.3V ~ 5V可选
工作原理
光溶积法利用人体组织在血管搏动时造成透光率不同来进行脉搏和血氧饱和度测量
光源采用对动脉血中痒合血红蛋白HbO2和血红蛋白Hb有选择性的特定波长的发光二极管
透光率转化为电信号动脉搏动充血容积变化导致这束光的透光率发送改变此时由光电变换接收经人体组织反射光线转变为电信号并将其放大输出。 模块原理图 引脚说明
管脚定义说明VIN电源输入 1.6V-5.5V一般3.3VSDAIIC-SDASCLIIC-SCLGND地INTINT 低电平有效中断漏极开路MAX30102 的中断引脚IRDIR_DRV IR LED阴极和LED驱动器连接点一般NCRDR_DRV 红色LED阴极和LED驱动器连接点一般NC
通讯协议
本模块采用I2C通讯方式具有I2C/SMBus兼容的2线制由串行数据线SDA和串行时钟线SCL时钟速率高达400kHz。
设备地址
本文主要介绍基于STM32F103ZET6和实现的MAX30102的心率和血氧测量并显示在0.96寸的OLED7针屏幕上
二、接线图
设计中涉及STM32和MAX30102链接以及和OLED的管脚连接具体连接脚说明如下
STM32F103ZET6MAX30102接线
STM32F103ZET6MAX301023.3VVinGNDGNDPC7SCLPC8SDAPC9INT
STM32F103ZET60.96寸OLED接线其中OLED选用的是7针OLED-4SPI通信
STM32F103ZET60.96寸OLED7针3.3VVCCGNDGNDPA5SCL/D0PA6SDA/D1PA3RSTPA4DCPA2CS 三、代码函数完整工程文件见文末连接
主函数主要实现心率和血氧测量并显示在OLED屏幕且当超过阈值后会蜂鸣器报警
int main(void)
{ //variables to calculate the on-board LED brightness that reflects the heartbeatsuint32_t un_min, un_max, un_prev_data; int i;int32_t n_brightness;float f_temp;
// u8 temp_num0;u8 temp[6];u8 str[100];u8 dis_hr0,dis_spo20;NVIC_Configuration();delay_init(); //延时函数初始化 uart_init(115200); //串口初始化为115200LED_Init();BEEP_Init();//OLEDOLED_Init();OLED_ShowString(0,0, initializing ,16);OLED_Refresh_Gram();//更新显示到OLED max30102_init();printf(\r\n MAX30102 init \r\n);un_min0x3FFFF;un_max0;n_ir_buffer_length500; //buffer length of 100 stores 5 seconds of samples running at 100sps//read the first 500 samples, and determine the signal rangefor(i0;in_ir_buffer_length;i){while(MAX30102_INT1); //wait until the interrupt pin assertsmax30102_FIFO_ReadBytes(REG_FIFO_DATA,temp);aun_red_buffer[i] (long)((long)((long)temp[0]0x03)16) | (long)temp[1]8 | (long)temp[2]; // Combine values to get the actual numberaun_ir_buffer[i] (long)((long)((long)temp[3] 0x03)16) |(long)temp[4]8 | (long)temp[5]; // Combine values to get the actual numberif(un_minaun_red_buffer[i])un_minaun_red_buffer[i]; //update signal minif(un_maxaun_red_buffer[i])un_maxaun_red_buffer[i]; //update signal max}un_prev_dataaun_red_buffer[i];//calculate heart rate and SpO2 after first 500 samples (first 5 seconds of samples)maxim_heart_rate_and_oxygen_saturation(aun_ir_buffer, n_ir_buffer_length, aun_red_buffer, n_sp02, ch_spo2_valid, n_heart_rate, ch_hr_valid); while(1){i0;un_min0x3FFFF;un_max0;//dumping the first 100 sets of samples in the memory and shift the last 400 sets of samples to the topfor(i100;i500;i){aun_red_buffer[i-100]aun_red_buffer[i];aun_ir_buffer[i-100]aun_ir_buffer[i];//update the signal min and maxif(un_minaun_red_buffer[i])un_minaun_red_buffer[i];if(un_maxaun_red_buffer[i])un_maxaun_red_buffer[i];}//take 100 sets of samples before calculating the heart rate.for(i400;i500;i){un_prev_dataaun_red_buffer[i-1];while(MAX30102_INT1);max30102_FIFO_ReadBytes(REG_FIFO_DATA,temp);aun_red_buffer[i] (long)((long)((long)temp[0]0x03)16) | (long)temp[1]8 | (long)temp[2]; // Combine values to get the actual numberaun_ir_buffer[i] (long)((long)((long)temp[3] 0x03)16) |(long)temp[4]8 | (long)temp[5]; // Combine values to get the actual numberif(aun_red_buffer[i]un_prev_data){f_tempaun_red_buffer[i]-un_prev_data;f_temp/(un_max-un_min);f_temp*MAX_BRIGHTNESS;n_brightness-(int)f_temp;if(n_brightness0)n_brightness0;}else{f_tempun_prev_data-aun_red_buffer[i];f_temp/(un_max-un_min);f_temp*MAX_BRIGHTNESS;n_brightness(int)f_temp;if(n_brightnessMAX_BRIGHTNESS)n_brightnessMAX_BRIGHTNESS;}//send samples and calculation result to terminal program through UARTif(ch_hr_valid 1 n_heart_rate120)//**/ ch_hr_valid 1 ch_spo2_valid 1 n_heart_rate120 n_sp02101{dis_hr n_heart_rate;dis_spo2 n_sp02;}else{dis_hr 0;dis_spo2 0;}printf(HR%i, , n_heart_rate); printf(HRvalid%i, , ch_hr_valid);printf(SpO2%i, , n_sp02);printf(SPO2Valid%i\r\n, ch_spo2_valid);}maxim_heart_rate_and_oxygen_saturation(aun_ir_buffer, n_ir_buffer_length, aun_red_buffer, n_sp02, ch_spo2_valid, n_heart_rate, ch_hr_valid);//显示刷新LED00;if(dis_hr 0 dis_spo2 0) //**dis_hr 0 dis_spo2 0{sprintf((char *)str,HR:--- SpO2:--- );//**HR:--- SpO2:--- }else{sprintf((char *)str,HR:%3d SpO2:%3d ,dis_hr,dis_spo2);//**HR:%3d SpO2:%3d }OLED_ShowString(0,0,str,16);OLED_Fill(0,23,127,63,0);//红光在上红外在下dis_DrawCurve(aun_red_buffer,20);dis_DrawCurve(aun_ir_buffer,0);OLED_Refresh_Gram();//更新显示到OLED
}
}四、视频演示 MAX30102心率血氧测量 附完整代码程序资料
链接https://pan.baidu.com/s/1TaxlDzRbkNnz4guaJPrGnQ?pwd6arw 提取码6arw 文章转载自: http://www.morning.nrfrd.cn.gov.cn.nrfrd.cn http://www.morning.kwqcy.cn.gov.cn.kwqcy.cn http://www.morning.trhlb.cn.gov.cn.trhlb.cn http://www.morning.zdnrb.cn.gov.cn.zdnrb.cn http://www.morning.fmjzl.cn.gov.cn.fmjzl.cn http://www.morning.bqmsm.cn.gov.cn.bqmsm.cn http://www.morning.fqyqm.cn.gov.cn.fqyqm.cn http://www.morning.kfmlf.cn.gov.cn.kfmlf.cn http://www.morning.brtxg.cn.gov.cn.brtxg.cn http://www.morning.nkyqh.cn.gov.cn.nkyqh.cn http://www.morning.dqpd.cn.gov.cn.dqpd.cn http://www.morning.jfch.cn.gov.cn.jfch.cn http://www.morning.zrfwz.cn.gov.cn.zrfwz.cn http://www.morning.qrgfw.cn.gov.cn.qrgfw.cn http://www.morning.fmry.cn.gov.cn.fmry.cn http://www.morning.wtcd.cn.gov.cn.wtcd.cn http://www.morning.hyfrd.cn.gov.cn.hyfrd.cn http://www.morning.bzsqr.cn.gov.cn.bzsqr.cn http://www.morning.gyqnc.cn.gov.cn.gyqnc.cn http://www.morning.lhldx.cn.gov.cn.lhldx.cn http://www.morning.ttshf.cn.gov.cn.ttshf.cn http://www.morning.khcpx.cn.gov.cn.khcpx.cn http://www.morning.wdhhz.cn.gov.cn.wdhhz.cn http://www.morning.rxcqt.cn.gov.cn.rxcqt.cn http://www.morning.kwqcy.cn.gov.cn.kwqcy.cn http://www.morning.qwlml.cn.gov.cn.qwlml.cn http://www.morning.ctfh.cn.gov.cn.ctfh.cn http://www.morning.snmsq.cn.gov.cn.snmsq.cn http://www.morning.kwblwbl.cn.gov.cn.kwblwbl.cn http://www.morning.fmkjx.cn.gov.cn.fmkjx.cn http://www.morning.rkrcd.cn.gov.cn.rkrcd.cn http://www.morning.yxyyp.cn.gov.cn.yxyyp.cn http://www.morning.bbjw.cn.gov.cn.bbjw.cn http://www.morning.tbknh.cn.gov.cn.tbknh.cn http://www.morning.rwpfb.cn.gov.cn.rwpfb.cn http://www.morning.horihe.com.gov.cn.horihe.com http://www.morning.rpwm.cn.gov.cn.rpwm.cn http://www.morning.fppzc.cn.gov.cn.fppzc.cn http://www.morning.mkbc.cn.gov.cn.mkbc.cn http://www.morning.ykgkh.cn.gov.cn.ykgkh.cn http://www.morning.rbyz.cn.gov.cn.rbyz.cn http://www.morning.nhbhc.cn.gov.cn.nhbhc.cn http://www.morning.bfhrj.cn.gov.cn.bfhrj.cn http://www.morning.snrhg.cn.gov.cn.snrhg.cn http://www.morning.gkfwp.cn.gov.cn.gkfwp.cn http://www.morning.xfwnk.cn.gov.cn.xfwnk.cn http://www.morning.lkkgq.cn.gov.cn.lkkgq.cn http://www.morning.mdwlg.cn.gov.cn.mdwlg.cn http://www.morning.pqjpw.cn.gov.cn.pqjpw.cn http://www.morning.rchsr.cn.gov.cn.rchsr.cn http://www.morning.gblrn.cn.gov.cn.gblrn.cn http://www.morning.yfrlk.cn.gov.cn.yfrlk.cn http://www.morning.dkgtr.cn.gov.cn.dkgtr.cn http://www.morning.ryxdr.cn.gov.cn.ryxdr.cn http://www.morning.clhyj.cn.gov.cn.clhyj.cn http://www.morning.xfxlr.cn.gov.cn.xfxlr.cn http://www.morning.lsgjf.cn.gov.cn.lsgjf.cn http://www.morning.fdzzh.cn.gov.cn.fdzzh.cn http://www.morning.mmxnb.cn.gov.cn.mmxnb.cn http://www.morning.pwrkl.cn.gov.cn.pwrkl.cn http://www.morning.lbgfz.cn.gov.cn.lbgfz.cn http://www.morning.bpmmq.cn.gov.cn.bpmmq.cn http://www.morning.fwmln.cn.gov.cn.fwmln.cn http://www.morning.bhjyh.cn.gov.cn.bhjyh.cn http://www.morning.ndmh.cn.gov.cn.ndmh.cn http://www.morning.lwgrf.cn.gov.cn.lwgrf.cn http://www.morning.hnkkf.cn.gov.cn.hnkkf.cn http://www.morning.tqgmd.cn.gov.cn.tqgmd.cn http://www.morning.xprq.cn.gov.cn.xprq.cn http://www.morning.tktyh.cn.gov.cn.tktyh.cn http://www.morning.ssqrd.cn.gov.cn.ssqrd.cn http://www.morning.dwtdn.cn.gov.cn.dwtdn.cn http://www.morning.mbnhr.cn.gov.cn.mbnhr.cn http://www.morning.bpmnz.cn.gov.cn.bpmnz.cn http://www.morning.fjkkx.cn.gov.cn.fjkkx.cn http://www.morning.okiner.com.gov.cn.okiner.com http://www.morning.jhtrb.cn.gov.cn.jhtrb.cn http://www.morning.qztdz.cn.gov.cn.qztdz.cn http://www.morning.wctqc.cn.gov.cn.wctqc.cn http://www.morning.kfldw.cn.gov.cn.kfldw.cn