An AM2321 Class for Arduino

Get library code from Github

Intro

AM2321 capacitive humidity sensing digital temperature and humidity sensor is a temperature and humidity own calibration digital signal output composite sensor. Temperature and humidity using a dedicated acquisition technology to ensure that products with high reliability and excellent long-term stability. The sensor includes a capacitive sensor wet components and a high-precision integrated temperature measurement devices, and connected with a high-performance microprocessor.The product has excellent quality, fast response, anti-interference ability, cost and other advantages.

The DHT22 is similar to the AM2321 and has the same accuracy. Check this lib for DHT22 - DHTlib

The library is tested on a 3v3 PRO MINI, UNO and confirmed working on a Arduino 1.0.4.

Connection

I2C (you should try DHT22Lib for OneWire, they have the same protocol.)

Datasheet

http://aosong.com/asp_bin/Products/AM2321.pdf (Chinese Only)

Usage

A sketch shows how the library can be used to read the sensor. Please wait for more than 2 seconds after power up to get a stable reading.

#include <AM2321.h>

void readByAM2321()
{
    AM2321 am2321;
    am2321.read();

    Serial.print("(");
    Serial.print(am2321.temperature/10.0);
    Serial.print(", ");
    Serial.print(am2321.humidity/10.0);
    Serial.println(')');
}

Notes

To use the library, make a folder in your SKETCHBOOKPATH\libaries with the name AM2321 and put the .h and .cpp there. Optionally make a examples subdirectory to place the sample app. Be aware that the library will only be visible after restarting all instances of the Arduino IDE.

Todo

OneWire support.

wangdong2 AT gmail.com