这两年开始毕业设计和毕业答辩的要求和难度不断提升,传统的毕设题目缺少创新和亮点,往往达不到毕业答辩的要求,这两年不断有学弟学妹告诉学长自己做的项目系统达不到老师的要求。
为了大家能够顺利以及最少的精力通过毕设,学长分享优质毕业设计项目,今天要分享的是
基于单片机的无接触测温枪
学长这里给一个题目综合评分(每项满分5分)
选题指导, 项目分享:
https://gitee.com/dancheng-senior/project-sharing-1/blob/master/%E6%AF%95%E8%AE%BE%E6%8C%87%E5%AF%BC/README.md
疫情当前,电子测温枪供不应求,本项目实现了基于MLX90614的红外测温仪。含有3段温度区段报警功能:分为绿蓝红区,低于绿区设定值不报警,介于绿区红区设定值鸣响5声,高于红区设定值鸣响10声。
mlx90614红外传感器
MLX90614是一款红外非接触温度计。TO-39金属封装里同时集成了红外感应热电堆探测器芯片和信号处理专用集成芯片。由于集成了低噪声放大器、17位模数转换器和强大的数字信 号处理单元,使得高精度和高分辨度的温度计得以实现。温度计具备出厂校准化,有数字 PWM和 SMBus(系统管理 总线)输出模式。作为标准,配置为 10 位的 PWM 输出格式用于连续传送温 度范围为-20…120 ˚C 的物体温度,其分辨率为 0.14 ˚C。 POR 默认模式是 SMBus 输出格式。
实物
烧录配置(部分)
在“1”框内选择相应的芯片型号
选择完成后,按下“2”
按下“3”进入熔丝位设置
设置对应的熔丝位,完成后点击“写入”
选择相应的固件,点击“打开”
void setup() {
// put your setup code here, to run once:
pinMode(RIGHT, INPUT_PULLUP);
pinMode(LEFT, INPUT_PULLUP);
pinMode(MAIN, INPUT_PULLUP);
pinMode(RED, OUTPUT);
pinMode(YELLOW, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BUZZER, OUTPUT);
Wire.begin();
byte highTCA = EEPROM.read(temperatureCalibrationAddress);
byte lowOTCA = EEPROM.read(temperatureCalibrationAddress + 1);
byte highBSA = EEPROM.read(buzStateAddress);
byte lowbBSA = EEPROM.read(buzStateAddress + 1);
temperatureCalibration = (highTCA << 8) + lowOTCA;
buzState = (highBSA << 8) + lowbBSA;
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins); //初始化数码管
sevseg.setBrightness(45);
digitalWrite(RED, HIGH);
delay(175);
digitalWrite(RED, LOW);
digitalWrite(YELLOW, HIGH);
delay(175);
digitalWrite(YELLOW, LOW);
digitalWrite(GREEN, HIGH);
delay(175);
digitalWrite(GREEN, LOW);
if (temperatureCalibration < -25 or temperatureCalibration > 25)
{
temperatureCalibration = 0;
}
if (buzState < 0 or buzState > 1)
{
buzState = 0;
}
/*
由于使用固件烧录会擦除EEPROM,所以烧录完程序启动时,读取到的EEPROM会不正常
为了避免系统异常,就增加这几行代码,用作数据纠正
*/
if (buzState == 1)
{
digitalWrite(BUZZER, HIGH);
delay(85);
digitalWrite(BUZZER, LOW);
}
else
{
digitalWrite(BUZZER, LOW);
}
sevseg.setChars("--.-");
}
void loop() {
if (digitalRead(MAIN) == 0)
{
keyState1 = 1;
sevseg.refreshDisplay();
}
else
{
keyState1 = 0;
}
if (digitalRead(LEFT) == 0)
{
keyState2 = 1;
sevseg.refreshDisplay();
}
else
{
keyState2 = 0;
}
if (digitalRead(RIGHT) == 0)
{
keyState3 = 1;
sevseg.refreshDisplay();
}
else
{
keyState3 = 0;
}
if (keyState2 == 1)
{
delayCount = delayCount + 1;
}
if (delayCount >= delayCountMax3)
{
delayCount = 0;
menu = menu + 1;
digitalWrite(RED, LOW);
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);
}
if (menu > menuMax)
{
survey();
sevseg.refreshDisplay();
menu = 0;
}
switch (menu)
{
case 0 :
menu_0();
sevseg.refreshDisplay();
break;
case 1 :
menu_1();
sevseg.refreshDisplay();
break;
case 2 :
menu_2();
sevseg.refreshDisplay();
break;
}
if (buzState == 1 && buzRingFrequency > 0)
{
buzDelayCount = buzDelayCount + 1;
if (buzDelayCount == (delayCountMax4 / 5) * 4)
{
digitalWrite(BUZZER, HIGH);
}
if (buzDelayCount >= delayCountMax4)
{
digitalWrite(BUZZER, LOW);
buzDelayCount = 0;
buzRingFrequency = buzRingFrequency - 1;
}
}
if (buzState == 0 or buzRingFrequency == 0)
{
digitalWrite(BUZZER, LOW);
}
}
void menu_0()
{
if (keyState1 == 1)
{
delayCount = delayCount + 1;
}
if (delayCount >= delayCountMax3)
{
delayCount = 0;
survey();
buzRingFrequency = 1;
if (temperature < minTemperature)
{
digitalWrite(GREEN, LOW);
digitalWrite(RED, LOW);
digitalWrite(YELLOW, LOW);
sevseg.setChars("Lo");
sevseg.refreshDisplay();
}
if (temperature >= minTemperature && temperature < yellowTemperature)
{
digitalWrite(GREEN, HIGH);
digitalWrite(YELLOW, LOW);
digitalWrite(RED, LOW);
}
if (temperature >= yellowTemperature && temperature < redTemperature)
{
digitalWrite(YELLOW, HIGH);
digitalWrite(GREEN, LOW);
digitalWrite(RED, LOW);
buzRingFrequency = 5;
}
if (temperature >= redTemperature && temperature < maxTemperature)
{
digitalWrite(RED, HIGH);
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);
buzRingFrequency = 10;
}
if (temperature >= maxTemperature)
{
digitalWrite(RED, LOW);
digitalWrite(GREEN, LOW);
digitalWrite(YELLOW, LOW);
}
if (temperature >= maxTemperature)
{
survey();
sevseg.setChars("HIG");
sevseg.refreshDisplay();
}
}
}
void menu_1()
{
if (keyState3 == 1)
{
delayCount = delayCount + 1;
}
if (delayCount >= delayCountMax3)
{
buzState = buzState + 1;
delayCount = 0;
}
if (buzState > 1)
{
buzState = 0;
}
switch (buzState)
{
case 0:
//buzState = 0;
sevseg.setChars("bof");
sevseg.refreshDisplay();
break;
case 1:
//buzState = 1;
sevseg.setChars("bon");
sevseg.refreshDisplay();
break;
}
sevseg.refreshDisplay();
}