Introduction

Measure temperature and humidity with the Sensiron SHT20 sensor.

Characteristics

  • Temperature range: -40 to 125 C (-40 to 257 F)
  • Humidity range: 0 to 100 % RH
  • Temperature accuracy: ± 0.5% C
  • Humidity accuracy: ± 5% RH
  • Interface: I2C
  • Voltage range: 2.1 - 3.6 V

Connections

I2C Connections

The attached Qwiic connector is keyed and can only be inserted one way.

I2C Bus Pull-ups

The device has no pull-up resistors; it is intended to be used as an accessory to a uFire board which already has pull-up resistors installed.

Getting Started

To start using the device, you need to install a library for your board/platform.

  • Arduino IDE: go to the library manager (Sketch / Include Library / Manage Libraries...) and search for uFire SHT20.

  • PlatformIO: install the library using the library manager (PlatformIO / PlatformIO Home / Libraries) and search for uFire SHT20.

  • Particle.io: search for uFire SHT20 in the Libraries section of the IDE.

  • Raspberry Pi: clone the GitHub repo. The library is located in the python/RaspberryPi directory. Have a look at the README for instructions. Be sure to read the section below for instructions.

  • Rust: Download/install/documentation for the crate

Any other SHT2x library will work as well.

The shell Example

An interactive shell interface is provided and is a quick and easy way to get started using the device. You will find the equivalent commands in the code area below when applicable. Upload it to your device, start a serial terminal and you will get a > prompt where you can enter commands and receive a response like a terminal or REPL. It is often quicker to experiment with things this way rather than rewriting, compiling, and uploading new versions every time.

Resolution

The device has 4 resolution modes, 8, 10, 11, and 12. By default, the libraries all use 12 bit. To change the mode, it can be done in the class initialization by passing RESOLUTION_8BITS, RESOLUTION_10BITS, RESOLUTION_11BITS or RESOLUTION_12BITS as can be seen in the next section.

Class Initialization

  • C++: There are several class constructors available.
    • Default: uFire_SHT20 sht20;
    • Change resolution: uFire_SHT20 sht20(sht20.RESOLUTION_10BITS);
    • ESP32 I2C Pins (SDA, SCL): uFire_SHT20 sht20(19, 23);
    • ESP32 I2C Pins and resolution(SDA, SCL): uFire_SHT20 sht20(19, 23, sht20.RESOLUTION_10BITS);
  • Raspberry Pi Python: You can optionally pass the bus and resolution.
    • Default: ec = uFire_EC()
    • I2C System Bus: ec = uFire_EC(i2c_bus=3)
    • Resolution: ec = uFire_EC(resolution=SHT20.RESOLUTION_10BITS)
  • Rust: Always pass the I2C system bus.
    • Default: let mut sht20 = SHT20::new("/dev/i2c-3");

Calibration

The device comes pre-calibrated from the factory and cannot be changed.

More Help

If you have any questions, find a bug, or have any suggestions, go to this project's GitHub page and submit an Issue or Pull Request. Or you can send an email to [email protected].