AM2320 temperature and humidity sensor and Microbit 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 .

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

 

Layout

I couldn’t find a fritzing part but as you can see being a simple I2C sensor with a 3.1 to 5.5v range its straightforward to connect this device to a Micro:bit

microbit and am2320

microbit and am2320

 

Code

You will need to install the folllowing library from https://github.com/EngDial/AM2320

This needs updated

This is the default example

#include <Wire.h>
#include <AM2320.h>
AM2320 th;
void setup() {
Serial.begin(9600);
Wire.begin();
}
void loop() {
Serial.println("Chip = AM2320");
switch(th.Read()) {
case 2:
Serial.println(" CRC failed");
break;
case 1:
Serial.println(" Sensor offline");
break;
case 0:
Serial.print(" Humidity = ");
Serial.print(th.Humidity);
Serial.println("%");
Serial.print(" Temperature = ");
Serial.print(th.cTemp);
Serial.println("*C");
Serial.println();
break;
}
delay(2000);
}

 

Output

Open the serial monitor

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

 

Links

1pcs New AM2320 Digital Temperature and Humidity Sensor Original authentic Can replace SHT20 SHT10

https://akizukidenshi.com/download/ds/aosong/AM2320.pdf

micro:bit and SHT11 digital humidity sensor example

The SHT1x digital humidity sensor is a reflow solderable sensor. The SHT1x series consists of a low-cost version with the SHT10 humidity sensor, a standard version with the SHT11 humidity sensor, and a high-end version with the SHT15 humidity sensor. As with every other Sensirion sensor type from the SHTxx humidity sensor family, they are fully calibrated and provide a digital output.

The humidity sensors are seamlessly coupled to a 14-bit-analog-to-digital converter and a serial interface circuit. This results in superior signal quality, a fast response time, and insensitivity to external disturbances (EMC).

One thing to note is that these sensors have been effectively replaced by others in sensirion’s range such as the SHT31 but they are still usable and for the hobbyist

 

Layout

 

 

Code

You need to install the library from – https://github.com/practicalarduino/SHT1x

This is the built in example

 

#include <SHT1x.h>
 
// Specify data and clock connections and instantiate SHT1x object
#define dataPin 3
#define clockPin 4
SHT1x sht1x(dataPin, clockPin);
 
void setup()
{
 Serial.begin(38400); // Open serial connection to report values to host
 Serial.println("Starting up");
}
 
void loop()
{
 float temp_c;
 float temp_f;
 float humidity;
 
 // Read values from the sensor
 temp_c = sht1x.readTemperatureC();
 temp_f = sht1x.readTemperatureF();
 humidity = sht1x.readHumidity();
 
 // Print the values to the serial port
 Serial.print("Temperature: ");
 Serial.print(temp_c, DEC);
 Serial.print("C / ");
 Serial.print(temp_f, DEC);
 Serial.print("F. Humidity: ");
 Serial.print(humidity);
 Serial.println("%");
 
 delay(2000);
}

 

 

Testing

Open the serial monitor , all going well you should see something like this

Temperature: 25.5599994659C / 78.1159973145F. Humidity: 49.05%
Temperature: 26.1399993896C / 79.1599960327F. Humidity: 50.94%
Temperature: 28.5199985504C / 83.6599960327F. Humidity: 68.56%
Temperature: 30.2299976349C / 86.6119918823F. Humidity: 75.35%
Temperature: 31.2499980927C / 88.3939971924F. Humidity: 77.40%

 

Links

micro:bit and SHT31 temperature and humidity sensor example

SHT31 is the next generation of Sensirion’s temperature and humidity sensors. It builds on a new CMOSens® sensor chip that is at the heart of Sensirion’s new humidity and temperatureplatform.

The SHT3x-DIS has increased intelligence, reliability and improved accuracy specifications compared to its predecessor. Its functionality includes enhanced signal processing, two distinctive and user selectable I2C addresses and communication speeds of up to 1 MHz. The DFN package has a footprint of 2.5 x 2.5 mm2 while keeping a height of 0.9 mm.

This allows for integration of the SHT3x-DIS into a great variety of applications.

Features

Fully calibrated, linearized, and temperature compensated digital output
Wide supply voltage range, from 2.4 V to 5.5 V
I2C Interface with communication speeds up to 1 MHz and two user selectable addresses

I bought the following module

If you’re using an Wemos simply connect the VIN pin to the 3v3 voltage pin, GND to ground, SCL to I2C Clock (D1) and SDA to I2C Data (D2).

Here is a layout drawn up in fritzing to illustrate this

 

Layout

 

microbit and sht31

microbit and sht31

 

Code

This example uses the adafruit sht31 library – https://github.com/adafruit/Adafruit_SHT31

#include <Arduino.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"
 
Adafruit_SHT31 sht31 = Adafruit_SHT31();
 
 
void setup() 
{
  Serial.begin(9600);
  if (! sht31.begin(0x44)) 
  {
    Serial.println("Couldn't find SHT31");
    while (1) delay(1);
  }
}
 
 
void loop() 
{
  float t = sht31.readTemperature();
  float h = sht31.readHumidity();
 
  if (! isnan(t)) 
  {
    Serial.print("Temp *C = "); Serial.println(t);
  } 
  else 
  { 
    Serial.println("Failed to read temperature");
  }
 
  if (! isnan(h)) 
  {
    Serial.print("Hum. % = "); Serial.println(h);
  } 
  else 
  { 
    Serial.println("Failed to read humidity");
  }
  Serial.println();
  delay(1000);
}

 

Output

Open the serial monitor window

Temp *C = 27.27
Hum. % = 32.90

Temp *C = 27.01
Hum. % = 32.20

Temp *C = 26.76
Hum. % = 31.83

Temp *C = 26.52
Hum. % = 31.79

Temp *C = 26.30
Hum. % = 31.91

 

Link

1PCS/LOT SHT31 Temperature & SHT31-D Humidity Sensor module Breakout Weather for Arduino