目录
[六、实验效果 编辑](#六、实验效果 编辑)
一、前言
项目成品图片:

哔哩哔哩视频链接:
(资料分享见文末)
二、项目简介
1.功能详解
STM32智能病房呼叫系统
功能如下:
- STM32F103C8T6单片机作为主控芯片
- 主机显示:当前温度、心率、血氧、当前状态(空闲/呼叫)
- 从机显示:当前温度、心率、血氧、当前状态(空闲/呼叫)
当前温度、心率、血氧等数据来源于从机 - 语音播报:JR6001自动播报正在呼叫,请稍等、病人需要帮助、医护人员已应答,正在赶来
- 按键控制:主机按键:
主机按键1:短按进入阈值设置模式/退出设置模式
主机按键2:设置模式下切换光标/自动模式下应答从机的呼叫
主机按键3:设置模式下增大阈值
主机按键4:设置模式下减小阈值
从机按键:
从机按键1:短按呼叫医护人员,长按查看阈值
2.主要器件
- STM32F103C8T6单片机
- OLED 屏幕
- BT04A蓝牙模块
- HC05蓝牙模块
- JR6001语音模块
- DS18B20温度传感器
- MAX30102心率血氧传感器
- 有源蜂鸣器
- LED灯
三、原理图设计


四、PCB硬件设计
PCB图
主机


从机

五、程序设计
cpp
#include "stm32f10x.h"
#include "led.h"
#include "beep.h"
#include "usart.h"
#include "delay.h"
#include "oled.h"
#include "key.h"
#include "Modules.h"
#include "adcx.h"
#include "flash.h"
#include "TIM2.h"
#include "timer.h"
#include "max30102_read.h"
#include "ds18b20.h"
#include <string.h>
#include "myiic.h"
#include "usart3.h"
#include "usart2.h"
/****************异方辰电子工作室******************
STM32
* 项目 : STM32病房呼叫系统-主机(蓝牙版)
* 版本 : V1.0
* 日期 : 2026.6.30
* MCU : STM32F103C8T6
* 接口 : 见代码
* IP账号 : 异方辰电子/辰哥单片机设计(同BILIBILI|抖音|快手|小红书|CSDN|公众号|视频号等)
* 作者 : 辰哥
* 工作室 : 异方辰电子工作室
* 授权IP : 辰哥单片机设计、异方辰电子、YFC电子、异方辰系列
* 官方网站 : www.yfcdz.cn
**********************BEGIN***********************/
#define KEY_Long1 11
#define KEY_1 1
#define KEY_2 2
#define KEY_3 3
#define KEY_4 4
uint8_t dakai = 0;
uint8_t Flag_dakai = 0;
// 外部变量声明
SensorModules sensorData;
SensorThresholdValue Sensorthreshold;
DriveModules driveData;
// 全局变量定义
uint8_t mode = 1; //系统模式 1自动 2手动 3设置
uint8_t step_num = 0;
uint8_t auto_page = 1;
// 蓝牙发送缓冲区
char tx_buf[64];
uint16_t temp;
uint16_t hravg;
uint16_t sop2;
uint8_t count_s = 1; // 设置模式按键计数
uint8_t call = 0; //本机发送
uint8_t rx_call = 0; //接收状态
uint8_t call_played = 0; // 本机呼叫播放标志
uint8_t master_played = 0; // 主机呼叫播放标志
uint8_t calling = 0;
int main(void)
{
// 系统初始化
SystemInit();
delay_init(72);
ADCx_Init();
LED_Init();
LED_Off();
BEEP_Init();
BEEP_Off();
USART1_Config();
USART2_Init();
USART3_Config();
Key_Init();
OLED_Init();
OLED_Clear();
delay_ms(100);
TIM2_Init(72-1,1000-1);
delay_ms(200);
Sensorthreshold.tempminValue = 20;
Sensorthreshold.tempmaxValue = 30;
Sensorthreshold.hrMin = 60;
Sensorthreshold.hrMax = 100;
Sensorthreshold.spo2Min = 85;
Sensorthreshold.spo2Max = 100;
USART3_SendString("AF:30"); // 设置音量30
delay_ms(1000);
USART3_SendString("A7:00001"); // 播放"欢迎"或其他提示音
delay_ms(1000);
// 主循环
while (1)
{
uint8_t current_key_num = KeyNum;
USART2_ProcessCmd();
//按键2 应答
if(KeyNum==2 &sensorData.call == 1)
{
KeyNum=0;
sensorData.Master_call =1;
Bluetooth_SendStatus1();
sensorData.Master_call =0;
}
switch(mode)
{
case AUTO_MODE:
OLED_autoPage1();
SensorDataDisplay1();
AutoControl();
Control_Manager();
if(current_key_num == KEY_1)
{
OLED_Clear();
mode = SETTINGS_MODE;
KeyNum = 0;
}
break;
case SETTINGS_MODE:
{
uint8_t sel = SetSelection();
if(sel <= 4)
{
OLED_settingsPage1();
SettingsThresholdDisplay1();
}
else
{
OLED_settingsPage2();
SettingsThresholdDisplay2();
}
OLED_settingsOption(sel);
ThresholdSettings(sel);
OLED_Refresh();
if(current_key_num == KEY_1)
{
mode = AUTO_MODE;
count_s = 1;
OLED_Clear();
OLED_autoPage1();
Bluetooth_SendStatus();
KeyNum = 0;
}
break;
}
}
delay_ms(10);
}
}
#include "stm32f10x.h"
#include "led.h"
#include "beep.h"
#include "usart.h"
#include "delay.h"
#include "oled.h"
#include "key.h"
#include "Modules.h"
#include "adcx.h"
#include "flash.h"
#include "TIM2.h"
#include "timer.h"
#include "max30102_read.h"
#include "ds18b20.h"
#include <string.h>
#include "myiic.h"
#include "usart3.h"
#include "usart2.h"
/****************异方辰电子工作室******************
STM32
* 项目 : STM32智能病房呼叫系统(蓝牙版)
* 版本 : V1.0
* 日期 : 2026.6.30
* MCU : STM32F103C8T6
* 接口 : 见代码
* IP账号 : 异方辰电子/辰哥单片机设计(同BILIBILI|抖音|快手|小红书|CSDN|公众号|视频号等)
* 作者 : 辰哥
* 工作室 : 异方辰电子工作室
* 授权IP : 辰哥单片机设计、异方辰电子、YFC电子、异方辰系列
* 官方网站 : www.yfcdz.cn
**********************BEGIN***********************/
#define KEY_Long1 11
#define KEY_1 1
uint8_t dakai = 0;
uint8_t Flag_dakai = 0;
// 外部变量声明
SensorModules sensorData;
SensorThresholdValue Sensorthreshold;
DriveModules driveData;
// 全局变量定义
uint8_t mode = 1; //系统模式 1自动 2手动 3设置
uint8_t step_num = 0;
extern unsigned char p[16];
// 系统静态变量
uint8_t auto_page = 1;
// 蓝牙发送缓冲区
char tx_buf[64];
uint32_t call_start_time=0;
uint8_t call_played = 0; // 本机呼叫播放标志
uint8_t master_played = 0; // 主机呼叫播放标志
uint8_t warning = 0;
uint8_t calling = 0;
int main(void)
{
SystemInit();
delay_init(72);
ADCx_Init();
LED_Init();
LED_Off();
BEEP_Init();
BEEP_Off();
USART1_Config();
USART2_Init();
Key_Init();
OLED_Init();
OLED_Clear();
DS18B20_Init();
USART3_Config();
Init_MAX30102();
delay_ms(100);
TIM2_Init(72-1,1000-1);
delay_ms(200);
Sensorthreshold.tempminValue = 20;
Sensorthreshold.tempmaxValue = 30;
Sensorthreshold.hrMin = 60;
Sensorthreshold.hrMax = 100;
Sensorthreshold.spo2Min = 85;
Sensorthreshold.spo2Max = 100;
USART3_SendString("AF:30");
delay_ms(500);
USART3_SendString("A7:00001");
delay_ms(1000);
// 主循环
while (1)
{
SensorScan();
uint8_t current_key_num = KeyNum;
USART2_ProcessCmd();
Bluetooth_SendStatus();
if(sensorData.Master_call==1)
{
//第一次进入
if(call_start_time==0)
{
call_start_time = TIM2_ms_Count;
}
//超过5秒
if(TIM2_ms_Count - call_start_time >= 5000)
{
sensorData.Master_call=0;
sensorData.call = 0;
call_start_time=0;
}
}
else
{
//没有呼叫,清计时
call_start_time=0;
}
switch(mode)
{
case AUTO_MODE:
OLED_autoPage1();
SensorDataDisplay1();
AutoControl();
Control_Manager();
if(KeyNum == 1)
{
KeyNum = 0;
sensorData.call = 1;
}
else if(current_key_num == KEY_Long1)
{
OLED_Clear();
mode = SETTINGS_MODE;
KeyNum = 0;
}
break;
case SETTINGS_MODE:
{
OLED_settingsPage1();
SettingsThresholdDisplay1();
OLED_Refresh();
}
if(current_key_num == KEY_Long1)
{
KeyNum = 0;
mode = AUTO_MODE;
OLED_Clear();
}
break;
}
delay_ms(10);
}
}
六、实验效果 
七、包含内容
