Interfacing SHT3x Humidity & Temperature Sensor with Arduino
In this project, we will design a Hygrometer and Thermometer using SHT3x Sensor and Arduino. We will be interfacing the SHT31 Humidity and Temperature sensor with Arduino and display the temperature and humidity value on the 16×2 LCD Display.
The SHT3x sensor is the most accurate and precise sensor for measuring humidity and temperature parameters compared to other temperature sensors like LM35, Thermistor, DS18B20 & DHT11/DHT22. Thus SHT3x can be used for industrial applications because of the high accuracy and good sensitivity. Its Relative Humidity operating range is 0 – 100% and Temperature operating range is -40° to +125°C (-40° to +257°F).
Check the advanced version of this project here:
1. ESP32 SHT31 Temperature & Humidity Monitor on Web Server
Sensirion SHT3x Series Temperature and Humidity Sensors:
The new digital SHT3x humidity sensor series takes sensor technology to a new level. As the successor of the SHT2x series, it is determined to set the next industry standard in humidity sensing. The SHT3x humidity sensor series consists of a low-cost version with the SHT30 humidity sensor, a standard version with the SHT31 humidity sensor, and a high-end version with the SHT35 humidity sensor. The SHT3x humidity sensor series combines multiple functions and various interfaces (I2C, analog voltage output) with an applications-friendly, very wide operating voltage range (2.15 to 5.5 V). The SHT3x humidity sensor is available in both large and small volumes.
Its features include
1. High reliability and long-term stability
2. Industry-proven technology with a track record of more than 15 years
3. Designed for mass production
4. High process capability
5. Low signal noise
6. Output: I2C, Voltage Out
7. Supply voltage range: 2.4 to 5.5V
8. RH operating range: 0 – 100% RH
9. T operating range: -40° to +125°C (-40° to +257°F)
10. RH response time: 8 sec (tau63%)
Bill of Materials:
| S.N. | Components Name | Quantity | Purchase Links |
|---|---|---|---|
| 1 | Arduino UNO Board | 1 | Amazon | AliExpress |
| 2 | SHT31 Humidity Temperature Sensor | 1 | Amazon | AliExpress |
| 3 | 16x2 LCD Display | 1 | Amazon | AliExpress |
| 4 | Potentiometer 10K | 1 | Amazon | AliExpress |
| 5 | Connecting Wires | 10 | Amazon | AliExpress |
| 6 | Breadboard | 1 | Amazon | AliExpress |
Circuit Diagram & Connections:
Assemble the circuit as shown in the connection diagram below.
Connect LCD pins 4, 6, 11, 12, 13, 14 to Arduino 11, 12, 5, 4, 3, 2 digital pins.
Connect SDA and SCL pins of SHT31 to SDA and SCL Pins of Arduino, i.e A4, and A5 respectively.
Source Code/Program:
Here is a source code for interfacing SHT3x with Arduino for reading humidity and Temperature. Copy the code and upload it to the Arduino board. You need the SHT3x Sensor library. Download the library from here:
Download SHT31 Library
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
#include <LiquidCrystal.h> LiquidCrystal lcd (11,12,5,4,3,2); #include <Arduino.h> #include <Wire.h> #include "Adafruit_SHT31.h" Adafruit_SHT31 sht31 = Adafruit_SHT31(); byte degree[8] = { 0b00011, 0b00011, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000 }; void setup() { Serial.begin(9600); lcd.begin(16,2); lcd.createChar(1, degree); while (!Serial) delay(10); // will pause Zero, Leonardo, etc until serial console opens Serial.println("SHT31 test"); if (! sht31.begin(0x44)) { // Set to 0x45 for alternate i2c addr Serial.println("Couldn't find SHT31"); while (1) delay(1); } } void loop() { float t = sht31.readTemperature(); float h = sht31.readHumidity(); if (! isnan(t)) { // check if 'is not a number' Serial.print("Temp *C = "); Serial.println(t); lcd.print("Temp = "); lcd.print(t); lcd.write(1); lcd.print("C"); } else { Serial.println("Failed to read temperature"); lcd.print("Temperature Error"); } if (! isnan(h)) { // check if 'is not a number' Serial.print("Hum. % = "); Serial.println(h); lcd.setCursor (0,1); lcd.print("Hum. = "); lcd.print(h); lcd.print(" %"); } else { Serial.println("Failed to read humidity"); lcd.setCursor (0,1); lcd.print("Humidity Error"); } Serial.println(); delay(1000); lcd.clear(); } |
Video Tutorial:
Watch this video tutorial below for understanding the entire project, i.e Interfacing SHT3x Humidity & Temperature Sensor with Arduino









5 Comments
Hi sir after reaching 125 degree centigrade, is it damaged or goes to saturation for some time?
http://electronicsforengineer.com/
Thank you for this tutorial, it was most helpful in my learning and a big lesson in debugging.
You may want to update the following
#1 The <> have been converted to ASCII HTML strings for the “include” statements
#2 Initially the LCD didn’t work. I followed your schematic diagram and the sensor was working in the serial monitor but no display. I tried using LCD (4, 6, 11, 12, 13, 14) to Uno (2, 3, 4, 5, 6, 7) with “LiquidCrystal lcd = LiquidCrystal(2, 3, 4, 5, 6, 7);” statement and all was fine. Then I realized on your schematic diagram it looks like the RS and E have been inverted to what your LCD Object states.
Thank you, I have corrected the code according to the circuit.
How to set to 0x45 for alternate i2c addr for sht31? Thanks
Check in the library folder and modify the library.