Reference

Last revision 2025/12/16

This article offers an in-depth look at the DFRobot SHT3x library for Arduino, explaining its communication protocol, API functions, and integration principles for precise temperature and humidity measurements.

Library

Download the DFRobot Arduino SHT3x library

How to install Libraries in Arduino IDE

Communication Protocol Description

  • Interface Type: Serial (I2C non standard)

API Description

  • Constructor: DFRobot_SHT3x(pWire = &Wire, address = 0x45, RST = 4)
    Construct the function.

    • pWire: I2C bus pointer object and construction device, Wire in default.
    • address: Chip I2C address, two optional addresses 0x44 and 0x45 (0x45 in default).
    • RST: Chip reset pin, 4 in default.
    • Note: I2C address is determined by the pin addr on the chip. When ADR is connected to VDD, address is 0x45; when connected to GND, address is 0x44.
  • begin(): Initialize the chip. Returns 0 if successful, otherwise returns non-0.

  • readSerialNumber(): Read the serial number of the chip. Returns 32-digit serial number.

  • softReset(): Send command resets via I2C, enter the chip's default mode (single-measure mode), turn off the heater, and clear the alert of the ALERT pin. Returns true if successful.

  • heaterEnable(): Turn on the heater inside the chip to enable the sensor get correct humidity value in wet environments. Returns true if successful. Note: Heaters should be used in wet environments; other cases will result in incorrect readings.

  • getTemperatureC(): Get the measured temperature (℃). Returns float temperature data.

  • getTemperatureF(): Get the measured temperature (℉). Returns float temperature data.

  • getHumidityRH(): Get the measured humidity (%RH). Returns float humidity data.

  • readTemperatureAndHumidity(repeatability): Get temperature and humidity data in single measurement mode.

    • repeatability: Set repeatability to read temperature and humidity data with the type eRepeatability_t. Optional parameters:
      • eRepeatability_High: Humidity repeatability 0.10%RH, temperature repeatability 0.06°C.
      • eRepeatability_Medium: Humidity repeatability 0.15%RH, temperature repeatability 0.12°C.
      • eRepeatability_Low: Humidity repeatability 0.25%RH, temperature repeatability 0.24°C.
    • Returns a structure containing celsius temperature (°C), Fahrenheit temperature (°F), relative humidity (%RH), and status code. Return 0 indicates valid data.

Principle

The metallic mesh covering the sensor adopts method of infiltering copper during sintering to enhance the temperature resistance, pressure resistance, and wearing resistance of it. The 2-wire serial interface and internal voltage regulation allows for easy and fast system integration.

document

sensirion home page

Was this article helpful?

TOP