c语言温度报警系统_温度警报系统

2023-11-07 00:59

本文主要是介绍c语言温度报警系统_温度警报系统,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

c语言温度报警系统

目标-建立温度警报系统项目 (Aim -Build a project for temperature alert system)

二手硬件 - (Hardware Used -)

Image for post
Image for post
Image for post
Image for post
Image for post

1. Arduino Uno R3 (1)

1. Arduino Uno R3(1)

2. Temperature Sensor (TMP36) (1)

2.温度传感器(TMP36)(1)

3. LCD 16x2 (1)

3. LCD 16x2(1)

4. 250kΩ Potentiometer (1)

4.250kΩ电位器(1)

5. 220Ω Resistor (1)

5.220Ω电阻(1)

6. Bread Board

6.面包板

使用的软件- (Software Used -)

Arduino IDE or ThinkerCad (Online web based Simulator)

Arduino IDE或ThinkerCad(基于网络的在线模拟器)

电路原理图 - (Circuit Diagram -)

Image for post
Image for post
Image for post
Image for post

说明 (Explanation)

Hello Everyone!

大家好!

Myself Rahul Jat pursuing B.Tech from Government Engineering College Bikaner currently working on different IOT , Embedded and Robotics Projects , carrying out a project to demonstrate how we can simulate a Temperature Alert System by temperature sensor, lcd 16*2 , Piezo Buzzer and an Arduino UNO R3 using Tinkercad .

我自己的Rahul Jat从Bikaner政府工程学院攻读B.Tech,目前从事不同的IOT,嵌入式和机器人项目,并执行一个项目来演示如何通过温度传感器,lcd 16 * 2,Piezo Buzzer和使用Tinkercad的Arduino UNO R3。

Temperature sensors and LCD can serve as a simple mechanism in different situations such as room temperature monitoring and even plant monitoring or any place that considers temperature as an important element!

温度传感器和LCD可以在不同情况下用作简单的机制,例如室温监控甚至工厂监控或任何将温度视为重要因素的地方!

I am using it as a alert system to get notified when the temperature is above 50 Degree Celsius alarm will go on and a specific tone will be given as output for notification and the LCD 16*2 will show the temperature with the situation as Normal, Cold or Too hot.

我将其用作警报系统,以便在温度高于50摄氏度时发出警报,并且会发出特定的提示音作为通知输出,并且LCD 16 * 2将以正常状态显示温度,太冷或太热。

I am using Thinkercad.Tinkercad provides pre-built circuits that can help users to not complicate their circuits by building from scratch.

我正在使用Thinkercad.Tinkercad提供了预先构建的电路,可以帮助用户从头开始构建而不使电路复杂化。

In the Circuit Desinger, we can search for lcd, which will show that there is a starter circuit that has a pre-connected circuit between an Arduino and LCD.

在Circuit Desinger中,我们可以搜索lcd,这将显示一个启动器电路,该电路在Arduino和LCD之间预先连接了电路。

In Tinkercad, there is only one temperature sensor available, which is the TMP36.

在Tinkercad中,只有一个温度传感器可用,即TMP36。

The TMP36 does not have a temperature sensitive resistor. Instead this sensor uses the property of diodes; as a diode changes temperature the voltage changes with it at a known rate. The sensor measures the small change and outputs an analog voltage between 0 and 1.75VDC based on it. To obtain the temperature, we need to measure the output and perform some calculation to convert it to degree celsius.

TMP36没有温度敏感电阻。 取而代之的是,该传感器利用了二极管的特性。 当二极管改变温度时,电压以已知的速率变化。 传感器测量微小变化,并基于此输出介于0和1.75VDC之间的模拟电压。 为了获得温度,我们需要测量输出并执行一些计算以将其转换为摄氏度。

The TMP36 has 3 pins, which can be easily identified by noticing the flat side of the sensor.

TMP36具有3个引脚,可以通过注意传感器的扁平侧来轻松识别。

The first pin is the +5V pin which will be connected to the supply.

第一个引脚是+ 5V引脚,它将连接到电源。

The second pin is the Vout which will be connected to the Analog In pin, (could be A0-A5). I used A0 for this project.

第二个引脚是Vout,它将连接到模拟输入引脚(可以是A0-A5)。 我为此项目使用了A0。

The third pin is the GND pin which will be connected to the ground of the Arduino.

第三个引脚是GND引脚,它将连接到Arduino的地面。

Interfacing LCD 16*2

液晶屏接口16 * 2

Liquid crystal displays (LCDs) are a commonly used to display data in devices such as calculators, microwave ovens, and many other electronic devices..

液晶显示器(LCD)通常用于在诸如计算器,微波炉和许多其他电子设备之类的设备中显示数据。

In this tutorial, I will show you how to use a 16x2 LCD with an Arduino. The 16x2 LCD used in this experiment has a total of 16 pins. As shown in the table below, eight of the pins are data lines (pins 7–14), two are for power and ground (pins 1 and 16), three are used to control the operation of LCD (pins 4–6), and one is used to adjust the LCD screen brightness (pin 3). The remaining two pins (15 and 16) power the backlight.The details of the LCD terminals are as follows:

在本教程中,我将向您展示如何在Arduino上使用16x2 LCD。 本实验中使用的16x2 LCD共有16个引脚。 如下表所示,八个引脚是数据线(引脚7–14),两个用于电源和接地(引脚1和16),三个用于控制LCD的操作(引脚4–6),一种用于调节LCD屏幕的亮度(引脚3)。 其余两个引脚(15和16)为背光灯供电.LCD端子的详细信息如下:

Terminal 1 - GND

端子1-GND

Terminal 2 - +5V

端子2-+ 5V

Terminal 3 - Mid terminal of potentiometer (for brightness control)

端子3-电位计的中间端子(用于亮度控制)

Terminal 4 - Register Select (RS)

终端4-寄存器选择(RS)

Terminal 5 - Read/Write (RW)

航站楼5-读/写(RW)

Terminal 6 - Enable (EN)

终端6-启用(EN)

Terminal 7 - DB0

航站楼7-DB0

Terminal 8 - DB1

航站楼8-DB1

Terminal 9 - DB2

9号客运大楼-DB2

Terminal 10 - DB3

10号客运大楼-DB3

Terminal 11- DB4

航站楼11- DB4

Terminal 12 - DB5

航站楼12-DB5

Terminal 13 - DB6

13号客运大楼-DB6

Terminal 14 - DB7

14号航站楼-DB7

Terminal 15 - +4.2–5V

端子15-+ 4.2–5V

Terminal 16 - GND

端子16-GND

Now Pins which i used to connect my LCD can be seen from the Circuit Diagram.

现在,从电路图中可以看到用于连接LCD的引脚。

Image for post
LCD 16*2
液晶屏16 * 2

使用的代码- (CODE USED -)

// include the library code:#include <LiquidCrystal.h>

//包含库代码:#include <LiquidCrystal.h>

#include <SoftwareSerial.h>

#include <SoftwareSerial.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //connecting the pins rs,en,d4,d5,d6,d7 to the arduino at pin 12 11 5 4 3 2

液晶LCD(12,11,5,4,4,3,2); //将rs,en,d4,d5,d6,d7引脚连接到arduino的引脚12 11 5 4 3 2

int celsius; //declare a function celsius as an integer

摄氏度 //将函数celsius声明为整数

void setup()

无效setup()

{

{

pinMode(A0,INPUT);

pinMode(A0,INPUT);

pinMode(7,OUTPUT);

pinMode(7,输出);

Serial.begin(9600); //set the baud rate at 9600 bits per second

Serial.begin(9600); //将波特率设置为每秒9600位

lcd.begin(16, 2); //lcd size is 16x2 // Print a message to the LCD.

lcd.begin(16,2); // lcd大小为16x2 // //将消息打印到LCD。

lcd.print(“Temp Display”);

lcd.print(“临时显示”);

Serial.println(“Temp Display”); //print the message at the serial monitor

Serial.println(“临时显示”); //在串行监视器上打印消息

}

}

void loop()

无效循环()

{

{

celsius = map(((analogRead(A0) — 20) * 3.04), 0, 1023, -40, 125);//map to obtain temperature mathematically.Meaning 0 = -40degrees and 1023 = 125degrees

celsius = map((((analogRead(A0)— 20)* 3.04),0,1023,-40,125); //映射以数学方式获得温度。意思是0 = -40度和1023 = 125度

lcd.setCursor(0,0); //cursor set to the first pixel of the lcd.

lcd.setCursor(0,0); //将光标设置为LCD的第一个像素。

lcd.print(“Temp Display”); //print message to lcd

lcd.print(“临时显示”); //将消息打印到lcd

lcd.setCursor(0,1);//cursor set to the second line first pixel

lcd.setCursor(0,1); //将光标设置为第二行的第一个像素

lcd.print(celsius); //prints the celsius output from the analog read onto the lcd at 0,1

lcd.print(摄氏度); //将模拟读取的摄氏温度输出打印到LCD上的0,1

lcd.print(“C”); //print alphabet “c”

lcd.print(“ C”); //打印字母“ c”

Serial.println(celsius); //output shown in the serial monitor

Serial.println(摄氏); //输出显示在串行监视器中

delay(1000); //reading refreshes every 1 second

延迟(1000); //每1秒钟刷新一次

lcd.clear(); //clears the lcd

lcd.clear(); //清除液晶

if(celsius>50) { digitalWrite(7,1); tone (7,250,100); delay(100); lcd.setCursor(8,1); lcd.print(“Too HOT”); } else if(celsius<50 && celsius>=15) { digitalWrite(7,0); lcd.setCursor(8,1); lcd.print(“Normal”); } else if(celsius<15) { digitalWrite(7,0); lcd.setCursor(8,1); lcd.print(“Cold”); }

if(摄氏度> 50){digitalWrite(7,1); 音调(7,250,100); 延迟(100); lcd.setCursor(8,1); lcd.print(“太热”); } else if(celsius <50 && celsius> = 15){digitalWrite(7,0); lcd.setCursor(8,1); lcd.print(“普通”); } else if(摄氏<15){digitalWrite(7,0); lcd.setCursor(8,1); lcd.print(“冷”); }

}

}

Image for post
Code part 1
代码第1部分
Image for post
Code part 2
代码第2部分
Image for post
Code part 3
代码第3部分

结果 (RESULT)

When start simulation the TMP36 sense temperature and show on LCD.

开始仿真时,TMP36感应温度并在LCD上显示。

When the Temperature increases and reached above 50 the Piezo Buzzer will Turn on and produce a specific tone used in code which shows our alert system goes on after reaching specified temperature.

当温度升高并达到50以上时,压电蜂鸣器将打开并产生代码中使用的特定提示音,表明我们的警报系统在达到指定温度后会继续工作。

Also LCD shows condition i.e “Too Hot”.

LCD也显示状态,即“太热”。

下一步是什么! (WHATS NEXT!)

Use a ESP8266 Wifi module to send the data of temperature to the Thingspeak Cloud. And can use ThingTweet to Tweet automatically when temperature reach above 50 or can create a messenger bot which will notify you through messenger messages about the condition.

使用ESP8266 Wifi模块将温度数据发送到Thingspeak Cloud。 并且可以在温度达到50以上时使用ThingTweet自动鸣叫,也可以创建一个Messenger机器人,该机器人将通过Messenger消息通知您有关情况。

Since Thinkercad does not have ESP module so can’t show this project now but will try to show through practical hardware after a while.

由于Thinkercad没有ESP模块,因此现在无法显示此项目,但过一会儿将尝试通过实用的硬件进行显示。

翻译自: https://medium.com/@rahuljat4158/temperature-alert-system-da293034f62f

c语言温度报警系统


http://www.taodudu.cc/news/show-8172793.html

相关文章:

  • 控制台警报:DevTools failed to load SourceMap
  • python异常和超时处理_Python:超时异常处理信号。警报
  • 对警报线程池的警报线程_您可能对警报对话框不了解的地方
  • 7-9 红色警报 (25分)
  • PTA-L2-013 红色警报 (25分)
  • Qt去除未使用变量警报
  • 今天您手机上的“总统警报”弹出窗口是什么?
  • 51单片机警报装置
  • SQL Server代理警报
  • 智慧家——火灾警报
  • 美的冲刺港股:年营收3457亿 不缺钱,但资本运作频频
  • 07胡润IT富豪榜发布:李彦宏成IT首富
  • 设置 google 搜索引擎 不跳转 对应 地区语言页面
  • 基本过程: 小区搜索
  • 地区选择控件的展示和使用
  • 各搜索引擎高级搜索备忘
  • Google搜索指定地区,不跳转
  • elementUI的el-cascader实现省市区搜索
  • vue3实现模糊搜索功能
  • 百度地图---poi地区搜索
  • 百度的地区搜索是如何实现的?
  • C语言枚举打桩
  • 单元测试PowerMockito打桩失效
  • linux库打桩
  • go stub打桩测试
  • 【流量分析】Godzilla分析
  • (纪中)2416. Berry Picking【数学】
  • 2020寒假【gmoj2416】【Berry Picking】
  • 牛客练习赛62(基于官方题解的补题 A ~ D)
  • CQOI2007矩形
  • 这篇关于c语言温度报警系统_温度警报系统的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



    http://www.chinasem.cn/article/360173

    相关文章

    Windows系统宽带限制如何解除?

    《Windows系统宽带限制如何解除?》有不少用户反映电脑网速慢得情况,可能是宽带速度被限制的原因,只需解除限制即可,具体该如何操作呢?本文就跟大家一起来看看Windows系统解除网络限制的操作方法吧... 有不少用户反映电脑网速慢得情况,可能是宽带速度被限制的原因,只需解除限制即可,具体该如何操作呢?本文

    CentOS和Ubuntu系统使用shell脚本创建用户和设置密码

    《CentOS和Ubuntu系统使用shell脚本创建用户和设置密码》在Linux系统中,你可以使用useradd命令来创建新用户,使用echo和chpasswd命令来设置密码,本文写了一个shell... 在linux系统中,你可以使用useradd命令来创建新用户,使用echo和chpasswd命令来设

    电脑找不到mfc90u.dll文件怎么办? 系统报错mfc90u.dll丢失修复的5种方案

    《电脑找不到mfc90u.dll文件怎么办?系统报错mfc90u.dll丢失修复的5种方案》在我们日常使用电脑的过程中,可能会遇到一些软件或系统错误,其中之一就是mfc90u.dll丢失,那么,mf... 在大部分情况下出现我们运行或安装软件,游戏出现提示丢失某些DLL文件或OCX文件的原因可能是原始安装包

    电脑显示mfc100u.dll丢失怎么办?系统报错mfc90u.dll丢失5种修复方案

    《电脑显示mfc100u.dll丢失怎么办?系统报错mfc90u.dll丢失5种修复方案》最近有不少兄弟反映,电脑突然弹出“mfc100u.dll已加载,但找不到入口点”的错误提示,导致一些程序无法正... 在计算机使用过程中,我们经常会遇到一些错误提示,其中最常见的就是“找不到指定的模块”或“缺少某个DL

    C语言中位操作的实际应用举例

    《C语言中位操作的实际应用举例》:本文主要介绍C语言中位操作的实际应用,总结了位操作的使用场景,并指出了需要注意的问题,如可读性、平台依赖性和溢出风险,文中通过代码介绍的非常详细,需要的朋友可以参... 目录1. 嵌入式系统与硬件寄存器操作2. 网络协议解析3. 图像处理与颜色编码4. 高效处理布尔标志集合

    Go语言开发实现查询IP信息的MCP服务器

    《Go语言开发实现查询IP信息的MCP服务器》随着MCP的快速普及和广泛应用,MCP服务器也层出不穷,本文将详细介绍如何在Go语言中使用go-mcp库来开发一个查询IP信息的MCP... 目录前言mcp-ip-geo 服务器目录结构说明查询 IP 信息功能实现工具实现工具管理查询单个 IP 信息工具的实现服

    C 语言中enum枚举的定义和使用小结

    《C语言中enum枚举的定义和使用小结》在C语言里,enum(枚举)是一种用户自定义的数据类型,它能够让你创建一组具名的整数常量,下面我会从定义、使用、特性等方面详细介绍enum,感兴趣的朋友一起看... 目录1、引言2、基本定义3、定义枚举变量4、自定义枚举常量的值5、枚举与switch语句结合使用6、枚

    Go 语言中的select语句详解及工作原理

    《Go语言中的select语句详解及工作原理》在Go语言中,select语句是用于处理多个通道(channel)操作的一种控制结构,它类似于switch语句,本文给大家介绍Go语言中的select语... 目录Go 语言中的 select 是做什么的基本功能语法工作原理示例示例 1:监听多个通道示例 2:带

    利用Python快速搭建Markdown笔记发布系统

    《利用Python快速搭建Markdown笔记发布系统》这篇文章主要为大家详细介绍了使用Python生态的成熟工具,在30分钟内搭建一个支持Markdown渲染、分类标签、全文搜索的私有化知识发布系统... 目录引言:为什么要自建知识博客一、技术选型:极简主义开发栈二、系统架构设计三、核心代码实现(分步解析

    C语言函数递归实际应用举例详解

    《C语言函数递归实际应用举例详解》程序调用自身的编程技巧称为递归,递归做为一种算法在程序设计语言中广泛应用,:本文主要介绍C语言函数递归实际应用举例的相关资料,文中通过代码介绍的非常详细,需要的朋... 目录前言一、递归的概念与思想二、递归的限制条件 三、递归的实际应用举例(一)求 n 的阶乘(二)顺序打印