怎样用MLX90614和Arduino构建红外测温仪

在本文中,我将解释如何通过红外线测量表面温度。使用这项技术,我们可以简单地通过向表面发送红外波并分析返回传感器的波来收集温度信息。
有许多不同类型的传感器可用于测量温度。 lm35或ds18b20温度传感器根据直接施加在传感器设备表面的热量提供输出。但是,对于极热的情况(例如明火),您无法使用基于接触的传感器来检测准确的温度。
如果你想用非接触式方法(我们为这个项目做)检测温度,红外线温度计传感器是最好的解决方案。因此,我们将使用melexis的mlx90614红外测温仪进行此项目。 mlx90614传感器使用非接触式温度传感来收集温度信息,而不会触及任何特定表面。
红外线温度计的工作原理
虽然人眼看不到,但所有物体都会发出红外光线,浓度会因温度而异。通过检测红外线,我们可以感知温度范围。 mlx90614温度计传感器使用这一原理。
mlx90614是一款功能强大的红外传感器件,具有极低噪声放大器和17位adc。它可以为温度计提供高精度和高分辨率。关于mlx90614的最佳部分是它使用工厂的数字smbus进行校准。这意味着它将提供0.02°c的高分辨率输出,并可连续传输-20至120°c的测量温度。
现在我们了解传感器的工作原理,让我们深入了解项目!
必需材料
arduino
字符lcd 16x2
mlx90614
lcd屏蔽(可选)
接线
mlx 90614温度计具有i2c通信线路,因此我们可以将此传感器与arduino连接,无需任何额外电路。如下图所示连接所有内容。您可以使用lcd 16x2屏蔽或连接独立lcd,如fritzing图中所述。
适用于arduino lcd shield
上传源代码
将以下源代码复制并粘贴到arduino ide。仔细检查连接后,上传代码。
/*
* non-contact thermometer with gy - 906 module
* support for the mlx90614 sensor on the i2c bus
* sda line = a4
* scl line = a5
* sensor supply with 5v
*/
#include
#include
liquidcrystal lcd (8, 9, 4, 5, 6, 7);
int address = 0xb4; // sensor address mlx90614
int erc = 0; // variable holding the pec value
int datah = 0; // the second byte of data
int datal = 0; // the first byte of data
double tempnalsb = 0.02; // variable by which the digital value will be multiplied
double temperature = 0; // variable holding the temperature
void setup () {
i2c_init (); // initialization of the i2c bus
lcd.begin (16, 2); // initialize the display
}
void loop () {
i2c_start_wait (address + i2c_write); // start i2c communication in write mode
i2c_write (0x07); // write the value 0x07 (select the register tobj1)
i2c_rep_start (address + i2c_read); // restart i2c communication at the read address
datal = i2c_readack (); // read the first byte of data
datah = i2c_readack (); // read the second byte of data
erc = i2c_readnak (); // read the third (unimportant) data byte
i2c_stop (); // end of i2c transmission
temperature = (double) (((datah & 0x007f) 《《 8) + datal); // create a 16-bit variable consisting of two one-byte variables
temperature = temperature * tempnalsb; // for one bit 0.02 k, the result of this operation is the temperature in kelvin
temperature = temperature - 273.15; // conversion to celsius degrees
lcd.setcursor (0,0); // display (first lcd line)
lcd.print (“object =”);
lcd.print (temperature);
lcd.print (“”);
lcd.write (0xdf); // degree sign
lcd.print (“c”);
i2c_start_wait (address + i2c_write);
i2c_write (0x06); // select the ambient temperature register
i2c_rep_start (address + i2c_read);
datal = i2c_readack ();
datah = i2c_readack ();
erc = i2c_readnak ();
i2c_stop ();
temperature = (double) (((datah & 0x007f) 《《 8) + datal);
temperature = temperature * tempnalsb;
temperature = temperature - 273.15;
lcd.setcursor(0,1); // display (second lcd line)
lcd.print (“ambient =”);
lcd.print (temperature);
lcd.print (“”);
lcd.write (0xdf);
lcd.print (“c”);
delay (200); // delay 200ms
}
有很多项目可以派上红外温度传感器,例如测量液体或热触摸表面。因为它不需要直接接触,所以在这些情况下mlx90614将是一个很好的选择。

深海原位荧光传感器搭载载人潜水器测试成功
中国四家公司拥有全球36%的5G标准必要专利
ICLR-17最佳论文《理解深度学习需要重新思考泛化》
OpenAI提出了一种回报设置方法RND
3D打印教育已成为我国教育界的一个研究热点
怎样用MLX90614和Arduino构建红外测温仪
福布斯:有“东方苹果”之称的小米公司为类似公司奠定IPO标准
Gadget Building 系列:GK-SAKURA 板上创建心跳粉丝程序
泊头手柄式全焊接球阀特性介绍
浅谈函数发生器输出阻抗与输出振幅的关系
英特尔正式面向中国市场推出第11代英特尔vPro平台
力科强推高分辨率示波器—WavePro HD,快速响应高达5 Gpts
浅谈Vivado 综合选项的7种设置
3S3P汽车尾灯(RCL) LED驱动器参考设计
爱立信:Open RAN通话开放化实现模块化组建基站,商业冲击还未显现
AMD宣布参展Computex 2018
高深宽比刻蚀和纳米级图形化推进存储器的路线图
Basys3开发板实现示波器设计
技术微课堂丨科普篇:一文看懂 PPEC 如何免代码编程开发
IC设计对VR虚拟现实产业发展重要性分析