Sensirion / arduino-sht

Repository for Sensirion humidity and temperature sensor support on Arduino
BSD 3-Clause "New" or "Revised" License
68 stars 44 forks source link

Turn off the heater on the SHT40 #34

Closed VladimirVecera closed 8 months ago

VladimirVecera commented 8 months ago

I use SHT40 and if I measure I get 30°C. If I use the Adafruit_SHT4x.h library, I measure 23°C. I think the heater is on because if I use SHT4X_LOW_HEATER_100MS on the Adafruint I get 30°C. If I turn it off sht4.setHeater(SHT4X_NO_HEATER); I get back 23°C.

winkj commented 8 months ago

The arduino-sht library has no heater support as of today; however, there was an issue in the past where the first reading was high (see issue #27).

And when you are seeing the high values, are they continuing to be too high, or is it just the first sample?

Also, which version of the library are you using? 1.2.4 is supposed to have a fix for this

LeonieFierz commented 8 months ago

Please note that the driver specific to SHT4x https://github.com/Sensirion/arduino-i2c-sht4x supports to set the heater power.

VladimirVecera commented 8 months ago

The problem arises if you leave the measurement in setup(). The reason is that I want to quickly measure and put the device to sleep. But during this measurement it was 30°C. If I LOOP() the measurement, I get a much lower temperature, 24°C, which is OK.

winkj commented 8 months ago

Which version of the library are you using?

VladimirVecera commented 8 months ago

Latest.

winkj commented 8 months ago

Does the problem occur if you explicitly instantiate SHTSensor with an SHTSensor::SHT4X argument (see https://github.com/Sensirion/arduino-sht/blob/master/examples/multiple-sht-sensors/multiple-sht-sensors.ino#L11C16-L11C32 for an example)?

winkj commented 8 months ago

FYI: I just released v1.2.5, since it appears v1.2.4 was not picked up properly by the Arduino Library Manager. No code changes were made in this release

If you were previously using the Arduino arduino-sht installed via the Arduino Library Manager, this should fix your problem. It may take a few hours to be available via the Library Manager though. In the meantime, instantiating SHTSensor explicitly as outlined above should fix the issue.