HUM: SHT21 & SHT20 TEMPERATURE AND HUMIDITY SENSOR
You are a beginner with Croduino. Or electronics? A specific module caught your eye, but you do not know how to use it? Do not worry, HUM is here for you! How to Use Module (HUM) is a blog tutorials series by e-radionica where you will find all you need in order to begin working with your favorite module. Tutorials include: technical characteristics, work principle, instructions on how to connect module with Croduino and the basic code. Everything else is left to your imagination.
Our new breakout contains the SHT21 temperature and relative humidity sensor, and communication with the microcontroller is enabled through the I2C communication. The sensor has become very popular due to its high precision and reliability. The sensor itself is made in Switzerland, where it is also calibrated and immediately ready for use. Each breakout board is made in Croatia which ensures the quality of making and simplicity of use.
Power supply voltage: 5V
Relative humidity, measurement range: 0-100%
Relative humidity, precision: 0.04% (12 bit)
Temperature, measurement range: -40°C – 125°C
Temperature, precision: 0.01°C (14 bit)
Communication interface: I2C
Dimensions: 25 mm x 15 mm
HOW DOES IT WORK?
The sensor works as a slave in the I2C communication. At the request of the microcontroller, the sensor starts and begins a process of measuring temperature and humidity. When the sensor is done measuring, it sends the measured data to the microcontroller and goes into idle mode to ensure low energy consumption. Time spent measuring temperature and humidity varies between 5 and 30 seconds, which depends on thermal conductivity of the material which the sensor is in touch with. For example, the sensor will read the change of temperature if it is in touch with a good thermal conductor, such as metal, sooner than when it is in touch with a heat insulator.
HOW TO CONNECT IT?
VCC: voltage 3.3V – 5.5V
SDA: serial data I2C
SCL: serial clock
In the image below, it is shown how to connect your new breakout to the Croduino microcontroller. Connecting is very simple and all you need is four wires, two of which you need for power supply, and two for communication. Power supply of the board is achieved by connecting the +5V connector and the gnd to the homonymous connectors of Croduino. It is still necessary to connect the SDA and SCL communication connectors to the homonymous connectors on Croduino.
In order for us to make the programming process easier for you, we have written our own library for this breakout. In case you do not know how to install the library, read our tutorial. Within the library, you will find a demo program, using which you can measure temperature and relative humidity.
#include "SHT21.h" // include SHT21 library
// variable to store temperature
// variable to store humidity
// begin Wire(I2C)
// begin Serial
temp = sht.getTemperature();
// get temp from SHT
humidity = sht.getHumidity();
// get temp from SHT
// print readings
"\t Humidity: "
// min delay for 14bit temp reading is 85ms
Products used in this tutorial
No products found