![Arduino-湿度传感器_第1页](http://file3.renrendoc.com/fileroot_temp3/2022-2/25/d5cbd019-2296-4b31-84cf-5b61d2c20f3f/d5cbd019-2296-4b31-84cf-5b61d2c20f3f1.gif)
![Arduino-湿度传感器_第2页](http://file3.renrendoc.com/fileroot_temp3/2022-2/25/d5cbd019-2296-4b31-84cf-5b61d2c20f3f/d5cbd019-2296-4b31-84cf-5b61d2c20f3f2.gif)
![Arduino-湿度传感器_第3页](http://file3.renrendoc.com/fileroot_temp3/2022-2/25/d5cbd019-2296-4b31-84cf-5b61d2c20f3f/d5cbd019-2296-4b31-84cf-5b61d2c20f3f3.gif)
![Arduino-湿度传感器_第4页](http://file3.renrendoc.com/fileroot_temp3/2022-2/25/d5cbd019-2296-4b31-84cf-5b61d2c20f3f/d5cbd019-2296-4b31-84cf-5b61d2c20f3f4.gif)
![Arduino-湿度传感器_第5页](http://file3.renrendoc.com/fileroot_temp3/2022-2/25/d5cbd019-2296-4b31-84cf-5b61d2c20f3f/d5cbd019-2296-4b31-84cf-5b61d2c20f3f5.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Arduino - 湿度传感器在本节中,我们将学习如何使不同的传感器连接我们的 Arduino 板。 我们将讨论以 下传感器 -湿度传感器(DHT22温度传感器(LM35检测传感器(简单触发PIR 传感器超声波传感器GPS湿度传感器 (DHT22DHT-22(也称为 AM2302 是个数字输出,相对湿度和温度传感器。 它使电容式湿 度传感器和热敏电阻测量周围空,并在数据引脚上发送数字信号。在本例中,您将了解如何将此传感器与 Arduino UNO起使。 室温和湿度将打印到 串监视器上。DHT-22 传感器连接很简单。 左边的第个引脚为 3-5V 电源,第个引脚连接到数据输引脚,最右 边的引脚连
2、接到地。技术细节电源 - 3-5V最电流 - 2.5mA湿度 - 0-100%,精确度为 2-5%温度 - 40 80°C,精度为 ±0.5°C必需的组件您将需要以下组件 -1 × Breadboard 包板1 × Arduino Uno R31 × DHT221 × 10K欧姆电阻程序 按照电路图并挂接包板上的组件,如下图所。草图在计算机上打开 Arduino IDE软件。 在 Arduino 语编码将控制你的电路。 通过单击新 建打开个新的草图件。Arduino 代码/ Example testing sketch fo
3、r various DHT humidity/temperature sens #include "DHT.h"#define DHTPIN 2 / what digital pin we're connected to/ Uncomment whatever type you're using!/#define DHTTYPE DHT11 / DHT 11#define DHTTYPE DHT22 / DHT 22 (AM2302, AM2321/#define DHTTYPE DHT21 / DHT 21 (AM2301/ Connect pin 1 (
4、on the left of the sensor to +5V/ NOTE: If using a board with 3.3V logic like an Arduino Due conne / to 3.3V instead of 5V!/ Connect pin 2 of the sensor to whatever your DHTPIN is/ Connect pin 4 (on the right of the sensor to GROUND/ Connect a 10K resistor from pin 2 (data to pin 1 (power of the / I
5、nitialize DHT sensor./ Note that older versions of this library took an optional third / tweak the timings for faster processors. This parameter is no lo / as the current DHT reading algorithm adjusts itself to work on f DHT dht(DHTPIN, DHTTYPE;void setup( Serial.begin(9600;Serial.println("DHTx
6、x test!"dht.begin(;void loop( delay(2000; / Wait a few seconds between measurementsfloat h = dht.readHumidity(;/ Reading temperature or humidity takes about 250 milliseconds! float t = dht.readTemperature(;/ Read temperature as Celsius (the defaultfloat f = dht.readTemperature(true;/ Read tempe
7、rature as Fahrenheit (isFahrenheit = true/ Check if any reads failed and exit early (to try again. if (isnan(h | isnan(t | isnan(f Serial.println("Failed to read from DHT sensor!"return;/ Compute heat index in Fahrenheit (the defaultfloat hif = puteHeatIndex(f, h;/ Compute heat index in Ce
8、lsius (isFahreheit = falsefloat hic = puteHeatIndex(t, h, false;Serial.print ("Humidity: "Serial.print (h;Serial.print (" %t"Serial.print ("Temperature: "Serial.print (t;Serial.print (" *C "Serial.print (f;Serial.print (" *Ft"Serial.print ("Heat index: "Serial.print (hic;Serial.print (" *C "Serial.print (hif;Serial.println (" *F"代码说明DHT22传感器具有四个端 (V cc, DATA , NC , GND ,它们连接到电路板,如下 : DATA 引脚连接到 Arduino 引脚号 2Vcc 引脚到 5伏的 Arduino 板GND 引脚连接到 Arduino 板的地我们需要在 DA
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2023八年级数学上册 第2章 三角形2.5 全等三角形第5课时 SSS说课稿 (新版)湘教版
- 2024年九年级语文上册 第五单元 第17课《草房子》说课稿 鄂教版
- 25《慢性子裁缝和急性子顾客》(说课稿)-2023-2024学年统编版语文三年级下册
- 2024-2025学年高中物理 第一章 电磁感应 4 楞次定律说课稿 教科版选修3-2
- 2025深圳市途安汽车租赁有限公司租赁合同
- 2025地区代理合同样式详细版
- 2024年四年级英语下册 Unit 5 What will you do this weekend Lesson 27说课稿 人教精通版(三起)
- 2023八年级生物下册 第七单元 生物圈中生命的延续和发展第一章 生物的生殖和发育第2节 昆虫的生殖和发育说课稿 (新版)新人教版
- 个人消防安装合同范例
- 俄罗斯电梯采购合同范例
- 胎儿性别鉴定报告模板
- 大学生就业指导PPT(第2版)全套完整教学课件
- 家具安装工培训教案优质资料
- 湖南大一型抽水蓄能电站施工及质量创优汇报
- 耳穴疗法治疗失眠
- 少儿财商教育少儿篇
- GB 1886.114-2015食品安全国家标准食品添加剂紫胶(又名虫胶)
- 初二上册期末数学试卷含答案
- envi二次开发素材包-idl培训
- 2022年上海市初中语文课程终结性评价指南
- 西门子starter软件简易使用手册
评论
0/150
提交评论