一.系统概述
- 系统具备收集人体体温、心率、步数和血氧浓度的能力,并能通过显示屏实时呈现这些数据。
- 整合了蓝牙模块,使得用户可以将监测数据上传至手机应用,实现远程监控与数据的有效管理。
- 用户可以设定运动提醒功能,系统会在预定时间通过蜂鸣器发出警报,提示用户进行运动。
- 当检测到用户的体温或心率出现异常时,系统会通过语音播报来提醒用户,确保及时关注健康状况。
二.电路设计
电路设计采用Altium Designer软件,具体内容如下:
- 系统主控采用STM32F103C8T6单片机,其最小系统电路作为整个电路的核心部分。
- 步数检测使用ADXL345加速度传感器,采用IIC总线与单片机进行数据通信。
- DS1302模块用于实现时钟定时功能,通过SDA、SCK和DAT三个引脚与单片机连接。
- 心率和血氧的监测由MAX30102模块完成,该模块同样通过IIC总线与单片机进行通信。
- 数据显示采用0.96寸的OLED12864屏幕,利用IIC总线与单片机连接。
- 无线通信方面,使用JDY-31蓝牙模块,通过UART串口与单片机进行数据传输。
- JR6001模块负责语音播报功能,并通过UART串口与单片机连接。
- 报警功能由有源蜂鸣器实现,通过NPN三极管对蜂鸣器进行驱动。
三.程序设计
#include “sys.h”
#include “delay.h”
#include “math.h”
#include “key.h”
#include “usart2.h”
#include “myiic.h”
#include “myiic1.h”
#include “max30102.h”
#include “ds1302.h”
#include “algorithm.h”
#include “Control_Report_To_Police.h”
void OLED_Display_Cotrol(void);
#define SIZE sizeof(TEXT_Buffer)
#define FLASH_SAVE_ADDR 0X0800f400
uint32_t aun_ir_buffer[500]; //IR LED sensor data
int32_t n_ir_buffer_length; //data length
uint32_t aun_red_buffer[500]; //Red LED sensor data
int32_t n_sp02; //SPO2 value
int8_t ch_spo2_valid; //indicator to show if the SP02 calculation is valid
int32_t n_heart_rate; //heart rate value
int8_t ch_hr_valid; //indicator to show if the heart rate calculation is valid
uint8_t uch_dummy;
#define MAX_BRIGHTNESS 255
unsigned int STEP=0;
char p1[16]=" ";
u16 Temperature_max=30,hr_max=90,spo_max=90;
u8 TEXT_Buffer[]={“0000000”};
u8 dis_hr=0,dis_spo2=0,mode;
static _Bool h_flag,s_flag,t_flag;
int main(void)
{
static u8 bushu;
uint32_t un_min, un_max, un_prev_data;
int i;
int32_t n_brightness;
float f_temp;
u8 temp[6],str[15];
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级
delay_init(); //延时函数初始化
Usart1_Init(9600);
Usart2_Init(9600);
switch_Init();
KEY1_Init();
while(DS18B20_Init()){}
DS1302_GPIO_Init_Write_Time();
Beep_init();
while(ADXL345_IIC_GPIO_Init()) //3D加速度传感器初始化
{
}
max30102_init();
n_ir_buffer_length=100;
un_min=0x3FFFF;
un_max=0;
for(i=0;i<n_ir_buffer_length;i++)
{
while(MAX30102_INT==1); //wait until the interrupt pin asserts
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 number
aun_ir_buffer[i] = (long)((long)((long)temp[3] & 0x03)<<16) |(long)temp[4]<<8 | (long)temp[5]; // Combine values to get the actual number
if(un_min>aun_red_buffer[i])
un_min=aun_red_buffer[i]; //update signal min
if(un_max<aun_red_buffer[i])
un_max=aun_red_buffer[i]; //update signal max
}
un_prev_data=aun_red_buffer[i];
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);
// STEPS = (datatemp[0]-0x30)*10000+(datatemp[1]-0x30)*1000+(datatemp[2]-0x30)*100+(datatemp[3]-0x30)*10+(datatemp[4]-0x30);
OLED_Spi_Init();
OLED_Clear_Spi();
}
四.资料内容
24-32-74