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

    相关文章

    JWT + 拦截器实现无状态登录系统

    《JWT+拦截器实现无状态登录系统》JWT(JSONWebToken)提供了一种无状态的解决方案:用户登录后,服务器返回一个Token,后续请求携带该Token即可完成身份验证,无需服务器存储会话... 目录✅ 引言 一、JWT 是什么? 二、技术选型 三、项目结构 四、核心代码实现4.1 添加依赖(pom

    GO语言短变量声明的实现示例

    《GO语言短变量声明的实现示例》在Go语言中,短变量声明是一种简洁的变量声明方式,使用:=运算符,可以自动推断变量类型,下面就来具体介绍一下如何使用,感兴趣的可以了解一下... 目录基本语法功能特点与var的区别适用场景注意事项基本语法variableName := value功能特点1、自动类型推

    GO语言中函数命名返回值的使用

    《GO语言中函数命名返回值的使用》在Go语言中,函数可以为其返回值指定名称,这被称为命名返回值或命名返回参数,这种特性可以使代码更清晰,特别是在返回多个值时,感兴趣的可以了解一下... 目录基本语法函数命名返回特点代码示例命名特点基本语法func functionName(parameters) (nam

    基于Python实现自动化邮件发送系统的完整指南

    《基于Python实现自动化邮件发送系统的完整指南》在现代软件开发和自动化流程中,邮件通知是一个常见且实用的功能,无论是用于发送报告、告警信息还是用户提醒,通过Python实现自动化的邮件发送功能都能... 目录一、前言:二、项目概述三、配置文件 `.env` 解析四、代码结构解析1. 导入模块2. 加载环

    linux系统上安装JDK8全过程

    《linux系统上安装JDK8全过程》文章介绍安装JDK的必要性及Linux下JDK8的安装步骤,包括卸载旧版本、下载解压、配置环境变量等,强调开发需JDK,运行可选JRE,现JDK已集成JRE... 目录为什么要安装jdk?1.查看linux系统是否有自带的jdk:2.下载jdk压缩包2.解压3.配置环境

    Go语言连接MySQL数据库执行基本的增删改查

    《Go语言连接MySQL数据库执行基本的增删改查》在后端开发中,MySQL是最常用的关系型数据库之一,本文主要为大家详细介绍了如何使用Go连接MySQL数据库并执行基本的增删改查吧... 目录Go语言连接mysql数据库准备工作安装 MySQL 驱动代码实现运行结果注意事项Go语言执行基本的增删改查准备工作

    Go语言使用Gin处理路由参数和查询参数

    《Go语言使用Gin处理路由参数和查询参数》在WebAPI开发中,处理路由参数(PathParameter)和查询参数(QueryParameter)是非常常见的需求,下面我们就来看看Go语言... 目录一、路由参数 vs 查询参数二、Gin 获取路由参数和查询参数三、示例代码四、运行与测试1. 测试编程路

    基于Python实现温度单位转换器(新手版)

    《基于Python实现温度单位转换器(新手版)》这篇文章主要为大家详细介绍了如何基于Python实现温度单位转换器,主要是将摄氏温度(C)和华氏温度(F)相互转换,下面小编就来和大家简单介绍一下吧... 目录为什么选择温度转换器作为第一个项目项目概述所需基础知识实现步骤详解1. 温度转换公式2. 用户输入处

    Go语言使用net/http构建一个RESTful API的示例代码

    《Go语言使用net/http构建一个RESTfulAPI的示例代码》Go的标准库net/http提供了构建Web服务所需的强大功能,虽然众多第三方框架(如Gin、Echo)已经封装了很多功能,但... 目录引言一、什么是 RESTful API?二、实战目标:用户信息管理 API三、代码实现1. 用户数据

    Linux查询服务器系统版本号的多种方法

    《Linux查询服务器系统版本号的多种方法》在Linux系统管理和维护工作中,了解当前操作系统的版本信息是最基础也是最重要的操作之一,系统版本不仅关系到软件兼容性、安全更新策略,还直接影响到故障排查和... 目录一、引言:系统版本查询的重要性二、基础命令解析:cat /etc/Centos-release详