ESP12E Shield+Arduino UNO R3开发板+DHT11温湿度模块+双色LED灯+有源蜂鸣器+光敏电阻模块+I2CLCD1602液晶显示器所构成的室内检测系统

室内检测系统由ESP12E Shield+Arduino UNO R3开发板+DHT11温湿度模块+双色LED灯+有源蜂鸣器+光敏电阻模块+I2CLCD1602液晶显示器所构成。DHT11温湿度模块获取室内温湿度数据通过I2CLCD1602液晶显示器进行显示,另一方面通过ESP12E Shield将数据上传至云平台。光敏电阻进行捕获室内光照强度,若光照强度过弱,即日光过弱,周围环境太黑暗低于设定的阈值,则有源蜂鸣器警报,双色LED灯变红,正常情况下LED灯为绿色。

一、设备准备

Arduino UNO R3
在这里插入图片描述
I2CLCD1602液晶显示器
在这里插入图片描述
ESP12E Shield
在这里插入图片描述
DHT11温湿度模块
在这里插入图片描述
有源蜂鸣器
在这里插入图片描述
光敏电阻模块
在这里插入图片描述
双色LED灯
在这里插入图片描述

二、设备连接

ESP12E Shield直接覆盖Arduino UNO R3开发板
在这里插入图片描述
DHT11模块

DHT11模块Arduino UNO R3
+5V
-GND
OUTP2

I2CLCD1602液晶显示器

I2CLCD1602液晶显示器Arduino UNO R3
GDNGND
VCC5V
SDAA4
SCLA5

光敏电阻模块

光敏电阻模块Arduino UNO R3
VCC5V
GNDGND
AOA0

有源蜂鸣器

有源蜂鸣器Arduino UNO R3
GNDGND
I/OP7
VCC5V

双色LED灯

双色LED灯Arduino UNO R3
GNDGND
RP11
GP10

三、云平台设置

联网上传至服务器的配置可参考该篇博文
一、Arduino UNO R3将数据上传至云平台
需要添加俩个设备名称分别为humi和temp用于存放温湿度信息
在这里插入图片描述
在这里插入图片描述

四、完整代码

#include <dht.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h> 
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 and 0x3F for a 16 chars and 2 line displaydht DHT;//create a variable type of dhtconst int DHT11_PIN= 2;//Humiture sensor attach to pin2const int greenPin = 11;  // R petal on RGB LED module connected to digital pin 11 
const int redPin= 10;  // G petal on RGB LED module connected to digital pin 10 const int photocellPin = A0; //photoresistor module attach to A0
int outputValue = 0;
const int buzzerPin=7;  //buzzer attach to digital 7
int val = 0; 
int wendu=0;
int shidu=0;
void setup()
{Serial.begin(9600);randomSeed(analogRead(0));pinMode(buzzerPin,OUTPUT);pinMode(redPin, OUTPUT); //set redPin as OUTPUTpinMode(greenPin, OUTPUT);//set greenPin as OUTPUTlcd.init();  //initialize the lcdlcd.backlight();  //open the backlight 
}void loop()
{// READ DATA//Serial.println("DHT11:");D: int chk = DHT.read11(DHT11_PIN);//read the value returned from sensorswitch (chk){case DHTLIB_OK:  //Serial.println("OK!"); break;case DHTLIB_ERROR_CHECKSUM: //goto D;//Serial.print("Checksum error,\t"); break;case DHTLIB_ERROR_TIMEOUT: //goto D;//Serial.print("Time out error,\t"); break;default: // goto D;//Serial.print("Unknown error,\t"); break;}// DISPLAY DATAlcd.setCursor(0, 0);lcd.print("Tem:");//Serial.print("Tem:");lcd.print(DHT.temperature,1); //print the temperature on lcd wendu = DHT.temperature;
/*Serial.print("wendu:");Serial.print(wendu);Serial.print("\n");
*/Serial.print("cmd=upload&device_name=temp&data=");Serial.print(wendu);//send a random numberSerial.println("&uid=beyondyy&key=6d2cc6e3e19efa259a302fcf4166e2ce");lcd.print(char(223));//print the unit" ℃ "lcd.print("C");// Serial.println(" C");lcd.setCursor(0, 1);lcd.print("Hum:");//Serial.print("Hum:");lcd.print(DHT.humidity,1); //print the humidity on lcdshidu = DHT.humidity;/*Serial.print("shidu:");Serial.print(shidu);Serial.print("\n");*/Serial.print("cmd=upload&device_name=humi&data=");Serial.print(shidu);//send a random numberSerial.println("&uid=beyondyy&key=6d2cc6e3e19efa259a302fcf4166e2ce");lcd.print(" %"); //Serial.println(" %");delay(200); //wait a while outputValue = analogRead(photocellPin);//read the value of photoresistor//Serial.println(outputValue); //print it in serial monitorif(outputValue >= 500) //else{digitalWrite(buzzerPin,LOW);analogWrite(redPin, 255); //red value decreaseanalogWrite(greenPin, 0); //green value decreasedelay(100);//Serial.println(val, DEC);}else{digitalWrite(buzzerPin,HIGH);analogWrite(greenPin, 255); //green value decreaseanalogWrite(redPin, 0); //red value decreasedelay(100);}delay(1000); //delay 1s}

所需库下载连接
将下载好的压缩包解压,把文件Dht复制到你的编译器Arduino的libraries文件夹下
在这里插入图片描述

五、视频效果演示

基于Arduino UNO R3开发板的安全检测系统的实现---DHT11数据采集上云

视频链接CSDN
视频链接B站

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/377818.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

输入输出函数:

一、printf函数&#xff1a;     printf("Hello World!\n");     printf("My age is %d\n",26);     int age 17;     printf("My age is %d\n",age);  %d 或 %i: 带符号 十进制整数。   %o:不带符号 八进制整数。   %x:…

leetcode 202. 快乐数 思考分析(哈希集合与双指针解)

1、题目 编写一个算法来判断一个数 n 是不是快乐数。 「快乐数」定义为&#xff1a;对于一个正整数&#xff0c;每一次将该数替换为它每个位置上的数字的平方和&#xff0c;然后重复这个过程直到这个数变为 1&#xff0c;也可能是 无限循环 但始终变不到 1。如果 可以变为 1&am…

五、线性回归和多项式回归实现

官网API 一、线性回归 针对的是损失函数loss faction Ⅰ、Lasso Regression 采用L1正则&#xff0c;会使得w值整体偏小&#xff1b;w会变小从而达到降维的目的 import numpy as np from sklearn.linear_model import Lasso from sklearn.linear_model import SGDRegresso…

JavaScript中的地图与对象

JavaScript对象与地图 (JavaScript Objects vs Maps) Objects are super popular in JavaScript so its not a term you are hearing for the first time even if youre a novice JS developer. Objects, in general, are a very common data structure that is used very ofte…

深发展银行编码器(解剖)

电池拆下来&#xff0c;再装上&#xff0c;还能继续用下&#xff0c;不会被重置 转载于:https://www.cnblogs.com/ahuo/archive/2012/01/25/2329485.html

关于$.getJson

这是一个Ajax函数的缩写&#xff0c;这相当于: 123456$.ajax({dataType: "json",url: url,data: data,success: success});数据会被附加到一个查询字符串的URL中&#xff0c;发送到服务器。如果该值的data参数是一个普通的对象&#xff0c;它会转换为一个字符串并使用…

leetcode 1. 两数之和 思考分析

1、题目 给定一个整数数组 nums 和一个目标值 target&#xff0c;请你在该数组中找出和为目标值的那 两个 整数&#xff0c;并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是&#xff0c;数组中同一个元素不能使用两遍。 2、思考分析 双for循环的时间复杂度…

六、逻辑回归

一、何为逻辑回归 逻辑回归可以简单理解为是基于多元线性回归的一种缩放。 多元线性回归y的取值范围在(-∞&#xff0c;∞)&#xff0c;数据集中的x是准确的一个数值。 用这样的一个数据集代入线性回归算法当中会得到一个模型。 这个模型所具备的功能就是当有人给这个模型一个…

C# 调用Windows API实现两个进程间的通信

使用Windows API实现两个进程间&#xff08;含窗体&#xff09;的通信http://blog.csdn.net/huangxinfeng/article/details/5513608 从C#下使用WM_COPYDATA传输数据说到Marshal的应用http://www.cnblogs.com/jiangyh-is-me/archive/2006/06/05/417381.html 问题解决&#xff1a…

如何在Golang中返回错误?

In Golang, we return errors explicitly using the return statement. This contrasts with the exceptions used in languages like java, python. The approach in Golang to makes it easy to see which function returns an error? 在Golang中&#xff0c;我们使用return…

leetcode 383. 赎金信 思考分析

题目 给定一个赎金信 (ransom) 字符串和一个杂志(magazine)字符串&#xff0c;判断第一个字符串 ransom 能不能由第二个字符串 magazines 里面的字符构成。如果可以构成&#xff0c;返回 true &#xff1b;否则返回 false。 (题目说明&#xff1a;为了不暴露赎金信字迹&#x…

Numpy(科学计算库)---讲解

本内容来自《跟着迪哥学Python数据分析与机器学习实战》&#xff0c;该篇博客将其内容进行了整理&#xff0c;加上了自己的理解&#xff0c;所做小笔记。若有侵权&#xff0c;联系立删。 迪哥说以下的许多函数方法都不用死记硬背&#xff0c;多查API多看文档&#xff0c;确实&a…

仿安居客好租网房产源码

网站设计简约&#xff0c;大方&#xff0c;清爽开发技术&#xff1a;ASP.NET3.5,SQL2005,VS2008功能简介1、小区&#xff0c;二手房&#xff0c;租房小区发布&#xff0c;编辑&#xff0c;修改功能&#xff0c;图片批量上传2、支持积分&#xff0c;发布房源、发布论坛帖子可获得…

Eclipse中classpath和deploy assembly的文件位置

classpath的配置信息存储在工程根目录下的.classpath文件 deploy assembly配置信息存储在工程目录下的.settings\org.eclipse.wst.common.component文件中转载于:https://www.cnblogs.com/jubincn/p/3381087.html

LeetCode 454. 四数相加 II 思考分析

题目 给定四个包含整数的数组列表 A , B , C , D ,计算有多少个元组 (i, j, k, l) &#xff0c;使得 A[i] B[j] C[k] D[l] 0。 为了使问题简单化&#xff0c;所有的 A, B, C, D 具有相同的长度 N&#xff0c;且 0 ≤ N ≤ 500 。所有整数的范围在 -228 到 228 - 1 之间&am…

ruby 嵌套函数_Ruby嵌套直到循环带有示例

ruby 嵌套函数嵌套直到循环 (Nested until loop) Alike for, while, and do...while, until loop can also be nested for meeting the specific purpose. In this type of nesting, two until loops work in the combination such that at first, the outer loop is triggered…

SQL Server 2008中SQL增强功能点Merge

sql server 2008提供了一个增强的Sql命令Merge,用法参看MSDN。能根据两张表数据的不同&#xff0c;对两张表进行数据执行插入&#xff0c;更新或删除等操作&#xff0c;一般用在数据的抽取&#xff0c;例如&#xff0c;根据在另一个表中找到的差异在一个表中插入、更新或删除行…

Numpy(科学计算库)---小练习

1&#xff0c;打印当前Numpy版本 import numpy as np print (np.__version__) """ 1.22.3 """2&#xff0c;构造一个全零的矩阵&#xff0c;并打印其占用的内存大小 yy np.zeros((3,3)) yy """ array([[0., 0., 0.],[0., 0., …

【转】Spark源码分析之-scheduler模块

原文地址&#xff1a;http://jerryshao.me/architecture/2013/04/21/Spark%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90%E4%B9%8B-scheduler%E6%A8%A1%E5%9D%97/ Background Spark在资源管理和调度方式上采用了类似于Hadoop YARN的方式&#xff0c;最上层是资源调度器&#xff0c;它负…

【C++grammar】析构、友元、拷贝构造函数、深浅拷贝

目录1、Destructor&#xff08;析构函数&#xff09;在堆和栈(函数作用域与内嵌作用域)上分别创建Employee对象&#xff0c;观察析构函数的行为2、Friend&#xff08;友元&#xff09;1、为何需要友元2、友元函数和友元类3、关于友元的一些问题3、Copy Constructor&#xff08;…