Home » AM2320 temperature and humidity sensor and ESP32 example

AM2320 temperature and humidity sensor and ESP32 example

by shedboy71

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 .

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.

Specifications

• 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

 

Parts List

Name Link
ESP32
AM2302
Connecting cables

Layout

AM2302 sensor ESP32 – Wemos Lolin32
SDA 21 (SDA)
SCL 22 (SCL)
+ 3v3
GND

 

Code

I used this library – https://github.com/EngDial/AM2320

 

#include <AM2320.h>

AM2320 th(&Wire);

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

void loop() {
  Serial.println(F("Chip = AM2320"));
  switch(th.Read()) {
    case 2:
      Serial.println(F("  CRC failed"));
      break;
    case 1:
      Serial.println(F("  Sensor offline"));
      break;
    case 0:
      Serial.print(F("  Humidity = "));
      Serial.print(th.Humidity);
      Serial.println(F("%"));
      Serial.print(F("  Temperature = "));
      Serial.print(th.cTemp);
      Serial.println(F("*C"));
      Serial.println();
      break;
  }
  delay(2000);
}

 

Output

Open the serial monitor

Chip = AM2320
Humidity = 49.10%
Temperature = 22.50*C

Chip = AM2320
Humidity = 49.20%
Temperature = 22.50*C

Chip = AM2320
Humidity = 49.10%
Temperature = 22.50*C

Links

 

You may also like

Leave a Comment

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.