SHT3x for Arduino

📒 Datasheet PDF

1.

🔽 Get Arduino

Install the Arduino IDE

2.

📦 Install the library

Start the Arduino IDE, press the Sketch menu, and then Include Library > Manage Libraries

  1. Search for Microfire and install the library called Microfire SHT3x

3.

🔌 Connections

  1. Make the I2C connections:
  • SHT3x SDA to controller SDA
  • SHT3x  SCL to controller SCL
  • SHT3x  GND to controller ground
  • SHT3x  VCC to controller 3.3 or 5-volt

🔰 Write some code

Below is the Basic example. It can be found in File > Examples > Microfire_SHT3x > Basic in the Arduino IDE.

// include the header file
#include <Microfire_SHT3x.h>
Microfire::SHT3x sht30;

void setup()
{
  // start Serial and I2C
  Serial.begin(9600);
  Wire.begin();

  // start the sensor
  sht30.begin();
}

void loop()
{
  // take a measurement
  sht30.measure();

  // display the results
  switch (sht30.status)
  {
    case sht30.STATUS_NOT_CONNECTED:
      Serial.println("Error: Sensor not connected");
      break;
    case sht30.STATUS_CRC_ERROR:
      Serial.println("Error: CRC error");
      break;
    case sht30.STATUS_NO_ERROR:
      Serial.println((String)sht30.tempC + " °C");
      Serial.println((String)sht30.tempF + " °F");
      Serial.println((String)sht30.RH + " %RH");
      Serial.println((String)sht30.vpd_kPa + " VPD kPa");
      Serial.println((String)sht30.dew_pointC + " dew point °C");
      Serial.println((String)sht30.dew_pointF + " dew point °F");
      break;
  }
  delay(1000);
}

5.

➡️ Upload the code

  1. Tell the Arduino IDE what board you are using. Press Tools > Board and find yours in the menu
  2. Press the upload button

6.

🔎 View the output

  1. Open the Serial Monitor by pressing Tools > Serial Monitor
  2. The measurements should be displayed in the monitor, with updates every second