SHT20 temperature and humidity sensor and ESP8266

The SHT2x series consists of a low-cost version with the SHT20 humidity sensor. the SHT2x provides calibrated, linearized sensor signals in digital, I2C format. The SHT2x humidity sensor series contains a capacitive-type humidity sensor, a band-gap temperature sensor, and specialized analog and digital integrated circuits – all on a single CMOSens® chip. This yields superior sensor performance in terms of accuracy and stability as well as minimal power consumption.

Every sensor is individually calibrated and tested. Furthermore, the resolution of the SHT2x humidity sensor can be changed on command (8/12 bit up to 12/14 bit for RH/T) and a checksum helps to improve communication reliability.

Specification

Humidity
Typ. relative humidity accuracy 3 %RH
Operating relative humidity range 0 – 100 %RH
Response time (τ63%) 8 s
Calibration certificate Factory calibration
Temperature
Typ. temperature accuracy 0.3 °C
Operating temperature range -40 – 125 °C
Response time (τ63%) 5 s

 

Parts List

Here are the parts I used

 

Name Links
Wemos Mini
SHT20
Connecting cables

 

Schematics/Layout

An I2C sensor

The breakout I used did not have a 3.3v voltage regulator fitted – so I connected to 3.3v. be careful as the max voltage rating for the sensor is 3.6v

Code

Again we use a library – https://github.com/DFRobot/DFRobot_SHT20

 

#include <Wire.h>
#include "DFRobot_SHT20.h"

DFRobot_SHT20    sht20;

void setup()
{
    Serial.begin(9600);
    Serial.println("SHT20 Example!");
    sht20.initSHT20();                                  // Init SHT20 Sensor
    delay(100);
    sht20.checkSHT20();                                 // Check SHT20 Sensor
}

void loop()
{
    float humd = sht20.readHumidity();                  // Read Humidity
    float temp = sht20.readTemperature();               // Read Temperature
    Serial.print("Time:");
    Serial.print(millis());
    Serial.print(" Temperature:");
    Serial.print(temp, 1);
    Serial.print("C");
    Serial.print(" Humidity:");
    Serial.print(humd, 1);
    Serial.print("%");
    Serial.println();
    delay(1000);
}

 

Output

Open the serial monitor – this is what I saw

Time:105462 Temperature:21.1C Humidity:55.6%
Time:106565 Temperature:21.1C Humidity:55.6%
Time:107669 Temperature:22.0C Humidity:55.7%
Time:108772 Temperature:24.8C Humidity:58.0%
Time:109875 Temperature:26.3C Humidity:61.1%
Time:110978 Temperature:27.3C Humidity:63.1%
Time:112081 Temperature:28.0C Humidity:64.4%

 

Links

Sensirion_Humidity_Sensors_SHT20_Datasheet.pdf

 

4 COMMENTS

  1. Can you tell more on how to connect the SHT20 to the ESP8266 board? Which wires should be connected to what pins? I just can’t seem to find any documentation on this.

  2. Hey. I am new to Arduino as well, so here’s what I did to get my SHT20 getting readings on the serial output:

    I visited: https://github.com/DFRobot/DFRobot_SHT20, and downloaded the zip file. Then added the zip file to Arduino (Sketch -> include library -> Add .Zip library)

    The second thing was the pinouts. the SHT20 has 4 pins : VCC, GND, SCL and SDA.

    I looked up here:
    https://steve.fi/Hardware/d1-pins/

    VCC to 3.3V
    GND to GND
    D1 to SCL
    D2 to SDA

    So that solved the connectivity issue and I started getting the readings. Thanks a lot for this. I must admit the SHT20 is a very nice sensor. I am very pleased with its performance, stability and repeatability.

LEAVE A REPLY

Please enter your comment!
Please enter your name here