Troubleshooting

SHT31 Weather-proof Temperature & Humidity Sensor gives 38°C for 60°C

userHead Daoming.Zhang 2023-05-23 10:13:12 433 Views3 Replies

Hi, 

 

I have purchased two SHT31 Weather-proof Temperature & Humidity Sensors and trying to place them in an environmental chamber to monitor temperature changes over time. I have connected them directly to a Raspberry Pi Pico (sensors powered by 3.3V) with micropython running the following code:

 

import machine
import utime
import ustruct
import sys

 

TEMP_ADDR = 0x44

 

i2c1 = machine.I2C(0, scl=machine.Pin(17), sda=machine.Pin(16), freq=400000)
i2c2 = machine.I2C(1, scl=machine.Pin(19), sda=machine.Pin(18), freq=400000)

 

while True:

  # high repeatablility with clock stretching disabled

  i2c1.writeto(0x44, b'\x2C\x06\x4F')  
  d=i2c1.readfrom(0x44, 6)

  # display hex

  print("".join(" %02x" % i for i in d))
  print ("T1 = {:.0f} ℃, RH1 = {:.0f} %".format((d[0]*256+d[1])/1000, (d[3]*256+d[4])/1000))
  i2c2.writeto(0x44, b'\x2C\x06\x4F')
  d=i2c2.readfrom(0x44, 6)
  print("".join(" %02x" % i for i in d))

  print ("T2 = {:.0f} ℃, RH2 = {:.0f} %".format((d[0]*256+d[1])/1000, (d[3]*256+d[4])/1000))
  input()
 

 

When placing the first sensor inside the environmental chamber at 47℃ and the second one at room temperature 23℃, the outputs from the sensors are:

 

87 76 52 14 bb 39
T1 = 35 ℃, RH1 = 5 %
 

67 4a 9c 51 ff 3e
T2 = 26 ℃, RH2 = 21 %

 

When placing both inside the environmental chamber at 60 °C, they both give 38 °C. It seems the sensor is nearly accurate at room temperature, 12 °C lower at 50 °C and 22 °C at 60 °C.  It is far away from the claimed accuracy of 0.1 °C. Is there anything we can fix the problem?  Thanks.
 

2023-05-23 18:13:50

You can try the adafruit library for SHT31.

 

https://learn.adafruit.com/adafruit-sht31-d-temperature-and-humidity-sensor-breakout/python-circuitpython

userHeadPic bidrohini.bidrohini
2023-05-23 15:25:51

Sorry, we don't have a library for Raspberry Pi Pico. From the code you posted, you do not use the DF library. Do you own one of these compatible boards? It is recommended to use the example code in order to troubleshoot the sensor hardware.

userHeadPic jenna
2023-05-23 11:50:39

Sorry the accuracy for SHT31 should be 0.2 °C.  

userHeadPic Daoming.Zhang