0、结果
说明:先来看看串口调试助手显示的结果,显示的是温度值,因为是接触式传感器,可以测量人体体温,如果不接触,测量的就是空气温度。如果是你想要的,可以接着往下看。
1、外观
说明:虽然max30205人体温度传感器形态各异,但是原理和代码都是适用的,可能IIC的地址会不同。
2、连线
说明:只需要连接四根线或者七根线。
- uno————max30205传感器(四根线的IIC地址是0x4F)
- 3.3V--------------VCC
- GND--------------GND
- SCL--------------SCL
- SDA--------------SDA
- uno————max30205传感器(七根线的IIC地址是0x48)
- 3.3V--------------VCC
- GND--------------GND
- SCL--------------SCL
- SDA--------------SDA
- GND--------------A0
- GND--------------A1
- GND--------------A 2
3、源程序
说明:采用非阻塞方式编写,一定时间检测一次温度,并将对应功能进行函数化,方便移植。
/****************************************max30205 part****************************************/
/*
wiring:
VCC------------5V
GND------------GND
SCL------------A5/SCL
SDA------------A4/SDA
A0、A1、A2-----GND
Pay attention: If A0, A1, and A2 are connected to GND, the IIC address is 0x48. If no, the IIC address is 0x4f
Contact measurement of body temperature.
*/
#include <Wire.h> //include library
#include "ClosedCube_MAX30205.h" //include library
ClosedCube_MAX30205 max30205; //Instantiate an object
#define max30205TimeInterval 1000 //Detect the time interval of a trip
unsigned long max30205Times = 0; //Record the device running time
float max30205Temp = 0; //Define a variable
/****************************************set up and loop part*********************************/
void setup() {
Serial.begin(9600); //Example Set the baud rate of the serial port to 9600
max30205.begin(0x4F); //IIC address of the device,If A0, A1, and A2 are connected to GND, the IIC address is 0x48. If no, the IIC address is 0x4f
Serial.println("Go online!"); // The serial port displays the corresponding value
}
void loop() {
getMAx30205Data(); //Acquired temperature
}
/****************************************max30205 part****************************************/
/*Acquired temperature*/
void getMAx30205Data() {
if (millis() - max30205Times >= max30205TimeInterval) { //This command is executed once in a while
max30205Times = millis();
max30205Temp = max30205.readTemperature(); //Gets the temperature value
Serial.print("Temp: "); // The serial port displays the corresponding value
Serial.print(max30205Temp); // The serial port displays the corresponding value
Serial.println(" (C)"); // The serial port displays the corresponding value
}
}
4、注意事项
说明:需要下载对应的库文件才不会编译报错。工作电压是3.3V。接四根线的情况下,默认IIC地址是0x4F;接七根线的情况下,也就是当A0、A1、A2接GND的情况,IIC地址为0x48。可以接触人体皮肤测量人体温度,数据上升或者下降可能有些慢。精度很高。
5、基本原理
Maxim Integrated推出的MAX30205是一款数字式人体温度传感器,可以在Arduino等开发板上使用。其工作原理如下:
温度侦测原理:MAX30205使用高精度的微处理器和传感器技术,能够测量人体表面的温度,并将其转化为数字信号。
数字信号处理:传感器内部的芯片会对收集到的温度数据进行处理,以获得更加高精度和稳定的温度值。
通信接口:MAX30205具有I2C和SPI接口,可与Arduino等控制器进行通信,从而提供可靠的数据传输。
反馈机制:MAX30205还具有一种反馈机制,能够自动校准传感器误差,确保温度测量的准确性和可靠性。