dht22数字温湿度传感器am2302温湿度模块(带说明)

合集下载

温湿度数字传感器AM2302.pdf

温湿度数字传感器AM2302.pdf
Free Datasheet
数字温湿度传感器 AM2302
注: AM2302 也叫 DHT22
数字温湿度传感器 AM2302
小体积 AM2302 ►相对湿度和温度测量 ►全部校准,数字输出 ►卓越的长期稳定性 ►无需额外部件 ►超长的信号传输距离 ►超低能耗 ►4 引脚安装 ►完全互换
湿度数据
温度数据
校验和
湿度高8位+湿度低8位+温度高8位+温度低8位=的末8位=校验和
例如:0000 0010+1000 1100+0000 0001+0101 1111=1110 1110
湿度=65.2%RH 温度=35.1℃
当温度低于0℃时温度数据的最高位置1。
例如:-10.1℃表示为1000 0000 0110 0101
Free Datasheet
数字温湿度传感器 AM2302
注: AM2302 也叫 DHT22
3、 电源引脚 AM2302的供电电压为3.3-6V。传感器上电后,要等待 1s 以越过不稳定状态在此期
间无需发送任何指令。电源引脚(VDD,GND)之间可增加一个100nF 的电容,用以去耦 滤波。 4、单总线接口

16
Bit
重复性
±0.2

精度
<±0.5

量程范围
-40
80

响应时间
1/e(63%)
6
20
S
2、 采样周期不得低于最小值,否则会引起错误
3、 接口说明
建议连接线长度短于20米时用5K上拉电阻,大于20米时根据实际情况使
用合适的上拉电阻
AM2302的接线图如下图所示。

DHT22(AM2302)数字温湿度传感器

DHT22(AM2302)数字温湿度传感器

温湿度模块AM2302 产品手册一、产品概述AM2302湿敏电容数字温湿度模块是一款含有己校准数字信号输出的温湿度复合传感器。

它应用专用的数字模块采集技术和温湿度传感技术,确保产品具有极高的可靠性与卓越的长期稳定性。

传感器包括一个电容式感湿元件和一个高精度测温元件,并与一个高性能8位单片机相连接。

因此该产品具有品质卓越、超快响应、抗干扰能力强、性价比极高等优点。

每个传感器都在极为精确的湿度校验室中进行校准。

校准系数以程序的形式储存在单片机中,传感器内部在检测信号的处理过程中要调用这些校准系数。

标准单总线接口,使系统集成变得简易快捷。

超小的体积、极低的功耗,信号传输距离可达20米以上,使其成为各类应用甚至最为苛刻的应用场合的最佳选择。

产品为3引线(单总线接口)连接方便。

特殊封装形式可根据用户需求而提供。

实物图外形尺寸(单位:mm)二、应用范围暖通空调、除湿器、测试及检测设备、消费品、汽车、自动控制、数据记录器、家电、湿度调节器、医疗、气象站、及其他相关湿度检测控制等。

三、产品亮点超低能耗、传输距离远、全部自动化校准、采用电容式湿敏元件、完全互换、标准数字单总线输出、卓越的长期稳定性、采用高精度测温元件。

四、单总线接口定义4.1 AM2302引脚分配表1:AM2302引脚分配图1:AM2302引脚分配图4.2 引脚说明(VDD SDA GND)AM2302的供电电压范围为3.3V - 5.5V,建议供电电压为5V。

数据线SDA引脚为三态结构,用于读写传感器数据。

详细见单总线的通信协议说明。

五、传感器性能 5.1 相对湿度表2: AM2302相对湿度性能表图2: 25℃时AM2302的相对湿度最大误差 图3:温度传感器的温度最大误差六、电气特性电气特性,如能耗,高、低电平,输入、输出电压等,都取决于电源。

表4详细说明了AM2302的电气特性,若没有标明,则表示供电电压为5V 。

若想与传感器获得最佳效果,请设计时严格遵照表4的条件设计。

DHT22 AM2302

DHT22 AM2302

数字温湿度传感器AM2302小体积AM2302大体积AM2302►相对湿度和温度测量►全部校准,数字输出►卓越的长期稳定性►无需额外部件►超长的信号传输距离►超低能耗►4引脚安装►完全互换AM2302产品概述AM2302数字温湿度传感器是一款含有已校准数字信号输出的温湿度复合传感器。

它应用专用的数字模块采集技术和温湿度传感技术,确保产品具有极高的可靠性与卓越的长期稳定性。

传感器包括一个电容式感湿元件和一个NTC 测温元件,并与一个高性能8位单片机相连接。

因此该产品具有品质卓越、超快响应、抗干扰能力强、性价比极高等优点。

每个AM2302传感器都在极为精确的湿度校验室中进行校准。

校准系数以程序的形式储存在OTP内存中,传感器内部在检测信号的处理过程中要调用这些校准系数。

单线制串行接口,使系统集成变得简易快捷。

超小的体积、极低的功耗,信号传输距离可达20米以上,使其成为各类应用甚至最为苛刻的应用场合的最佳选则。

产品为4针单排引脚封装。

连接方便,特殊封装形式可根据用户需求而提供。

应用领域►暖通空调►测试及检测设备►汽车►数据记录器►消费品►自动控制►气象站►家电►湿度调节器►医疗1、传感器性能说明2、采样周期不得低于最小值,否则会引起错误3、接口说明建议连接线长度短于20米时用5K 上拉电阻,大于20米时根据实际情况使用合适的上拉电阻AM2302的接线图如下图所示。

参数条件Min Typ Max 单位湿度分辨率0.1%RH 16Bit 重复性±0.3%RH 精度25℃±2%RH -2-200-80℃±2%RH 互换性可完全互换采样周期2S 响应时间1/e(63%)25℃,1m/s 空气<5S 迟滞<±0.3%RH 长期稳定性典型值<±0.5%RH/yr温度分辨率0.1℃16Bit重复性±0.0.22℃精度<±0.5℃量程范围-4080℃响应时间1/e(63%)620S3、电源引脚AM2302的供电电压为3.3-6V。

DHT22使用范例

DHT22使用范例

/****************************************************************/ /// DHT22使用范例//单片机:AT89S52或STC89C52RC//功能:串口发送温湿度数据波特率9600//公司:**********//**************************************************************** //#include <reg51.h>#include <intrins.h>//typedef unsigned char U8; /* defined for unsigned 8-bits integer variable无符号8位整型变量*/typedef signed char S8; /* defined for signed 8-bits integer variable有符号8位整型变量*/typedef unsigned int U16; /* defined for unsigned 16-bits integer variable无符号16位整型变量*/typedef signed int S16; /* defined for signed 16-bits integer variable有符号16位整型变量*/typedef unsigned long U32; /* defined for unsigned 32-bits integer variable 无符号32位整型变量*/typedef signed long S32; /* defined for signed 32-bits integer variable有符号32位整型变量*/typedef float F32; /* single precision floating point variable(32bits)单精度浮点数(32位长度)*/typedef double F64; /* double precision floating point variable(64bits)双精度浮点数(64位长度)*///#define uchar unsigned char#define uint unsigned int#define Data_0_time 4//----------------------------------------------////----------------IO口定义区--------------------////----------------------------------------------//sbit P2_0 = P2^0 ;sbit P2_1 = P2^1 ;sbit P2_2 = P2^2 ;sbit P2_3 = P2^3 ;//----------------------------------------------//济南联诚创发科技有限公司电子部Page 13 of 18数字温湿度传感器AM2302//----------------定义区--------------------////----------------------------------------------//U8 U8FLAG,k;U8 U8count,U8temp;U8 U8T_data_H,U8T_data_L,U8RH_data_H,U8RH_data_L,U8checkdata;U8U8T_data_H_temp,U8T_data_L_temp,U8RH_data_H_temp,U8RH_data_L_temp ,U8checkdata_t emp;U8 outdata[5]; //定义发送的字节数U8 indata[5];U8 count, count_r=0;U8 str[5]={"RS232"};U16 U16temp1,U16temp2;SendData(U8 *a){outdata[0] = a[0];outdata[1] = a[1];outdata[2] = a[2];outdata[3] = a[3];outdata[4] = a[4];count = 1;SBUF=outdata[0];}void Delay(U16 j){ U8 i;for(;j>0;j--){for(i=0;i<27;i++);}}void Delay_10us(void){U8 i;i--;i--;i--;i--;i--;i--;}void COM(void)济南联诚创发科技有限公司电子部Page 14 of 18 数字温湿度传感器AM2302{U8 i;for(i=0;i<8;i++){U8FLAG=2;while((!P2_0)&&U8FLAG++);Delay_10us();Delay_10us();Delay_10us();U8temp=0;if(P2_0)U8temp=1;U8FLAG=2;while((P2_0)&&U8FLAG++);//超时则跳出for循环if(U8FLAG==1)break;//判断数据位是0还是1//如果高电平高过预定0高电平值则数据位为1}//rof}//--------------------------------//-----湿度读取子程序------------//--------------------------------//----以下变量均为全局变量--------//----温度高8位== U8T_data_H------//----温度低8位== U8T_data_L------//----湿度高8位== U8RH_data_H-----//----湿度低8位== U8RH_data_L-----//----校验8位== U8checkdata-----//----调用相关子程序如下----------//---- Delay();, Delay_10us();,COM();//--------------------------------void RH(void){//主机拉低18msP2_0=0;济南联诚创发科技有限公司电子部Page 15 of 18 数字温湿度传感器AM2302Delay(5);P2_0=1;//总线由上拉电阻拉高主机延时20usDelay_10us();Delay_10us();Delay_10us();Delay_10us();//主机设为输入判断从机响应信号P2_0=1;//判断从机是否有低电平响应信号如不响应则跳出,响应则向下运行if(!P2_0)//T !{U8FLAG=2;//判断从机是否发出80us的低电平响应信号是否结束while((!P2_0)&&U8FLAG++);U8FLAG=2;//判断从机是否发出80us的高电平,如发出则进入数据接收状态while((P2_0)&&U8FLAG++);//数据接收状态COM();COM();COM();COM();COM();P2_0=1;//数据校验U8temp=(U8T_data_H_temp+U8T_data_L_temp+U8RH_data_H_temp+U8RH_d ata_L_temp);if(U8temp==U8checkdata_temp)if(1){U8RH_data_H=U8RH_data_H_temp;U8RH_data_L=U8RH_data_L_temp;U8T_data_H=U8T_data_H_temp;U8T_data_L=U8T_data_L_temp;U8checkdata=U8checkdata_temp;}//fi}//fi济南联诚创发科技有限公司电子部Page 16 of 18数字温湿度传感器AM2302}//----------------------//P2_1=0 ; //T//P2_1=1 ; //T//----------------------//----------------------//P2_1=0 ; //T//P2_1=1 ; //T//----------------------//----------------------------------------------//main()功能描述:AT89C51 11.0592MHz 串口发//送温湿度数据,波特率9600//----------------------------------------------void main(){U8 i,j;//uchar str[6]={"RS232"};/*系统初始化*/TMOD = 0x20;//定时器T1使用工作方式2TH1 = 253; //设置初值TL1 = 253;TR1 = 1; //开始计时SCON = 0x50;//工作方式1,波特率9600bps,允许接收ES = 1;EA = 1; //打开所以中断TI = 0;RI = 0;SendData(str) ; //发送到串口Delay(1); //延时100US(12M晶振)while(1){//------------------------//调用温湿度读取子程序RH();//串口显示程序//--------------------------str[0]=U8RH_data_H;str[1]=U8RH_data_L;str[2]=U8T_data_H;str[3]=U8T_data_L;济南联诚创发科技有限公司电子部Page 17 of 18 数字温湿度传感器AM2302str[4]=U8checkdata;SendData(str) ; //发送到串口//读取模块数据周期不易小于2SDelay(200);}//elihw}// mainvoid RSINTR() interrupt 4 using 2{U8 InPut3;if(TI==1) //发送中断{TI=0;if(count!=5) //发送完5位数据{SBUF= outdata[count];count++;}}if(RI==1)//接收中断{InPut3=SBUF;indata[count_r]=InPut3;count_r++;RI=0;if (count_r==5)//接收完4位数据{//数据接收完毕处理。

DHT22(AM2302)数字温湿度传感器

DHT22(AM2302)数字温湿度传感器

温湿度模块AM2302 产品手册一、产品概述AM2302湿敏电容数字温湿度模块是一款含有己校准数字信号输出的温湿度复合传感器。

它应用专用的数字模块采集技术和温湿度传感技术,确保产品具有极高的可靠性与卓越的长期稳定性。

传感器包括一个电容式感湿元件和一个高精度测温元件,并与一个高性能8位单片机相连接。

因此该产品具有品质卓越、超快响应、抗干扰能力强、性价比极高等优点。

每个传感器都在极为精确的湿度校验室中进行校准。

校准系数以程序的形式储存在单片机中,传感器内部在检测信号的处理过程中要调用这些校准系数。

标准单总线接口,使系统集成变得简易快捷。

超小的体积、极低的功耗,信号传输距离可达20米以上,使其成为各类应用甚至最为苛刻的应用场合的最佳选择。

产品为3引线(单总线接口)连接方便。

特殊封装形式可根据用户需求而提供。

实物图外形尺寸(单位:mm)二、应用范围暖通空调、除湿器、测试及检测设备、消费品、汽车、自动控制、数据记录器、家电、湿度调节器、医疗、气象站、及其他相关湿度检测控制等。

三、产品亮点超低能耗、传输距离远、全部自动化校准、采用电容式湿敏元件、完全互换、标准数字单总线输出、卓越的长期稳定性、采用高精度测温元件。

四、单总线接口定义4.1 AM2302引脚分配表1:AM2302引脚分配图1:AM2302引脚分配图4.2 引脚说明(VDD SDA GND)AM2302的供电电压范围为3.3V - 5.5V,建议供电电压为5V。

数据线SDA引脚为三态结构,用于读写传感器数据。

详细见单总线的通信协议说明。

五、传感器性能 5.1 相对湿度表2: AM2302相对湿度性能表图2: 25℃时AM2302的相对湿度最大误差 图3:温度传感器的温度最大误差六、电气特性电气特性,如能耗,高、低电平,输入、输出电压等,都取决于电源。

表4详细说明了AM2302的电气特性,若没有标明,则表示供电电压为5V 。

若想与传感器获得最佳效果,请设计时严格遵照表4的条件设计。

DHT11, DHT22 and AM2302 Sensors说明书

DHT11, DHT22 and AM2302 Sensors说明书

DHT11, DHT22 and AM2302 SensorsCreated by lady adahttps:///dhtLast updated on 2022-12-01 01:49:21 PM EST34681213Table of ContentsOverview• DHT11 vs DHT22Connecting to a DHTxx Sensor Using a DHTxx Sensor DHT CircuitPython Code• Adafruit CircuitPython Module Install• Wiring• Usage• Example CodePython DocsDownloads• SimulatorOverviewThis tutorial covers the low cost DHT temperature & humidity sensors (). These sensors are very basic and slow, but are great for hobbyists who want to do some basic data logging. The DHT sensors are made of two parts, a capacitive humidity sensor and a thermistor (). There is also a very basic chip inside that does some analog to digital conversion and spits out a digital signal with the temperature and humidity. The digital signal is fairly easy to read using any microcontroller.DHT11 vs DHT22We have two versions of the DHT sensor, they look a bit similar and have the same pinout, but have different characteristics. Here are the specs:DHT11 (http://adafru.it/386)Ultra low cost3 to 5V power and I/O2.5mA max current use during conversion (while requesting data)Good for 20-80% humidity readings with 5% accuracyGood for 0-50°C temperature readings ±2°C accuracyNo more than 1 Hz sampling rate (once every second)Body size 15.5mm x 12mm x 5.5mm4 pins with 0.1" spacing• • • • • • • •DHT22 (http://adafru.it/385)/ AM2302 () (Wired version)Low cost3 to 5V power and I/O2.5mA max current use during conversion (while requesting data)Good for 0-100% humidity readings with 2-5% accuracyGood for -40 to 80°C temperature readings ±0.5°C accuracyNo more than 0.5 Hz sampling rate (once every 2 seconds)Body size 15.1mm x 25mm x 7.7mm4 pins with 0.1" spacingAs you can see, the DHT22 (http://adafru.it/385) / AM2302 () is a little more accurate and good over a slightly larger range. Both use a single digital pin and are 'sluggish'in that you can't query them more than once every second or two.You can pick up both the DHT11 (http://adafru.it/386) and DHT22 (http://adafru.it/385)or AM2302 () from the adafruit shop!Connecting to a DHTxx SensorLuckily it is trivial to connect to these sensors, they have fairly long 0.1"-pitch pins so you can plug them into any breadboard, perfboard or similar.• • • • • • ••AM2302 (wired DHT22) temperature-humidity sensorDiscontinued - you can grab AM2301B -Wired Enclosed AHT20 - Temperature andHumidity Sensor instead!The...https:///product/393Likewise, it is fairly easy to connect up to the DHT sensors. They have four pinsVCC - red wire Connect to 3.3 - 5V power. Sometime 3.3V power isn't enough in which case try 5V power.Data out - white or yellow wireNot connectedGround - black wireSimply ignore pin 3, its not used. You will want to place a 10 Kohm resistor between VCC and the data pin, to act as a medium-strength pull up on the data line. The Arduino has built in pullups you can turn on but they're very weak, about 20-50K This diagram shows how we will connect for the testing sketch. Connect data to pin 2,you can change it later to any pin.1. 2. 3. 4. another one!If you have an AM2302Using a DHTxx SensorTo test the sketch, we'll use an Arduino. You can use any micrcontroller that can do microsecond timing, but since its a little tricky to code it up, we suggest verifying the wiring and sensor work with an Arduino to start.You should have the Arduino IDE () software running at this time. Next it’s necessary to install our DHT library, which can be done though the Arduino Library Manager:Sketch →Include Library →Manage Libraries…Enter “dht” in the search field and look through the list for “DHT sensor library by Ada fruit.” Click the “Install” button, or “Update” from an earlier version.IMPORTANT: As of version 1.3.0 of the DHT library you will also need to install the Ada fruit Unified Sensor library, which is also available in the Arduino Library Manager:Now load up the Examples→DHT→DHTtester sketch ArrayIf you're using a DHT11 sensor, comment out the line that sets the type://#define DHTTYPE DHT22 // DHT 22 (AM2302)and uncomment the line that says:#define DHTTYPE DHT11 // DHT 11This will make the data appear correctly for the correct sensor. Upload the sketch!You should see the temperature and humidity. You can see changes by breathing onto the sensor (like you would to fog up a window) which should increase the humidity.You can add as many DHT sensors as you line on individual pins, just add new lines such asDHT dht2 = DHT(pin, type);below the declaration for the initial dht object, and you can reference the new dht2whenever you like.DHT CircuitPython CodeAdafruit CircuitPython Module InstallTo use the DHT sensor with your Adafruit CircuitPython board you'll need to install the Adafruit_CircuitPython_DHT () module on your board.This library uses the pulseio module in CircuitPython. As of CircuitPython 7.0.0, pulseio is no longer available on the smallest CircuitPython builds, such as the Trinket M0, Gemma M0, and Feather M0 Basic boards. You can substitute a more modern sensor, which will work better as well. See the guide ModernReplacements for DHT11 and DHT22 Sensors (https:///modern-replacements-for-dht11-dht22-sensors) for suggestions.First make sure you are running the latest version of Adafruit CircuitPython () for your board.Next you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find and install these libraries from Adafruit's CircuitPython library bundle(). Our introduction guide has a great page on how to install the library bundle () for both express and non-express boards.Remember for non-express boards like the, you'll need to manually install the necessary libraries from the bundle:adafruit_dht.mpyYou can also download the adafruit_dht.mpy from its releases page on Github ().Before continuing make sure your board's lib folder or root filesystem has the adafruit _dht.mpy module copied over.WiringDHT wiring is very simple:The left-most pin is power. We recommend powering from 5V (sometimes 3V is not enough) - this is OK even if you are using 3.3V logicThe second pin is data. Connect a 10K pullup resistor from this pin to 3.3V. If you are using a DHT11 it's required. If you're using a DHT22 or AM2302 you can sometimes leave this offSkip the third pinThe right-most pin is ground•• • • • For the DATA pin you must pick a pin that has PWM support (pulseio) - Check the board's guide for what pins have timers availableHere's an example using a Trinket M0 -you can use any CircuitPython board, justcheck that the Data pin is pulseio -capable.In this example we'll use a Feather M0 andDHT22 sensor connected to pin D6Fritzing Source UsageTo demonstrate the usage of the DHT sensor module you can connect to your board's serial REPL and run Python code to read the temperature and humidity.Next connect to the board's serial REPL ()so you are at the CircuitPython >>> prompt.Next import the board and adafruit_dht modules, these are necessary modules to initialize and access the sensor:import boardimport adafruit_dhtYou may also want to try powering the DHT sensor from 5V (we found sometimes it really needs more power) but still having the 10K pull-up resistor to 3.3V volts)Now create an instance of either the DHT11 or DHT22 class, depending on the type of sensor you're using (for the AM2302 sensor use the DHT22 class). You must pass in the pin which is connected to the signal line, for example a DHT22 or AM2302 sensor connected to board pin D6 would need this code:dht = adafruit_dht.DHT22(board.D6)Note for a DHT11 sensor you'd instead use adafruit_dht.DHT11 in place of the adafruit_ dht.DHT22 code above.At this point you're all set and ready to start reading the temperature and humidity! You can do this by reading the temperature property which returns temperature in degrees Celsius:dht.temperatureTo read the humidity grab the value of the humidity property, it will return the percent humidity as a floating point value from 0 to 100%:dht.humidityIn most cases you'll always get back a temperature or humidity value when requested, but sometimes if there's electrical noise or the signal was interrupted in some way you might see an exception thrown to try again. It's normal for these sensors to sometimes be hard to read and you might need to make your code retry a few times if it fails to read. However if you always get errors and can't ever read the sensor then double check your wiring (don't forget the pull-up resistor if needed!) and the power to the device.Example CodeHere's a full example sketch which also manages error-retry logic (which will happen once in a while.Don't forget to change the logic pin to whatever pin you're using! Then save this as main.py on your CircuitPython board# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries## SPDX-License-Identifier: MITimport timeimport adafruit_dht import boarddht = adafruit_dht.DHT22(board.D2)while True: try:temperature = dht.temperaturehumidity = dht.humidity# Print what we got to the REPLprint("Temp: {:.1f} *C \t Humidity: {}%".format(temperature, humidity)) except RuntimeError as e:# Reading doesn't always work! Just print error and we'll try again print("Reading from DHT failure: ", e.args)time.sleep(1)If you are using a DHT11, change the code to use a adafruit_dht.DHT11(board.D2) object.Open the REPL to see the output! Breathe on the sensor to see it move temperature and humidity up (unless you are a White Walker in which case the temperature will go down)Python DocsPython Docs ()DownloadsArduino library and example code for DHT sensors ()Adafruit_Sensor library () (required by the DHT library above)DHT11 datasheet ()(in chinese, so see the DHT22 datasheet too!)DHT22 datasheet ()K&R Smith calibration notes ()SimulatorYou can try out a DHT simulator by Wowki () here: https:///arduino/libraries/DHT-sensor-library ()• • • • •。

温湿度模块DHT22产品手册说明书

温湿度模块DHT22产品手册说明书

温湿度模块DHT22产品手册一、产品概述本产品是采用高稳定性电容式感湿元件作为传感元件,经过微处理器采集处理转化成数字信号输出。

每一个传感器都经过标定校准和测试。

具有长期稳定、可靠性高、精度高、低功耗等特点。

二、尺寸图单位:mm(±0.5)三、产品特点DHT22数字温湿度模块具有以下特点:1、数字输出,IIC协议;2、超低功耗;3、0-100%相对湿度测量范围;4、全标定、温漂校准。

5、使用独立感湿元器件,稳定性好,抗污染能力强四、性能特征相对湿度温度五、电气特性参数条件最小典型最大单位供电电压VDD 2.8 3.3 5.5V 供电电流休眠模式0.2uA 测量模式500uA 采样周期 2.0S低电平输出电压Io<4mA 0250mV 高电平输出电压Rp<25kΩ80%100%VDD 低电平输入电压下降沿0%20%VDD 高电平输入电压上升沿80%100%VDD 输出电流On 4mA 三态门(Off)1020μA表3Io 表示低电平输出电流Rp 代表上拉电阻参数条件最小典型最大单位分辨率0.1%RH 量程范围099.9%RH 精度25℃±3%RH重复性±0.1响应时间1/e(63%)<8S迟滞±0.5漂移典型值<3%RH/r 参数条件最小典型最大单位分辨率0.1℃工作范围-4080℃精度±0.5℃重复性±0.2℃响应时间1/e(63%)1S迟滞±0.1漂移典型值<0.2℃/r图1图2表1表2六、用户指南1、引脚分配引脚名称描述1VDD 电源2.8~5.5V 2SDA 串行数据,双向口3GND 地4SCK 时钟线表4:引脚分配1.1、电源引脚(VDD GND)本产品的供电电压为2.8~5.5V,建议供电电压为3.3V。

1.2、串行数据(SDA)SDA 为数据口,三态结构,SDA 在SCK 时钟下降沿之后改变状态,并仅在SCK 上升沿有效1.3、串行数据(SCK)SCK 用于微处理器与DHT22之间的通讯同步。

DHT11和DHT22(AM2302)温湿度传感器模块驱动程序的区别

DHT11和DHT22(AM2302)温湿度传感器模块驱动程序的区别

DHT11和DHT22(AM2302)温湿度传感器模块驱动程序的区别1.说明官⽅产品页显⽰ DHT11 模块和 DH22(AM2302)模块均已停产,推荐使⽤ DHT20 模块(DHT11升级款)。

2.技术参数对⽐DHT11 技术参数供电电压 DC:3.3-5.5V测量范围 T -20~+60℃测量范围 H 5~95%RH温度精度 ±2℃湿度精度 ±5%RH分辨率温度:0.1℃湿度:1%RH衰减值 T <0.1℃/年衰减值 H <1%RH/年传感器电容式湿度传感器输出信号单总线数字信号外壳材料 ABS塑料重量 1gDHT22(AM2302) 技术参数供电电压 DC:3.3-5.5V测量范围 T -40~+80℃测量范围 H 0~99.9%RH温度精度 ±0.5℃湿度精度 ±2%RH分辨率温度:0.1℃湿度:0.1%RH衰减值 T <0.1℃/年衰减值 H <0.5%RH/年传感器电容式湿度传感器输出信号单总线数字信号外壳材料 PC塑料3.驱动程序区别DHT11 模块和 DH22(AM2302)模块采⽤相同的单总线协议,区别在于读数:## DHT11 接收到的40位数据为:00110101 00000000 00011000 00000100 01010001湿度⾼8位湿度低8位温度⾼8位温度低8位校验位校验计算:00110101 + 00000000 + 00011000 + 00000100 = 01010001表⽰接收数据正确。

转换:湿度:00110101(整数) = 35H = 53%RH00000000(⼩数) = 00H = 0.0%RH=> 53%RH + 0.0%RH = 53.0%RH温度:00011000(整数) = 18H = 24℃00000100(⼩数) = 04H = 0.4℃=> 24℃ + 0.4℃ = 24.4℃## DHT22 接收到的40位数据为:00000010 10010010 00000001 00001101 1010010湿度⾼8位湿度低8位温度⾼8位温度低8位校验位校验计算:00000010 + 10010010 + 00000001 + 00001101 = 1010010表⽰接收数据正确。

DHT22数字温湿度传感器AM2302温湿度模块(带说明)

DHT22数字温湿度传感器AM2302温湿度模块(带说明)

DHT22数字温湿度传感器AM2302温湿度模块(带说明)AM2302温湿度传感器C程序(测试可以⽤)2017-8-13说明:DHT22与DHT11程序基本相同,DHT11起始信号拉低18ms,DHT22起始信号拉低是800us,⽤户主机(MCU)发送⼀次起始信号(把数据总线SDA拉低⾄少800µs)后,AM2302从休眠模式转换到⾼速模式。

待主机开始信号结束后,AM2302发送响应信号,从数据总线SDA串⾏送出40Bit 的数据,先发送字节的⾼位;发送的数据依次为湿度⾼位、湿度低位、温度⾼位、温度低位、校验位,发送数据结束触发⼀次信息采集,采集结束传感器⾃动转⼊休眠模式,直到下⼀次通信来临。

注意事项:与DHT11相同,⼀次采集8个位数据,循环4次采集完成所有数据,40位采集完成后,校验数据,如果数据正确,将⾼8位左移8位与低8位相或,再保存到⼀个16位变量中,就可以得到⼀个整数值。

默认采集的数据是实际值的10倍,例如当前实际温度是32.7度,采集到的数据是327,⽬的是为了编程时⽅便分离数据。

(详细见后⾯说明书)0000 0010 1000 1100 0000 0001 0101 1111 1110 1110湿度数据温度数据校验和湿度⾼8位+湿度低8位+温度⾼8位+温度低8位=的末8位=校验和如果需要处理零下值,16位的最⾼位为1表⽰负数,温度最⼤量程:-20~80度,分辨率:0.1度。

如果⽤数据码管显⽰且有中断,采集数据开始需要关中断,采集结束开中断,否则在采集数据过程中,中断会打断DHT22时序,造成采集数据不正确。

每次采集间隔⼤于1秒,否则采集数据不准确。

C程序:为了⽅便程序阅读,其它器件的初始化及定义都删除掉了,以下代码纯DHT22代码,使⽤时直接调⽤RH函数即可。

由于程序多次修改,可能有多余的变量,⼤家⾃⼰清理下。

RH函数调⽤后,以下四个变量会得相应的数据:R_H 湿度⾼8位R_L 湿度低8位(包含⼩数)T_H 温度⾼8位T_L 湿度低8位(包含⼩数)如果采集的数据是:0000 0010 1000 1100 0000 0001 0101 1111由上⾯四个变量是16位,采集数据是8位,分四次采完,8位放在16位⾥⾯应该是这样:R_H= 00000000 00000010R_L= 00000000 10001100所以R_H左移8个位或上R_L才是我们要的数据。

电子信息工程技术《Arduino传感器模块》

电子信息工程技术《Arduino传感器模块》

传感器温湿度传感器DHT22DHT22数字温湿度传感器是一款含有已校准数字信号输出的温湿度复合传感器。

该产品具有品质卓越、超快响应、抗干扰能力强、性价比极高等优点。

DHT22的供电电压为3-5.5V,温度采集范围为零下40摄氏度到80摄氏度,精度为0.1摄氏度;湿度采集范围为5%到95%,精度为0.1%。

大气压强传感器BMP180BMP180是一款设计在IIC总线上的大气压强传感器,它是由一个压阻传感器,数字模拟转换器,EEPROM和串行IIC接口组成。

BMP180提供的压力和温度补偿的值。

BMP180具备不同的采集模式(超低功率,标准型,高,超高),可根据需求选择。

光照强度传感器BH1750光照强度模块:BH1750是一款设计在IIC总线上的光线强度传感器,它可以探测的光线强度范围为1lx-65535lx。

对光源不敏感,适合收集各种光线数据。

BH1750采集速度快,灵敏度较高,适合使用。

时钟模块DS3231DS3231是低成本、高精度的实时时钟。

该器件包含电池输入端,断开主电源时仍可保持精确的计时。

具有自动调整月末日期以及闰年补齐功能,提供两个可设置的日历闹钟和一个可设置的方波输出。

烟雾传感器MQ-2MQ-2烟雾探测传感器所使用的气敏材料是在清洁空气中电导率较低的二氧化锡(SnO2)。

当传感器所处环境中存在可燃气体时,传感器的电导率随空气中可燃气体浓度的增加而增大。

使用简单的电路即可将电导率的变化转换为与该气体浓度相对应的输出信号。

雨量模块和土壤湿度模块雨量模块可用于天气状况的监测,同时对雨量大小有一个大致的判断,感应板有水滴滴上时传感器感应。

土壤湿度模块用于探测土壤的湿度。

DHT22说明书

DHT22说明书

数字温湿度传感器DHT2DHT222►相对湿度和温度测量►全部校准,数字输出►卓越的长期稳定性►无需额外部件►超长的信号传输距离►超低能耗►4引脚安装►完全互换DHT2DHT222产品概述DHT22数字温湿度传感器是一款含有已校准数字信号输出的温湿度复合传感器。

它应用专用的数字模块采集技术和温湿度传感技术,确保产品具有极高的可靠性与卓越的长期稳定性。

传感器包括一个电容式感湿元件和一个NTC测温元件,并与一个高性能8位单片机相连接。

因此该产品具有品质卓越、超快响应、抗干扰能力强、性价比极高等优点。

每个DHT22传感器都在极为精确的湿度校验室中进行校准。

校准系数以程序的形式储存在OTP内存中,传感器内部在检测信号的处理过程中要调用这些校准系数。

单线制串行接口,使系统集成变得简易快捷。

超小的体积、极低的功耗,信号传输距离可达20米以上,使其成为各类应用甚至最为苛刻的应用场合的最佳选则。

产品为4针单排引脚封装。

连接方便,特殊封装形式可根据用户需求而提供。

应用领域►暖通空调►测试及检测设备►汽车►数据记录器►消费品►自动控制►气象站►家电►湿度调节器►医疗►除湿器1、传感器性能说明2、采样周期不得低于最小值,否则会引起错误3、接口说明建议连接线长度短于20米时用5K上拉电阻,大于20米时根据实际情况使用合适的上拉电阻DHT21和DHT22的接线图如下图所示。

参数条件Min Typ Max 单位湿度分辨率0.1%RH 16Bit 重复性±0.3%RH 精度25℃±2%RH -20-80℃±2%RH 互换性可完全互换采样周期2S 响应时间1/e(63%)25℃,1m/s 空气<5S 迟滞<±0.3%RH 长期稳定性典型值<±0.5%RH/yr温度分辨率0.1℃16Bit重复性±0.2℃精度<±0.5℃量程范围-4080℃响应时间1/e(63%)620S3、电源引脚DHT22的供电电压为3.3-6V。

DHT22

DHT22

量程范围
-40
80

响应时间
1/e(63%)
6
20
S
2、 采样周期不得低于最小值,否则会引起错误
3、 接口说明
建议连接线长度短于20米时用5K上拉电阻,大于20米时根据实际情况使
用合适的上拉电阻
AM2302的接线图如下图所示。
广州奥松电子有限公司
2
数字温湿度传感器 AM2302
注: AM2302 也叫 DHT22
3、 电源引脚 AM2302的供电电压为3.3-6V。传感器上电后,要等待 1s 以越过不稳定状态在此期
间无需发送任何指令。电源引脚(VDD,GND)之间可增加一个100nF 的电容,用以去耦 滤波。 4、单总线接口
DATA 用于微处理器与 AM2302之间的通讯和同步,采用单总线数据格式,一 次通讯时间5ms左右 ,具体格式在下面说明,当前数据传输为40bit,高位先出。
电容式湿度传感器的感湿层会受到化学蒸汽的干扰,化学物质在感应层中 的扩散可能导致测量值漂移和灵敏度下降。在一个纯净的环境中,污染物质会缓 慢地释放出去。下文所述的恢复处理将加速实现这一过程。高浓度的化学污染会 导致传感器感应层的彻底损坏。 7.3恢复处理
置于极限工作条件下或化学蒸汽中的传感器,通过如下处理程序,可使其 恢复到校准时的状态。在50-60℃和< 10%RH的湿度条件下保持2 小时(烘干); 随后在20-30℃和>70%RH的湿度条件下保持 5小时以上。 7.4温度影响
广州奥松电子有限公司
3
数字温湿度传感器 AM2302
注: AM2302 也叫 DHT22
图1 空闲时总线为高电平,通讯开始时主机(MCU)拉低总线500us后释放总线,延时2040us后主机开始检测从机(AM2302)的响应信号。 从机的响应信号是一个80us左右的低电平,随后从机在拉高总线80us左右代表即 将进入数据传送。

奥松AM2302温湿度传感器产品规格书说明书

奥松AM2302温湿度传感器产品规格书说明书

AM2302产品规格书温湿度传感器•完全标定•数字输出,单总线接口•优异的长期稳定性•响应迅速、抗干扰能力强产品综述AM2302是一款含有已校准数字信号输出的温湿度复合传感器,并应用专用的数字模块采集技术和温湿度传感器技术,确保产品具有极高的可靠性和卓越的长期稳定性。

传感器输出经过标定的数字信号,标准I2C格式。

AM2302配有一个全新设计的ASIC专用芯片、一个经过改进的MEMS半导体电容式湿度传感元件和一个标准的片上温度传感元件,其性能达到行业先进水平。

经过改进的新一代温湿度传感器,使其在恶劣环境下的性能更稳定,并且在较大的测量范围内保持良好的精度。

奥松电子对新一代传感器做了宽电压及低功耗改进,使终端设备都将获得节能运行,每一个传感器都经过校准和测试,保证产品的高质量的出厂。

应用范围暖通空调、除湿器、测试及检测设备、消费品、汽车、自动控制、数据记录器、气象站、家电、湿度调节、医疗及其他相关温湿度检测控制。

图1.AM2302传感器性能相对湿度图2.25℃时相对湿度的典型误差和最大误差电气特性参数条件最小典型最大单位供电电压- 3.35 5.5V 功耗5休眠215-µA 测量-1200-µA 平均-600-µA 低电平输出电压I OL60-300mV 高电平输出电压Rp<25kΩ90%-100%VDD 低电平输入电压下降0-30%VDD 高电平输入电压上升70%-100%VDD Rpu7VDD =5V VIN =VSS1 4.7100kΩ输出电流开-8-mA 三态(关)1020-µA 采样周期-2--s表2.电气特性参数条件最小典型最大单位分辨率--0.1-%RH 量程范围extended10-99.9%RH 精度2--±2见图2%RH 重复性--±0.1-%RH互换性-完全互换响应时间31/e(63%)-<8-s 迟滞-±1-%RH 漂移4典型值-<1-%RH/yr参数条件最小典型最大单位分辨率--0.1-℃精度--±0.5见图3℃量程范围--40-80℃重复性--±0.1-℃互换性-完全互换响应时间81/e(63%)-<8-s 漂移--±0.3-℃/yr 表3.温度特性表图3.温度典型误差和最大误差1正常工作范围:0-80%RH,超出此范围,传感器读数会有偏差(在90%RH湿度下200小时后,漂移<3%RH)。

温湿度传感器型号大全

温湿度传感器型号大全

温湿度传感器型号大全1. DHT11温湿度传感器•型号:DHT11•工作电压:3.3V-5V•测量范围:温度0-50°C,湿度20-90%RH•精度:温度±2°C,湿度±5%RH•特点:低成本,数字输出,单线串行通信2. DHT22温湿度传感器•型号:DHT22•工作电压:3.3V-5V•测量范围:温度-40-80°C,湿度0-100%RH•精度:温度±0.5°C,湿度±2%RH•特点:数字输出,较高精度,需要外部电阻3. AM2302温湿度传感器•型号:AM2302•工作电压:3.3V-5V•测量范围:温度-40-80°C,湿度0-100%RH•精度:温度±0.5°C,湿度±2%RH•特点:数字输出,与DHT22相同4. SHT11温湿度传感器•型号:SHT11•工作电压:2.4V-5.5V•测量范围:温度-40-123.8°C,湿度0-100%RH•精度:温度±0.5°C,湿度±3%RH•特点:数字输出,较低功耗5. SHT15温湿度传感器•型号:SHT15•工作电压:2.4V-5.5V•测量范围:温度-40-123.8°C,湿度0-100%RH•精度:温度±0.3°C,湿度±2%RH•特点:数字输出,较高精度,带有可选的I2C接口6. HTU21D温湿度传感器•型号:HTU21D•工作电压:3.3V-5V•测量范围:温度-40-125°C,湿度0-100%RH•精度:温度±0.3°C,湿度±2%RH•特点:数字输出,高精度,可通过I2C接口进行通信7. BME280温湿度传感器•型号:BME280•工作电压:1.71V-3.6V•测量范围:温度-40-85°C,湿度0-100%RH•精度:温度±0.5°C,湿度±3%RH•特点:数字输出,温湿度压力三合一传感器,可通过I2C或SPI接口进行通信8. BME680温湿度传感器•型号:BME680•工作电压:1.71V-3.6V•测量范围:温度-40-85°C,湿度0-100%RH•精度:温度±0.5°C,湿度±3%RH•特点:数字输出,温湿度压力气体四合一传感器,可通过I2C或SPI 接口进行通信9. HDC2080温湿度传感器•型号:HDC2080•工作电压:1.62V-3.6V•测量范围:温度-40-125°C,湿度0-100%RH•精度:温度±0.2°C,湿度±2%RH•特点:数字输出,高精度,可通过I2C接口进行通信以上是一些常见的温湿度传感器型号及其主要参数介绍。

AM2302(DHT22)说明书

AM2302(DHT22)说明书
MOV A,U8RH_data_H LCALL TX_DATA MOV A,U8RH_data_L LCALL TX_DATA MOV A,U8T_data_H LCALL TX_DATA MOV A,U8T_data_L LCALL TX_DATA MOV A,U8checkdata LCALL TX_DATA
10.1汇编例程
;*********************************************;
;
DHT22使用范例
;单片机 : AT89S52或 STC89C52RC
;功能 ; 串口发送温湿度数据 波特率 9600
;公司 ; **********
;*********************************************;
图4 数字0信号表示方法.如图5所示
图5
5、 测量分辨率
测量分辨率分别为 16bit(温度)、16bit(湿度)。
6、电气特性
济南联诚创发科技有限公司
电子部
Page 4 of 18
数字温湿度传感器 AM2302
VDD=5V,T = 25℃,除非特殊标注
参数
条件
min typ max
供电
DC
3.3
6
气体的相对湿度,在很大程度上依赖于温度。因此在测量湿度时,应尽可能 保证湿度传感器在同一温度下工作。如果与释放热量的电子元件共用一个印刷线 路板,在安装时应尽可能将AM2302远离发热电子元件,并安装在热源下方,同时 保持外壳的良好通风。 7.5光线
长时间暴露在太阳光下或强烈的紫外线辐射中,会使性能降低。 7.6配线注意事项
济南联诚创发科技有限公司
电子部
Page 3 of 18

Aosong DHT22 湿度与温度传感器模块说明书

Aosong DHT22 湿度与温度传感器模块说明书

Digital-output relative humidity & temperature sensor/module DHT22 (DHT22 also named as AM2302)Capacitive-type humidity and temperature module/sensor1Thomas Liu (Business Manager)1. Feature & Application:* Full range temperature compensated * Relative humidity and temperature measurement* Calibrated digital signal *Outstanding long-term stability *Extra components not needed* Long transmission distance * Low power consumption *4 pins packaged and fully interchangeable2. Description:DHT22 output calibrated digital signal. It utilizes exclusive digital-signal-collecting-technique and humidity sensing technology, assuring its reliability and stability.Its sensing elements is connected with 8-bit single-chip computer.Every sensor of this model is temperature compensated and calibrated in accurate calibration chamber and the calibration-coefficient is saved in type of programme in OTP memory, when the sensor is detecting, it will cite coefficient from memory.Small size & low consumption & long transmission distance(20m) enable DHT22 to be suited in all kinds of harsh application occasions.Single-row packaged with four pins, making the connection very convenient.3. Technical Specification:4. Dimensions: (unit----mm)1) Small size dimensions: (unit----mm)2Thomas Liu (Business Manager)3 Thomas Liu (Business Manager)4 Thomas Liu (Business Manager)5. Electrical connection diagram:3Pin---NC, AM2302 is another name for DHT226. Operating specifications:(1) Power and PinsPower's voltage should be 3.3-6V DC. When power is supplied to sensor, don't send any instruction to the sensor within one second to pass unstable status. One capacitor valued 100nF can be added between VDD and GND for wave filtering.(2) Communication and signalSingle-bus data is used for communication between MCU and DHT22, it costs 5mS for single time communication.Data is comprised of integral and decimal part, the following is the formula for data.DHT22 send out higher data bit firstly!DATA=8 bit integral RH data+8 bit decimal RH data+8 bit integral T data+8 bit decimal T data+8 bit check-sum If the data transmission is right, check-sum should be the last 8 bit of "8 bit integral RH data+8 bit decimal RH data+8 bit integral T data+8 bit decimal T data".When MCU send start signal, DHT22 change from low-power-consumption-mode to running-mode. When MCU finishs sending the start signal, DHT22 will send response signal of 40-bit data that reflect the relative humidity5Thomas Liu (Business Manager)and temperature information to MCU. Without start signal from MCU, DHT22 will not give response signal to MCU. One start signal for one time's response data that reflect the relative humidity and temperature information from DHT22. DHT22 will change to low-power-consumption-mode when data collecting finish if it don't receive start signal from MCU again.1) Check bellow picture for overall communication process:------------------------------------------------------------------------------------------------------------------------------------Host computer send outstart signal. Data transmission finished,Pull up and wait Host's signal Sensor's signal Output data: 1bit "1"response from sensor Sensor pull downPull up voltage and get bus's voltage------------------------------------------------------------------------------------------------------------------------------------2) Step 1: MCU send out start signal to DHT22Data-bus's free status is high voltage level. When communication between MCU and DHT22 begin, program of MCU will transform data-bus's voltage level from high to low level and this process must beyond at least 1ms to ensure DHT22 could detect MCU's signal, then MCU will wait 20-40us for DHT22's response.Check bellow picture for step 1:6Thomas Liu (Business Manager)-----------------------------------------------------------------------------------------------------------------------------------Host computer send start signal Sensor send out response signaland keep this signal at least 1ms and keep this signal 80usHost pull up voltage-and wait sensor's response Sensor pull up bus's voltageSignal from host Start data transmissionSignal from sensorSingle-bus signal------------------------------------------------------------------------------------------------------------------------------------Step 2: DHT22 send response signal to MCUWhen DHT22 detect the start signal, DHT22 will send out low-voltage-level signal and this signal last 80us as response signal, then program of DHT22 transform data-bus's voltage level from low to high level and last 80us for DHT22's preparation to send data.Check bellow picture for step 2:7Thomas Liu (Business Manager)------------------------------------------------------------------------------------------------------------------------------------Start transmit 1bit data Start transmit next bit data26-28us voltage-length means data "0"Host signal Sesnor's signalSingle-bus signal------------------------------------------------------------------------------------------------------------------------------------Step 3: DHT22 send data to MCUWhen DHT22 is sending data to MCU, every bit's transmission begin with low-voltage-level that last 50us, the following high-voltage-level signal's length decide the bit is "1" or "0".Check bellow picture for step 3:8Thomas Liu (Business Manager)------------------------------------------------------------------------------------------------------------------------------------70us voltage-length means 1bit data "1"Host signal Sesnor's signalSingle-bus signal----------------------------------------------------------------------------------------------------------If signal from DHT22 is always high-voltage-level, it means DHT22 is not working properly, please check the electrical connection status.7. Electrical Characteristics:9Thomas Liu (Business Manager)8. Attentions of application:(1) Operating and storage conditionsWe don't recommend the applying RH-range beyond the range stated in this specification. The DHT22 sensor can recover after working in non-normal operating condition to calibrated status, but will accelerate sensors' aging.(2) Attentions to chemical materialsVapor from chemical materials may interfere DHT22's sensitive-elements and debase DHT22's sensitivity. (3) Disposal when (1) & (2) happensStep one: Keep the DHT22 sensor at condition of Temperature 50~60Celsius, humidity <10%RH for 2 hours; Step two: After step one, keep the DHT22 sensor at condition of Temperature 20~30Celsius, humidity >70%RH for 5 hours.(4) Attention to temperature's affectionRelative humidity strongly depend on temperature, that is why we use temperature compensation technology to ensure accurate measurement of RH. But it's still be much better to keep the sensor at same temperature when sensing.DHT22 should be mounted at the place as far as possible from parts that may cause change to temperature. (5) Attentions to lightLong time exposure to strong light and ultraviolet may debase DHT22's performance.(6) Attentions to connection wiresThe connection wires' quality will effect communication's quality and distance, high quality shielding-wire is recommended.(7) Other attentions* Welding temperature should be bellow 260Celsius.* Avoid using the sensor under dew condition.* Don't use this product in safety or emergency stop devices or any other occasion that failure of DHT22 may cause personal injury.Thomas Liu (Business Manager)1 0。

AM2302温湿度模块产品说明书

AM2302温湿度模块产品说明书

Temperature and humidity module AM2302 Product Manual1、Product OverviewAM2302 capacitive humidity sensing digital temperature and humidity module is one that contains the compound has been calibrated digital signal output of the temperature and humidity sensors. Application of a dedicated digital modules collection technology and the temperature and humidity sensing technology, to ensure that the product has high reliability and excellent long-term stability. The sensor includes a capacitive sensor wet components and a high-precision temperature measurement devices, and connected with a high-performance 8-bit microcontroller. The product has excellent quality, fast response, strong anti-jamming capability, and high cost. Each sensor is extremely accurate humidity calibration chamber calibration. The form of procedures, the calibration coefficients stored in the microcontroller, the sensor within the processing of the heartbeat to call these calibration coefficients. Standard single-bus interface, system integration quick and easy. Small size, low power consumption, signal transmission distance up to 20 meters, making it the best choice of all kinds of applications and even the most demanding applications. Products for the 3-lead (single-bus interface)connection convenience. Special packages according to user needs.Physical map Dimensions (unit: mm)2、ApplicationsHVAC, dehumidifier, testing and inspection equipment, consumer goods, automotive, automatic control, data loggers, home appliances, humidity regulator, medical, weather stations, and other humidity measurement and control and so on.3、FeaturesUltra-low power, the transmission distance, fully automated calibration, the use of capacitive humidity sensor, completely interchangeable, standard digital single-bus output, excellent long-term stability, high accuracy temperature measurement devices.4、The definition of single-bus interface 4.1 AM2302 Pin assignmentsTable 1: AM2302Pin assignmentsPIC1: AM2302 Pin Assignment4.2 Power supply pins (VDD GND )AM2302 supply voltage range 3.3V - 5.5V, recommended supply voltage is 5V. 4.3 Serial data (SDA )SDA pin is tri structure for reading, writing sensor data. Specific communication timing, see the detaileddescription of the communication protocol.5、Sensor performance 5.1 Relative humidity Table 2: AM2302 Relative humidity performance tablePic2: At25℃ The error of relative humidity Pic3:The maximum temperature error5.2 Temperature Table 3: AM2302 Relative temperature performance6、Electrical CharacteristicsElectrical characteristics, such as energy consumption, high, low, input, output voltage, depending on the power supply. Table 4 details the electrical characteristics of the AM2302, if not identified, said supply voltage of 5V. To get the best results with the sensor, please design strictly in accordance with the conditions of design in Table 4.Table 4: AM2302DC Characteristics7、Single-bus communication (ONE-WIRE ) 7.1 Typical circuits for single busMicroprocessor and AM2302 connection typical application circuit is shown in Figure 4. Single bus communication mode, pull the SDA microprocessor I / O port is connected. Special instructions of the single-bus communication :1.Typical application circuit recommended in the short cable length of 30 meters on the 5.1K pull-up resistor pullup resistor according to the actual situation of lower than 30 m.2.With 3.3V supply voltage, cable length shall not be greater than 100cm. Otherwise, the line voltage drop will lead to the sensor power supply, resulting in measurement error.3.Read the sensor minimum time interval for the 2S; read interval is less than 2S, may cause the temperature and humidity are not allowed or communication is unsuccessful, etc..4.Temperature and humidity values are each read out the results of the last measurement Forreal-time data that need continuous read twice, we recommend repeatedly to read sensors, and each read sensor interval is greater than 2 seconds to obtain accuratethe data.[1] the accuracy of the factory inspection, the sensor 25°C and 5V, the accuracy specification of test conditions, it does not include hysteresis and nonlinearity, and is only suitable for non-condensing environment.[2] to achieve an order of 63% of the time required under the conditions of 25℃ and 1m / s airflow. [3] in the volatile organic compounds, the values may be higher. See the manual application to store information.[4] this value at VDD = 5.0V when the temperature is 25℃, 2S / time, under the conditions of the average.[5] low output current. [6] that the pull-up resistor.Pic4:AM2302Typical circuits for single bus7.2、Single-bus communication protocol◎Single bus DescriptionAM2302 device uses a simplified single-bus communication. Single bus that only one data line, data exchange system, controlled by the data line to complete. Equipment (microprocessor) through anopen-drain or tri-state port connected to the data line to allow the device does not send data to release the bus, while other devices use the bus; single bus usually require an external about 5.1kΩ pull-up resistor, so when the bus is idle, its status is high. Because they are the master-slave structure, only the host calls the sensor, the sensor will answer, so the hosts to access the sensor must strictly follow the sequence of single bus, if there is a sequence of confusion, the sensor will not respond to the host.◎Single bus to send data definitionSDA For communication and synchronization between the microprocessor and the AM2302, single-bus data format, a transmission of 40 data, the high first-out. Specific communication timing shown in Figure 5, the communication format is depicted in Table 5.Pic5:AM2302Single-bus communication protocolTable 5:AM2302Communication format specifier◎Single-bus data calculation exampleExample 1:40 Data received:0000 0010 1001 0010 0000 0001 0000 1101 1010 0010 High humidity 8 Low humidity 8 High temp. 8 Low temp. 8 Parity bit Calculate:0000 0010+1001 0010 +0000 0001+0000 1101= 1010 0010(Parity bit)Received data is correct:humidity:0000 0010 1001 0010 = 0292H (Hexadecimal)= 2×256 + 9×16 + 2 = 658 => Humidity = 65.8%RHTemp.:0000 0001 0000 1101 = 10DH(Hexadecimal) = 1×256 + 0×16 + 13 = 269 => Temp.= 26.9℃◎Special Instructions:When the temperature is below 0 ℃, the highest position of the temperature data.Example:-10.1 ℃Expressed as 1 000 0000 0110 0101Temp.:0000 0000 0110 0101 = 0065H(Hexadecimal)=6×16 +5 = 101=> Temp. =-10.1℃Example 2:40 received data:0000 0010 1001 0010 0000 0001 0000 1101 1011 0010 High humidity 8 Low humidity 8 High temp. 8 Low temp. 8 Parity bit Calculate:0000 0010+1001 0010 +0000 0001+0000 1101= 1010 0010 ≠1011 0010 (Validation error)The received data is not correct, give up, to re-receive data.7.3 Single-bus communication timingUser host (MCU) to send a start signal (data bus SDA line low for at least 800μs) after AM2302 from Sleep mode conversion to high-speed mode.The host began to signal the end of the AM2302 send a response signal sent from the data bus SDA serial 40Bit's data, sends the byte high; data sent is followed by: Humidity high 、Humidity low 、Temperature high 、Temperature low 、Parity bit ,Send data to the end of trigger information collection, the collection end of the sensor is automatically transferred to the sleep mode, the advent until the next communication.Detailed timing signal characteristics in Table 6,Single-bus communication timing diagram Pic 6:Pic 6:AM2302 Single-bus communication timingNote: the temperature and humidity data read by the host from the AM2302 is always the last measured value, such as the two measurement interval is very long, continuous read twice to the second value of real-time temperature and humidity values, while two readtake minimum time interval be 2S.Table 6: Single bus signal characteristics7.4 Peripherals read step exampleCommunication between the host and the sensor can read data through the following three steps to complete.Step 1AM2302 have to wait for the power (on AM2302 power 2S crossed the unstable state, the device can not send any instructions to read during this period), the test environment temperature and humidity data, and record data, since the sensor into a sleep state automatically. AM2302 The SDA data line from the previous pull-up resistor pulled up is always high, the AM2302 the SDA pin is in input state, the time detection of external signal.Note :To ensure the accurate communication of the sensor, the read signal, in strict accordance with the design parameters and timing in Table 6 and Figure 6.Step 2Microprocessor I/O set to output, while output low, and low hold time can not be less than 800us, typical values are down 1MS, then the microprocessor I/O is set to input state, the release of the bus, due to thepull-up resistor, the microprocessor I/O AM2302 the SDA data line also will be high, the bus master has released the AM2302 send a response signal, that is, the output 80 microseconds low as the response signal, tightthen output high of 80 microseconds notice peripheral is ready to receive data signal transmission as shown to Pic7 :Pic7:Single bus decomposition of the timing diagramStep 3AM2302 sending the response, followed by the data bus SDA continuous serial output 40 data, the microprocessor receives 40 data I/O level changes.Bit data "0" format: 26-28 microseconds 50 microseconds low plus high;Bit data "1" format: the high level of low plus, 50 microseconds to 70 microseconds;Bit data "0" bit data "1" format signal shown to pic 8:Pic 8:The single bus break down the timing diagramAM2302 data bus SDA output 40 data continue to output the low 50 microseconds into the input state, followed by pull-up resistor goes high. AM2302 internal re-test environmental temperature and humidity data, and record the data, the end of the test records, the microcontroller automatically into hibernation. Microcontroller only after receipt of the start signal of the host wake-up sensor, into the working state.7.5Peripheral to read flow chartAM2302 sensor read single bus flow chart diagram shown in Figure 9, we also provide the C51 read the code examples, customers need to download, please visit our website () related to downloadthis manual does not provide the code description.Pic9:Single-bus to read the flow chart8、Application of information1. Work and storage conditionsOutside the sensor the proposed scope of work may lead to temporary drift of the signal up to 300% RH. Return to normal working conditions, sensor calibration status will slowly toward recovery. To speed up the recovery process may refer to "resume processing". Prolonged use of non-normal operating conditions, will accelerate the aging of the product.Avoid placing the components on the long-term condensation and dry environment, as well as the following environment.A, salt sprayB, acidic or oxidizing gases such as sulfur dioxide, hydrochloric acidRecommended storage environmentTemperature: 10 ~ 40 ℃Humidity: 60% RH or less2. The impact of exposure to chemicalsThe capacitive humidity sensor has a layer by chemical vapor interference, the proliferation of chemicals in the sensing layer may lead to drift and decreased sensitivity of the measured values. In a pure environment, contaminants will slowly be released. Resume processing as described below will accelerate this process. The high concentration of chemical pollution (such as ethanol) will lead to the complete damage of the sensitive layer of the sensor.3. The temperature influenceRelative humidity of the gas to a large extent dependent on temperature. Therefore, in the measurement of humidity,should be to ensure that the work of the humidity sensor at the same temperature. With the release of heat of electronic components share a printed circuit board, the installation should be as far as possible the sensor away from the electronic components and mounted below the heat source, while maintaining good ventilation of the enclosure. To reduce the thermal conductivity sensor and printed circuit board copper plating should be the smallest possible, and leaving a gap between the two.4. Light impactProlonged exposure to sunlight or strong ultraviolet radiation, and degrade performance.5. Resume processingPlaced under extreme working conditions or chemical vapor sensor, which allows it to return to the status of calibration by the following handler. Maintain two hours in the humidity conditions of 45℃and <10% RH (dry); followed by 20-30℃and> 70% RH humidity conditions to maintain more than five hours.6. Wiring precautionsThe quality of the signal wire will affect the quality of the voltage output, it is recommended to use high quality shielded cable.7. Welding informationManual welding, in the maximum temperature of 300℃under the conditions of contact time shall be less than 3 seconds.8. Product upgradesDetails, please the consultation Aosong electronics department.9、The license agreementWithout the prior written permission of the copyright holder, shall not in any form or by any means, electronic or mechanical (including photocopying), copy any part of this manual, nor shall its contents be communicated to a third party. The contents are subject to change without notice.The Company and third parties have ownership of the software, the user may use only signed a contract or software license.10、Warnings and personal injuryThis product is not applied to the safety or emergency stop devices, as well as the failure of the product may result in injury to any other application, unless a particular purpose or use authorized. Installation, handling, use or maintenance of the product refer to product data sheets and application notes. Failure to comply with this recommendation may result in death and serious personal injury. The Company will bear all damages resulting personal injury or death, and waive any claims that the resulting subsidiary company managers and employees and agents, distributors, etc. that may arise, including: a variety of costs, compensation costs, attorneys' fees, and so on.11、Quality AssuranceThe company and its direct purchaser of the product quality guarantee period of three months (from the date of delivery). Publishes the technical specifications of the product data sheet shall prevail. Within the warranty period, the product was confirmed that the quality is really defective, the company will provide free repair or replacement. The user must satisfy the following conditions:①The product is found defective within 14 days written notice to the Company;②The product shall be paid by mail back to the company;③The product should be within the warranty period.The Company is only responsible for those used in the occasion of the technical condition of the product defective product. Without any guarantee, warranty or written statement of its products used in special applications. Company for its products applied to the reliability of the product or circuit does not make any commitment.Aosong(Guangzhou) Electronics Co.,Ltd. TEL:************/- 10 -。

AM2302(DHT22)说明书

AM2302(DHT22)说明书

U8checkdata EQU 36H
U8temp
EQU 37H
temp
EQU 38H
;--------------------
;--------------------
;--------------------
org 0000h
AJMP START
org 0023h
AJMP SET_INT
START:
应用领域
►暖通空调 ►汽车 ► 消费品 ►气象站 ►湿度调节器 ►除湿器
►测试及检测设备 ►数据记录器 ►自动控制 ►家电 ►医疗
济南联诚创发科技有限公司
电子部
Page 1 of 18
数字温湿度传感器 AM2302
1、传感器性能说明
参数
条件
Min
Typ
Max
湿度
分辨率
0.1
16
重复性
±1
精度
25℃
②带电路板安装壳封装
9、 AM2302带电路板安装壳封装引脚说明
Pin 名称
注释
济南联诚创发科技有限公司
电子部
Page 6 of 18
数字温湿度传感器 AM2302
1
VDD
2
DATA
3
GND
4
NC
供电 3.3-6V DC 串行数据,单总线 接地,电源负极 空脚,请悬空(不要接Vcc或Gnd)
10、 单片机例程
气体的相对湿度,在很大程度上依赖于温度。因此在测量湿度时,应尽可能 保证湿度传感器在同一温度下工作。如果与释放热量的电子元件共用一个印刷线 路板,在安装时应尽可能将AM2302远离发热电子元件,并安装在热源下方,同时 保持外壳的良好通风。 7.5光线

dht22工作原理

dht22工作原理

dht22工作原理
DHT22是一种数字温湿度传感器,采用了单线数字接口进行数据传输。

它由一个电容式湿度测量元件和一个NTC温度测量元件组成,并且具有高精度和快速响应的特点。

在测量温度时,NTC温度测量元件将通过电阻变化来测量环境温度,并将该值转换为数字信号。

在测量湿度时,电容式湿度测量元件会测量环境中的湿度,并将结果转换为数字信号。

两个传感器的数字信号都将通过单线数字接口传输给主机。

DHT22的工作原理基于计算机网络技术中的CSMA/CA协议。

传感器会在空闲时随机选择一个时间窗口来发送数据,如果发送失败,则会等待一段时间后再次尝试发送。

这种协议可以保证数据的可靠传输,并避免多个传感器同时发送数据造成的冲突。

- 1 -。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

AM2302温湿度传感器C程序(测试可以用)
2017-8-13
说明:
DHT22与DHT11程序基本相同,DHT11起始信号拉低18ms, DHT22起始信号拉低是800us,用户主机(MCU)发送一次起始信号(把数据总线SDA拉低至少800卩9后,AM2302从休眠模式转换到高速模式。

待主机开始信号结束后,AM2302发送响应信号,从数据总线SDA串行送出40Bit的数据,先发送字
节的高位;发送的数据依次为湿度高位、湿度低位、温度高位、温度低位、校验位,发送数据结束触发一次信息采集,采集结束传感器自动转入休眠模式,直到下一次通信来临。

注意事项:
与DHT11相同,一次采集8个位数据,循环4次采集完成所有数据,40位采集完成后,校验数据,如果数
据正确,将高8位左移8位与低8位相或,再保存到一个16位变量中,就可以得到一个整数值。

默认采集的数据是实际值的10倍,例如当前实际温度是度,采集到的数据是327,目的是为了编程时方便
分离数据。

(详细见后面说明书)
0000 0010 1000 1100 0000 0001 0101 1111 1110 1110
湿度数据温度数据校验和
湿度高8位+湿度低8位+温度高8位+温度低8位=的末8位=校验和如果需要处理零下值,16位的最高位为1表示负数,温度最大量程:-20~80度,分辨率:度。

如果用数据码管显示且有中断,采集数据开始需要关中断,采集结束开中断,否则在采集数据过程中,中断会打断DHT22时序,造成采集数据不正确。

每次采集间隔大于1秒,否则采集数据不准确。

C程序:
为了方便程序阅读,其它器件的初始化及定义都删除掉了,以下代码纯DHT22代码,使用时直接调用
RH函数即可。

由于程序多次修改,可能有多余的变量,大家自己清理下。

RH函数调用后,以下四个变量会得相应的数据:
R_H R_L T_H T_L 湿度咼8位
湿度低8位(包含小数)温度咼8位
湿度低8位(包含小数)
如果采集的数据是:0000 0010 1000 1100 0000 0001 0101 1111
由上面四个变量是16位,采集数据是8位,分四次采完,8位放在16位里面应该是这样: R_H= 00000000 00000010
R_L= 00000000
所以R_H左移8个位或上R_L才是我们要的数据。

R_H =R_H & R_L
以上采集数据湿度为652,湿度为351,再除以10就是实际温湿度值。

#in elude
<>
#in elude
<>
typedef un sig ned char U8;
*/
typedef sig ned char S8;
*/
typedef un sig ned int U16;
量*/
typedef sig ned int S16;
typedef un sig ned long U32;
量*/
typedef sig ned long S32;
typedef float F32;
度)*/
typedef double F64
;
长度)*/
/* defined for unsigned 8-bits integer variable
/* defined for signed 8-bits integer variable
/* defined for unsigned 16-bits integer variable
/* defined for signed 16-bits integer variable
/* defined for unsigned 32-bits integer variable
/* defined for signed 32-bits integer variable
/* single precision floating point variable (32bits)
无符号8位整型变量
有符号8位整型变量
无符号16位整型变
有符号16位整型变量*/
无符号32位整型变
有符号32位整型变量*/
单精度浮点数(32位长
/* double precision floating point variable (64bits) 双精度浮点数(64 位
vcc
MCU
II
1
1
1
DHT22
Z
3
4-NC
<rNP
―Z IlLlU^ ——
I fiOlJE
—主枷拉咅
10-JOte
主机侑号PHTtr 号
7 Clij ST
倍号线说明:
主机伯号
rnrrf書

图5所

信号线说明:
主机倍号
DHT 倩号
图5
5、 测量分辨率
测量分辨率分别为16bit (温度)、16bit (湿度)。

6、 电气特性
VDD=5V T = 25c ,除非特殊标注
参数 条件
min typ
max 单位
供电
DC
6
V 供电电流 测量 1
mA 待机 40
50
uA
采样周期

2

注:采样周期间隔不得低于 2秒钟(建议2秒以上)。

7、应用信息
工作与贮存条件
超出建议的工作范围可能导致高达3%RH 勺临时性漂移信号。

返回正常工作条后,传感 器会缓慢地向校准状态恢复。

要加速恢复进程 /可参阅小节的恢复处理”。

在非正常工作条件 下长时间使用会加速产品的老化过程。

暴露在化学物质中
电容式湿度传感器的感湿层会受到化学蒸汽的干扰, 化学物质在感应层中的扩散可能导 致测量值漂移和灵敏度下降。

在一个纯净的环境中,污染物质会缓慢地释放出去。

下文所述 的恢复处理将加速实现这一过程。

高浓度的化学污染会导致传感器感应层的彻底损坏。

恢复处理
置于极限工作条件下或化学蒸汽中的传感器, 通过如下处理程序,可使其恢复到校准时 的状态。

在50-60C 和< 10%RH 勺湿度条件下保持2小时(烘干);随后在20-30C 和>70%RH 勺 湿度条件下保持5小时以上。

温度影响
气体的相对湿度,在很大程度上依赖于温度。

因此在测量湿度时,应尽可能保证湿度传 感器在同一温度下工作。

如果与释放热量的电子元件共用一个印刷线路板,在安装时应尽可 能将DHT22远离发热电子元件,并安装在热源下方,同时保持外壳的良好通风。

光线
长时间暴露在太阳光下或强烈的紫外线辐射中,会使性能降低。

配线注意事项
vcc - ONT>
I I 表示W
〔 ..
®
-
- - * --P r —
I MM 开始I
下——|>址开

DATA 言号线材质量会影响通讯距离和通讯质量 8、封装信息
①小体积圭寸装
引脚号:从左到右顺序为 1、2、3、4. DHT22小体积封装引脚说明
Pin
名称
注释
1 VDD 供电—6VDC
2 DATA 串行数据,单总线
3 NC 空脚,请悬空 4
GND
接地,电源负极
Q
HU i
___ 乓 ______________ L_L__ J
3. Sunn
| MAX -imia
t*十 DHT22带电
路板安装壳封装引脚说明,大封装:
Pin
名称 注释 1 VDD 供电 DC 2
DATA
串行数据,单总线
,推荐使用高质量屏蔽线。

②带电路板安装壳封装
28II mi
< ----------------- 22iuni ------------------- ►
12 3 4。

相关文档
最新文档