当前位置:网站首页>基于Arduino制作非接触式测温仪
基于Arduino制作非接触式测温仪
2022-08-01 04:03:00 【优信电子】
基于Arduino制作非接触式测温仪
MLX90614 红外测温模块
MLX90614 简介
MLX90614是一款由迈来芯公司提供的低成本,无接触温度计。输出数据和物体温度呈线性比例,具有高精度和高分辨率。TO-39金属封装里同时集成了红外感应热电堆探测器芯片MLX81101(温度是通过PTC或是PTAT元件测量)和信号处理专用集成芯片MLX90302,专门用于处理红外传感器输出信号。用以阻碍可见光和近红外光辐射的光学滤波器(可传播长波)集成在封装内提供对环境和日光的免疫。滤波器的波长通带为5.5到14μm。由于集成了低噪声放大器、17位模数转换器和强大的数字信号处理芯片 MLX90302,使得高精度和高分辨度的温度计得以实现。一个附加的片上温度传感器用来测量芯片的温度。测量完两个传感器的输出后,对应的环境温度和物体温度被计算出。计算所得物体温度和环境温度存储在MLX90302的RAM单元,温度分辨率为0.01℃,并可通过两线 SMBus(系统管理总线)兼容协议接口(IIC与之兼容)(0.02℃分辨率)或是10位PWM(脉宽调制)输出模式输出。MLX90614出厂温度范围都进行过校准,传感器测量的温度为视场里所有物体温度的平均值。
MLX90614 参数
探头直径8.2mm
数字接口类型:IIC(从模式)
温度测量范围:-70℃~382.2℃
温度测量误差:±0.5℃ (室温下)分辨率0.02℃
工作电压:3.3V~5V
使用环境温度-40~125℃
项目介绍
本项目将以Arduino作为主控,按键触发,搭配MLX90614红外测温传感器制作一个非接触式,测温距离在1CM左右的人体手腕测温仪,测量到的温度用OLED显示屏打印出来 。

项目搭建
接线
| Arduino | MLX90614 | OLED | 按键 |
|---|---|---|---|
| A4 | SDA | ||
| A5 | SCL | ||
| 5V | VIN | VCC | |
| GND | GND | GND | OUT |
| D3 | IN | ||
| D8 | RES | ||
| D9 | DC | ||
| D10 | CS | ||
| D11 | D1 | ||
| D12 | D2 |

开发
为了方便开发本项目会用到MLX90614库和U8g2库
#include <U8g2lib.h>
#include <Adafruit_MLX90614.h>
项目上电后初始化完成后,在串口和OLED屏幕上打印项目名称"Contactless Temperature Measurement",由于屏幕宽度有限,使用OLED显示器分行打印
Serial.println("Contactless Temperature Measurement"); //串口打印项目名称
u8g2.enableUTF8Print(); // enable UTF8 support for the Arduino print() function
u8g2.setFont(u8g2_font_ncenB14_tr); //字体选择
u8g2.setFontDirection(0); //绘制/显示方向
u8g2.clear(); //清空显示和缓冲
u8g2.setCursor(7, 15); //移动光标位置
u8g2.print("Contactless"); //OLED打印内容
u8g2.setCursor(0, 35);
u8g2.print("Temperature");
u8g2.setCursor(0, 55);
u8g2.print("Measurement");
u8g2.sendBuffer();

通过按下按键改变D3引脚电平状态触发测温
int Start()
{
int B=1;
B=digitalRead(Bottom);
delay(30);
return B;
}
获取温度—为了提高温度的可靠性 读取了5次温度存放在一个数组里,数组里的输出通过可靠性判断和处理后就可以打印输出了
void gTemp()
{
for (int i = 0; i < 5; i++)
{
t[i] = mlx.readObjectTempC();
Serial.println(t[i]);
delay(300);
}
}
主程序
void loop(void) {
while(!Start()) //测温循环
{
u8g2.clear();
Serial.println("start"); //串口打印开始信息
delay(1000);
gTemp(); //测温 读取5次温度值 保存再t数组里面
if(dTemp()>0) // 判断数据有效性
{
u8g2.clear(); //清屏
u8g2.setCursor(3, 20);
u8g2.print("temperature");
u8g2.setCursor(40, 50);
u8g2.print(prantTemp()); //打印温度值
Serial.println(prantTemp()); -
u8g2.sendBuffer();
}
else
{
Serial.println("read fail"); //串口打印测温错误信息//五次温度处理后判断为无效数据
u8g2.clear(); //清屏
u8g2.setCursor(23 ,17); //OLED打印位置
u8g2.print("read fail"); //OLED打印读取失败信息 OLED打印测温错误信息//五次温度处理后判断为无效数据
u8g2.setCursor(19, 37); //OLED打印位置
u8g2.print("please try"); //OLED打印读取失败信息
u8g2.setCursor(35, 55); //OLED打印位置
u8g2.print("again"); //OLED打印读取失败信息
u8g2.sendBuffer();
}
delay(5000);
u8g2.clear(); //清屏
break;
}
}
项目验证展示
- 点击开始测温后被测温目标再进入测温区域,判断为测温失败
测温失败演示
- 正确测温演示
Arduino - MLX90614非接触式测温
测得温度为36.25摄氏度
边栏推荐
- The fledgling Xiao Li's 114th blog project notes: Wisdom cloud intelligent flower watering device combat (3) - basic Demo implementation
- A way to deal with infinite debugger
- JS new fun(); 类与实例 JS基于对象语言 只能通过书写构造函数充当类
- How to download the Keil package
- The fledgling Xiao Li's 112th blog project notes: Wisdom cloud intelligent flower watering device actual combat (1) - basic Demo implementation
- 初出茅庐的小李第112篇博客项目笔记之机智云智能浇花器实战(1)-基础Demo实现
- Weekly Summary (*67): Why not dare to express an opinion
- Four implementations of
batch insert: have you really got it? - Unknown Bounded Array
- Advice given by experts with four years of development experience in Flutter tutorial
猜你喜欢

【愚公系列】2022年07月 Go教学课程 025-递归函数

博客系统(完整版)

【入门教程】Rollup模块打包器整合

智芯传感输液泵压力传感器 为精准智能控制注入科技“强心剂”

The fledgling Xiao Li's 112th blog project notes: Wisdom cloud intelligent flower watering device actual combat (1) - basic Demo implementation

【uniCloud】云对象的应用与提升

Message Queuing Message Storage Design (Architecture Camp Module 8 Jobs)

《少年派2》:新男友竟脚踩两只船,林妙妙与钱三一感情回温

2022-07-31: Given a graph with n points and m directed edges, you can use magic to turn directed edges into undirected edges, such as directed edges from A to B, with a weight of 7.After casting the m

Software Testing Weekly (Issue 82): In fact, all those who are entangled in making choices already have the answer in their hearts, and consultation is just to get the choice that they prefer.
随机推荐
阿叶的目标
Step by step hand tearing carousel Figure 3 (nanny level tutorial)
这个地图绘制工具太赞了,推荐~~
开源许可证 GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
【愚公系列】2022年07月 Go教学课程 023-Go容器之列表
Unity's primary method for implementing PlanarReflection under the BuildIn rendering pipeline
Simulation of Active anti-islanding-AFD Active Anti-islanding Model Based on Simulink
"Youth Pie 2": The new boyfriend stepped on two boats, and the relationship between Lin Miaomiao and Qian Sanyi warmed up
IJCAI2022 | Hybrid Probabilistic Reasoning with Algebraic and Logical Constraints
MySQL4
动态规划 01背包
HCIP(14)
软件测试周刊(第82期):其实所有纠结做选择的人心里早就有了答案,咨询只是想得到内心所倾向的选择。
2. # 代码注释
[Getting Started Tutorial] Rollup Module Packager Integration
The fledgling Xiao Li's 113th blog project notes: Wisdom cloud smart flower watering device combat (2) - basic Demo implementation
Mysql基础篇(Mysql数据类型)
简单易用的任务队列-beanstalkd
项目风险管理必备内容总结
MySQL3
