Go Down

Topic: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..) (Read 1 time) previous topic - next topic

liutyi

I was always interested in why two electronic hygrometers usually display different numbers. Did some googling and found a good article from Robert at http://www.kandrsmith.org/RJS/Misc/hygrometers.html that compare some types of sensors and different sensors gives different numbers. That was kind of unexpected and interesting. So I decided to improve a bit this test by adding a number of same i2c sensors. So the latest version of the project contains 68 sensors of 14 types.

List of sensors in v5 setup (price mostly from AliExpress):


AHT10 [8] 1.3$
AM2320 [8] 2$
HDC1080 [8] 2.5-4$

HTU21d [8] 3-18$
Si7021[8] 3-10$

BME280 [6] 3-31$
BME680 [2] 11$

SHT20 [3] 4$
SHT21 [4] 4-12$
SHT25 [1] 14$*
SHT30 [2] 7$
SHT31 [5] 4$-17$
SHT35 [2] 16$
SHT85 [3] 35-40$




So just simple run of the board gives a total max-min difference for 68 sensors for 20% RH and 2°C
Some sensor of the same type provides similar results some aren't.

Project is still in progress but some data are already available and might be interesting to others planning to use humidity sensor in their project.

See project description:
https://wiki.liutyi.info/display/ARDUINO/Test+i2c+humidity+sensors

Draft test results:
https://wiki.liutyi.info/display/ARDUINO/Test+5+v5+saturated+salt+solution
https://wiki.liutyi.info/display/ARDUINO/Test+6+v5+above+water
https://wiki.liutyi.info/display/ARDUINO/Test+7+v5+humidity+absorber

Creation history:
Humidity sensors tester creation (Instagram stories)

Article
Multiple i2c humidity sensors test (Facebook Note)

Unstable next (v6) version of board incl. 8xAHT15 (3$) and 8xHDC2080 (4.7$)


Koepel

That's impressive !

I could not help noticing a timeout after a Wire.requestfrom(). There is no such thing as a timeout after a Wire.requestFrom().
You don't need 'writeBuffer[]'. The Wire.write() function writes the byte to a buffer (inside the Wire library).
When comparing millis() to a value or calculating a time in the future, then you have created a rollover problem.

liutyi

That's impressive !

I could not help noticing a timeout after a Wire.requestfrom(). There is no such thing as a timeout after a Wire.requestFrom().
You don't need 'writeBuffer[]'. The Wire.write() function writes the byte to a buffer (inside the Wire library).
When comparing millis() to a value or calculating a time in the future, then you have created a rollover problem.

When the board was electrically unstable I believe those timeouts helped. The device was hanging less with those (I cannot explain why). Will try to remove timeouts now when it is stable, will see the impact.

Koepel

Those timeouts are good for nothing. It is nonsense-code. They actually increase the chance of halting the sketch. It is not okay to fix a bug with another bug.
You could reduce the SCL clock speed with Wire.setClock(50000); to make it more stable or calculate the combined pullup resistors.

liutyi

Those timeouts are good for nothing. It is nonsense-code. They actually increase the chance of halting the sketch. It is not okay to fix a bug with another bug.
You could reduce the SCL clock speed with Wire.setClock(50000); to make it more stable or calculate the combined pullup resistors.
maybe you right. I just starting to learn i2c. thanks for advice

Koepel

Someone started with that timeout, and now it copied a lot. But please don't do that.
You could submit a tip at Hackaday about your sensor tests.

liutyi

Do you have a question?


It is more like a shared knowledge and request for comments from those who interested in different humidity sensor comparison topic.

Some specific question may sound like:

- if anyone experience (or solve) AHT10 i2c incompatibility with other i2c devices on the same bus? (I did a workaround with additional multiplexer but it is not like it have to be done really)

- Did someone try similar humidity sensors comparison of multiple same-type sensors and what was the result? (what I get is kind of too big difference in numbers from different sensors). It does not look good.

- Which humidity sensor (that not cost like SHT85) you trust. Or believe it matches at least its own specification? (DHT11 and DHT12 is just so bad so I do not include them in latest comparison)

liutyi

You could submit a tip at Hackaday about your sensor tests.
Maybe someday. Those tests are just drafts for the moment. It will take months for me to feel that test quality is good enough for public announces. Current results actually blame a lot of sensors for major inacuracy. I believe final results will be more or less the same, but I want to be sure it is not something I did wrong.

liutyi

Someone started with that timeout, and now it copied a lot. But please don't do that.
Timeouts removal test
 https://wiki.liutyi.info/display/ARDUINO/v5+board+no+timeout+code+test

It works with a stable board and all sensor inserted. It works faster.

for the unstable board or partly missing sensors code need to be improved with CRC/limits checking. And those to be done for all types of sensors. :(









GolamMostafa

I could not help noticing a timeout after a Wire.requestfrom(). There is no such thing as a timeout after a Wire.requestFrom().

You don't need 'writeBuffer[]'. The Wire.write() function writes the byte to a buffer (inside the Wire library).
When comparing millis() to a value or calculating a time in the future, then you have created a rollover problem.
What will be role of the WDT if enabled?

Wire Library (Wire.h) is a collection of functions from which the Compiler will pick up only those functions as are mentioned in the sketch. Therefore, the buffer which is a 'physical memory space' must be located within the Microcontroller.  

liutyi

Some high humidity test results
at RH ~75%

https://wiki.liutyi.info/display/ARDUINO/Test+5+v5+saturated+salt+solution



So the RH measurements are:

AHT10, HDC1080, AM2320 - above expected
HTU21d, BME280, BME680 - below expected
Si7021, SHT3x, most SHT2x, SHT85 - expected



t measurements (using SHT85 as a reference, since no other precision thermometers available)

BME280, BME680 - Above expected


Koepel

Thank you :smiley-cool: Very interesting data.
This certainly something for a buyer's guide or a sticky post or Hackaday.


... the buffer which is a 'physical memory space' must be located within the Microcontroller.   
The Wire.cpp creates the "Wire" object of the TwoWire class at the bottom of that file, and the buffer sizes are set in the top of that file. That is just the "Wire" object on its own.

liutyi

Low humidity (~20% RH) test:

https://wiki.liutyi.info/display/ARDUINO/Test+7+v5+humidity+absorber

Humidity


Low
AHT10   12.1%-17.5%
HTU21d 13.7%-18.8% (one 25%)
BME280 14.5%-17.1%
Si7021   17.0%-18.9% (one 20%, one 25.5%)

Mid
BME680 19.9%
AM2320 18%-24%
SHT85    19%-21%
SHT2x    20%-23% (one 27%)
SHT3x    18.7%-23.6% (one 25%)

High
HDC1080 25.8%-28.4%


Temperature


BMEx60 above expected


Koepel

Would it be possible to add a price to the table with the addresses and voltages ? and perhaps which things the sensor can measure ? The price is in the seperate pages, but it would be nice to have that in the table as an indication. Have you swapped Bosch with Ti in the notes 2 and 3 ?

The SHT85 stands out, but it is expensive.

Go Up