AM2320 temperature and humidity sensor and ESP8266 example

Temperature and humidity combined sensor AM2320 digital temperature and humidity sensor is a digital signal output has been calibrated. Using special temperature and humidity acquisition technology, ensure that the product has a very high reliability and excellent long-term stability. Sensor consists of a capacitive moisture element and an integrated high-precision temperature measurement devices, and connected with a high-performance microprocessor .

Here is what the sensor looks like

AM2320 communication using a single bus, two communication modes standard I2C. Standard single-bus interface, the system integration becomes easy and quick. Ultra-small size, low power consumption, signal transmission distance up to 20 meters, making all kinds of applications and even the most demanding applications the best choice. I2C communication using standard communication sequence, the user can directly linked to the I2C communication bus without additional wiring, simple to use. Two communication modes are used as humidity, temperature, and other digital information directly CRC checksum temperature-compensated output, users do not need to calculate the secondary digital output, and no need for temperature compensation of the humidity, temperature and humidity can be accurately information. Two communication modes are free to switch, the user can freely choose, easy to use, wide range of applications.



• Operating Voltage: 3.1 VDC to 5.5 VDC
• Operating Temperature Range: -40 ° C to + 80 ° C
• Humidity Range: 0 to 99.9% RH
• Accuracy ( 25 ° C environment)
Temperature: ± 0.5 ° C
Humidity: ± 3%
• RH (10 … 90% RH)
Resolution: Temperature: 0.1 ° C
Resolution: Humidity: 0.1% RH
• Attenuation values
Temperature: <0.1 ℃ / Year
Humidity: <1% RH / Year
• Response time: Temperature: 5s
• Response Time: Humidity: 5s 1 / e (63%)
• Output signal: single bus / IIC signal
• Housing material: PC plastic

Here is a pinout of the sensor





I used 3v3 for VCC, spec says that 5v would be fine as well but I didn’t test that




You will need to install the folllowing library from

This is the default example which shows the basics, you can easily adapt this


#include <Wire.h>
#include <AM2320.h>
AM2320 th;
void setup() {
void loop() {
Serial.println("Chip = AM2320");
switch(th.Read()) {
case 2:
Serial.println(" CRC failed");
case 1:
Serial.println(" Sensor offline");
case 0:
Serial.print(" Humidity = ");
Serial.print(" Temperature = ");





Open the serial monitor and you should see the following output

Chip = AM2320
Humidity = 47.10%
Temperature = 24.80*C

Chip = AM2320
Humidity = 48.70%
Temperature = 25.10*C

Chip = AM2320
Humidity = 53.60%
Temperature = 25.40*C

Chip = AM2320
Humidity = 55.80%
Temperature = 25.80*C

Chip = AM2320
Humidity = 59.80%
Temperature = 26.20*C



AM2320 Digital Temperature and Humidity Sensor Replace AM2302 SHT10


  1. […] Although this book recommend us to use a temperature and humidity sensor named DHT11, but I chose another sensor named AM2320. There are libraries for both of the two sensors. So do not worry, you will not lose much time on the sensor.Here is a website about AM2320 that you can <a href=””>refer to</a>. I use the ESP WROOM-02 from switch science, which takes me a lot of time to get the SDA and SCL. And at last, I found that they are corresponded with pin 4 and pin7. […]


Please enter your comment!
Please enter your name here