From afd8d06a7220cc200b57ee03f9c12854a6b1b3fc Mon Sep 17 00:00:00 2001 From: Urs Utzinger Date: Fri, 26 Feb 2021 13:09:04 -0700 Subject: [PATCH] Include delay until data is expected to be ready Without this delay the host is sending continuous read requests to the sensor. However the sensor is busy producing the data and does not respond to those requests. Observations with an oscilloscope indicate that each request deteriorates the SDA and SCL and potentially affects the sensor's and potentially the hosts' life time. SCA and SCL signal high level decreases and fluctuates when 0x40(R) is produced, indicating that hosts can not maintain a stable signal level on the i2c bus. --- adafruit_htu21d.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adafruit_htu21d.py b/adafruit_htu21d.py index 2a3de80..04f95c8 100644 --- a/adafruit_htu21d.py +++ b/adafruit_htu21d.py @@ -97,6 +97,7 @@ def relative_humidity(self): """The measured relative humidity in percent.""" self.measurement(HUMIDITY) self._measurement = 0 + time.sleep(0.016) return self._data() * 125.0 / 65536.0 - 6.0 @property @@ -104,6 +105,7 @@ def temperature(self): """The measured temperature in degrees Celcius.""" self.measurement(TEMPERATURE) self._measurement = 0 + time.sleep(0.050) return self._data() * 175.72 / 65536.0 - 46.85 def measurement(self, what):