SHT21 and Arduino example

The SHT21 has a capacitive sensor element to measure humidity, while the temperature is measured by a band gap sensor. Both sensors are seamlessly coupled to a 14-bit ADC, which then transmits digital data to the Arduino over the I2C protocol.

Because of the sensor’s tiny size, it has incredibly low power consumption, this means that it is suitable for many applications.

I was looking at this sensor and noticed that there were some nice little breakout boards available so I decided to purchase one, also in the arduino world there are a couple of  libraries written so you can include this if you don’t want to write too much code.

This is the breakout board that we bought, as you can see by the size of the components its small, I would not recommend trying to use this sensor without a breakout

SHT21 breakout board
SHT21 breakout board

The advantage of the sensor is that it utilizes the I2C protocol, therefore there are minimal connections required to your Arduino. The device is 3.3v so that is something to be wary of. Here is a schematic showing how to connect the sensor to your Arduino.

UNO and SHT21
UNO and SHT21

Lets take a  closer look at the required libraries and a basic example.

 

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

 

#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);
}

 

Links

Here is a link to the datasheet for the device : http://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/Humidity/Sensirion_Humidity_SHT21_Datasheet_V4.pdf

The breakout that I pictured earlier come in at about $7

Humidity Sensor – SHT21 Breakout Board

Previous articleMSP-EXP430G2 RGB led example
Next articleBMP180 and Arduino