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.


Parts List


Amount Part Type
1 Temperature and humidity detection sensor module SHT20
1 Wemos D1 mini V2






Again we use a library –

[codesyntax lang=”cpp”]

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

DFRobot_SHT20    sht20;

void setup()
    Serial.println("SHT20 Example!");
    sht20.initSHT20();                                  // Init SHT20 Sensor
    sht20.checkSHT20();                                 // Check SHT20 Sensor

void loop()
    float humd = sht20.readHumidity();                  // Read Humidity
    float temp = sht20.readTemperature();               // Read Temperature
    Serial.print(" Temperature:");
    Serial.print(temp, 1);
    Serial.print(" Humidity:");
    Serial.print(humd, 1);




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%






  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:, 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:

    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.


Please enter your comment!
Please enter your name here