Home ArduinoArduino Sensors Arduino and SHT21 humidity and temperature sensor

Arduino and SHT21 humidity and temperature sensor

by shedboy71

Description

The digital SHT2x humidity sensor series is used in high volumes in a wide variety of applications and has today become the de facto industry standard. The SHT2x series consists of a low-cost version with the SHT20 humidity sensor, a standard version with the SHT21 humidity sensor, and a high-end version with the SHT25 humidity sensor. The open cavity mold package – which encapsulates the complete chip except for the humidity sensor area – protects the capacitive humidity sensor against external impact and facilitates excellent long-term stability.

Features

Size : 3 x 3 x 1.1 mm
Output : I²C digital, PWM, SDM
Supply voltage range :  2.1 to 3.6 V
Energy consumption : 3.2µW (at 8 bit, 1 measurement / s)
RH operating range : 0 – 100% RH
T operating range : -40 to +125°C (-40 to +257°F)

Its an I2C device so again is very simple to connect to any arduino

This is the breakout for the sensor that I bought, as you can see its a tricky part to use for the hobbyist, so a breakout makes like easier

HTU21

Here is a simple schematic, again be careful as Vcc is 3.3v with this device

Schematic

SHT21 schematic

SHT21 schematic

Lets look at the required libraries and a basic code example, there is not much to this to be honest most of the work is done in the library

Code

There are a couple of libraries to help you out

https://github.com/misenso/SHT2x-Arduino-Library
https://github.com/elechouse/SHT21_Arduino

I used the latter one

[codesyntax lang=”cpp”]

#include <Wire.h>
#include <SHT2x.h>


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

void loop()
{
  Serial.print("Humidity: ");
  Serial.println(SHT2x.GetHumidity());
  Serial.print("Temperature(C): ");
  Serial.println(SHT2x.GetTemperature());
  Serial.println();
  delay(1000);
}

[/codesyntax]

Links

these come in at about $7 for a useful breakout board with this sensor

SHT21 Digital Humidity And Temperature Sensor Module

You may also like