Reply to topic  [ 1 post ] 
DHT21 AM2301 Temperature & Humidity Sensor (HCSENS0026) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 669
Post DHT21 AM2301 Temperature & Humidity Sensor (HCSENS0026)
Image



The DHT21 digital temperature sensor is one of the commonest from the range of DHT temperature sensors and boasts a relatively high temperature measurement accuracy of 0.5oC in 0.1oC steps with a relative humidity accuracy of +/- 3%. It has only 3 wires, including power and ground, meaning only one digital pin is required to interface it to a microcontroller. For Arduino development platforms the sensor is very well supported by the DHT library available from the Arduino Playground website.

Image



Specification:

Product Code: HCSENS0026
Model: AM2301
Power supply: 3.3-5V DC
Output signal: digital signal via single-bus
Sensing element: Polymer humidity capacitor
Measuring range: humidity 0-100%RH; temperature -40~80Celsius
Accuracy: humidity +-3%RH(Max +-5%RH); temperature <+-1Celsius
Resolution or sensitivity: humidity 0.1%RH; temperature 0.1Celsius
Repeatability: humidity +-1%RH; temperature +-0.2Celsius
Humidity hysteresis: +-0.3%RH
Long-term Stability: +-0.5%RH/year
Sensing period: Average: 2s
Dimensions size 59*27*13.5mm



Example Arduino Sketch:

Code:
/* FILE:    DHT21_Example
   DATE:    06/10/16
   VERSION: 0.1
   AUTHOR:  Andrew Davies
   
This example sketch uses the DHT library available from the Arduino playground here:

http://playground.arduino.cc//Main/DHTLib

Simply connect your DHT21 sensor to the Arduino digital pin 5, upload this sketch
and then open a the serial monitor window with a BAUD rate of 9600.

You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/


#include "dht.h"

dht DHT21;

#define DATA_PIN 5 // Digital pin connected the DHT21 data pin.

void setup()
{
  Serial.begin(9600);
}


void loop()
{
  /* Take a reading from the sensor */
  int State = DHT21.read21(DATA_PIN);

  /*  If reading was successful then output the results to the serial port */
  if(State == DHTLIB_OK)
  {
    Serial.print("Temperature: ");
    Serial.println(DHT21.temperature, 1);
    Serial.print("Humidity: ");
    Serial.println(DHT21.humidity, 1);
    Serial.println("");
  }

  /* Wait a second before looping back */
  delay(1000);
}




Image

DHT library:

Attachment:
DHTLib.zip


Datasheet:

Attachment:
AM2301_Datasheet.pdf



Disclaimer: Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.


You do not have the required permissions to view the files attached to this post.


Thu Oct 06, 2016 9:48 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD