From Let's Control It
(Redirected from HumiditySensor2)
Jump to: navigation, search



The SI7021 Sensor is a temperature and humidity sensor. It uses a precision humidity sensor type SHT-21. It is connected to the ESP via I²C so connecting even with several sensors and a display is easy to do. The sensor gives relative humidity and temperature as digital values.

Precautions =

The SI7021 runs well on 3,3V so no level shifter or special power supply is needed.

The bare circuit is very small and difficult to handle and solder. Usually you will use a breakout board from the market that is much easier to handle. The breakout board is available as "SI7021", also as "HTU21" or "GY-21".


Connecting the SI7021 is easy. Just connect it as shown in the schematic:

  SI7021		ESP
  Vin		3,3V
  SCL		D1(GPIO5)
  SDA		D2(GPIO4)

SH7021 Schematics.jpg

SI7021 Breadboard-example.jpg

If you're connecting several devices to I²C and/or using longer cabling please see the "Basics: The I²C Bus" wiki for further informations. [link]


First check if the SI7021 show up:

Go to the "Tools --> ""Advanced" Tab and click "I³C Scan" It should show this result:

SI7021 Scan-Results.jpg

Set up the ESPEasy task according to the screenshot.

SI7021 Settings.jpg

After some seconds the tasklist will show like this:

SI7021 Device-List.jpg

If it shows all values as zero, don't worry. Wait a minute and refresh the browser page.


See "Basics: Calibrating" for further information [link]


Your SI7021 does not show up at I²C-scan

Usually this failure results of cabling faults. If your device does not show up, SCL and SCA might be swapped or the module does not get power or ground. If you are testing on a breadboard, the breadboard contacts might be worn out or you got some faulty cables. A digital multimeter will help with this situations.

Your SI7021 shows all values zero

The I²C-scan showed your SI7021 but after submitting and returning to the task list all values are zero. First, wait a minute and then refresh the page. Depending on the "Delay" value in the settings it might take some seconds until the first measurement takes place. If that does not help, switch the ESP completely off and back on after some seconds.

Your SI7021 shows deviating values

This might have several reasons.

Seen often is a somewhat too high temperature value. Remember that voltage regulators and the ESP chip itself get warm and heat up the case inside.

There is no real help against this besides placing the sensor away from these parts. A better solution is using a separate temperature sensor (DS18B20 for example) outside the case.

Another point: These sensors all have their own tolerances. On top the analog to digital conversion produces a deviation of about +/- 1...2 digits.

It is possible to calibrate sensors using a formula See "Basics: Calibrating" for further information [link]

Last but not least problems with the power supply are quite usual. See "Basics: Taming false positives" in the wiki for info about filtering power supply. {link]