SEN0227 SHT20 I2C Temperature & Humidity Sensor


This is a SHT20 I2C temperature & humidity sensor with waterproof probe. It comes with the 4C CMOSens® SHT20 temperature & humidity sensor chip, and the probe has gone through dual waterproof protection. The SHT20 I2C temperature & humidity sensor adopt Sensirion new technique. Besides the capacitive type humidity sensor and the band gap temperature sensor, the chip contains an amplifier, A/D converter, OTP memory and a digital processing unit. To compare with early SHT1x series and SHT7x series, SHT20 shows better reliability and long-term stability. It can measure surrounding environment temperature and relative air humidity precisely. The Arduino SHT20 waterproof temperature & humidity sensor adopts dual waterproof protection. The inner PCB has perfusion and encapsulation protection, and the probe enclosure is made of PE waterproof materials. This is a special waterproof breathable material that allows water molecules to seep in, blocking water droplets from seeping in. The sensor won't be damaged even if it is submerged in water for a long time. There is a built-in 10k Pull-up resistor and 0.1uf filter capacitor, so It can be used directly with the microcontroller such as Arduino. Recommend DFRobot Gravity 4Pin Sensor Adapter, it is quite convenient.’


Board Overview

SEN0227 SHT20 I2C Temperature & Humidity Sensor Board Overview
Num Label Description
1 Red VCC
2 Green GND
3 Black (Blue) SDA
4 White (Yellow) SCL


In this section, we'll use Arduino to drive SHT20 I2C Temperature & Humidity Sensor (Waterproof Probe)


Connection Diagram

SEN0227 SHT20 I2C Temperature & Humidity Sensor Connection Diagram

Sample Code

Download the DFRobot Arduino SHT20 library

How to install Libraries in Arduino IDE

 * @file  getHumidityAndTemperature.ino
 * @brief  DFRobot's SHT20 Humidity And Temperature Sensor Module
 * @details  This example demonstrates how to read the user registers to display resolution and other settings.
 * @n  Uses the SHT20 library to display the current humidity and temperature.
 * @n  Open serial monitor at 9600 baud to see readings.
 * @n  Errors 998 if not sensor is detected. Error 999 if CRC is bad.
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (
 * @license  The MIT License (MIT)
 * @author  [Zhangjiawei](
 * @maintainer  [qsjhyy](
 * @version  V1.0
 * @date  2021-12-03
 * @url
#include "DFRobot_SHT20.h"

 * Hardware Connections:
 * -VCC = 3.3V
 * -GND = GND
 * -SDA = A4 (use inline 330 ohm resistor if your board is 5V)
 * -SCL = A5 (use inline 330 ohm resistor if your board is 5V)
DFRobot_SHT20 sht20(&Wire, SHT20_I2C_ADDR);

void setup()

  // Init SHT20 Sensor
  Serial.println("Sensor init finish!");

   * Check the current status information of SHT20
   * Status information: End of battery, Heater enabled, Disable OTP reload
   * Check result: yes, no

void loop()
   * Read the measured data of air humidity
   * Return the measured air humidity data of float type, unit: %
  float humd = sht20.readHumidity();

   * Read the measured temp data
   * Return the measured temp data of float type, unit: C
  float temp = sht20.readTemperature();

  Serial.print(millis());   // Get the system time from Arduino
  Serial.print(" Temperature:");
  Serial.print(temp, 1);   // Only print one decimal place
  Serial.print(" Humidity:");
  Serial.print(humd, 1);   // Only print one decimal place


Expected Results

SEN0227 SHT20 I2C Temperature & Humidity Sensor Expected Results


Q1. How to measure the soil moisture?.
A. Soil moisture is defined as: Get 1 kg soil samples, thoroughly dry it, the ratio between reduced weight (water weight) and 1 kg weight is soil moisture. It totally different to the air humidity.
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents