SHT31 Arduino Interface

Last Updated on March 16, 2024

Various Sensors are available to sense humidity and temperature but when we need small size and low power consuming sensor only few stand out, here we taken the sensor SHT31 from sensirion for sensing humidity and temperature, It can be fully calibrated and I2C Interface available with communication speeds up to 1 MHz and two user selectable addresses (0x44 or 0x45). It provides very fast start up and measurement time. Sensor SH31 Arduino interface can be done through breakout board.




The sensor SHT31 comes in tiny 8-pin DFN package and takes wide supply voltage range from 2.4V to 5.5V and gives typical accuracy of ± 1.5 % RH.

Sensor SHT3x

The sensor SHT31 contains on chip RH sensor, T sensor Interfaced with ADC and data processing & linearization block. Digital interface block with address select option, this sensor has alert logic block to provide alert signal and ALERT pin allows the Alert Mode as a humidity and temperature watchdog.

Arduino SHT31 Wiring

Construction & Working

Connect the sensor module with Arduino uno board, if you use other Arduino boards refer the I2C pins and make the connections properly. Connect 5V Arduino pin to Vin pin of sensor breakout board and Gnd to Gnd then A4 to SDA and A5 to SCL pin of sensor breakout board.

This SHT31 arduino interface provides the temperature and humidity result data in serial monitor of arduino ide.

SHT31 Arduino Code

 

#include <Arduino.h>
#include <Wire.h>
#include "SHT31.h"

SHT31 sht31 = SHT31();

void setup() {  
  Serial.begin(9600);
  while(!Serial);
  Serial.println("begin...");  
  sht31.begin();  
}

void loop() {
  float temp = sht31.getTemperature();
  float hum = sht31.getHumidity();
  Serial.print("Temp = "); 
  Serial.print(temp);
  Serial.println(" C"); //The unit for  Celsius because original arduino don't support speical symbols
  Serial.print("Hum = "); 
  Serial.print(hum);
  Serial.println("%"); 
  Serial.println();
  delay(1000);
}

you can get the sht31 library here.

sample result

Temp = 27.95 C

Hum = 55.88%

 

Temp = 27.97 C

Hum = 55.86%

 

Temp = 27.92 C

Hum = 55.84%




2 thoughts on “SHT31 Arduino Interface

  1. Hello, I tested it with ESP32 module and SHT31 module. By the way SHT31 is correct ?
    Its’ measure value is same as real value? I am not sure that. Because actually measurement value is different with real value. Although room temperature is 20 C, SHT31 value is 28.5 C.
    Also i have tested it with SHT20, but result is same. It is different with real value.
    Why is it? Please let me know

Leave a Reply

Your email address will not be published. Required fields are marked *