Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)

I was always interested in why two electronic hygrometers usually display different numbers. Did some googling and found a good article from Robert at Testing and Comparing Low Cost Hygrometers 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$)

Legend2.png

6 Likes

Do you have a question?

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.

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.

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.

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.

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.

maybe you right. I just starting to learn i2c. thanks for advice

1 Like

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.

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)

Koepel:
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.

Koepel:
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. :frowning:





Koepel:
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.

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

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

GolamMostafa:
... 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.

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

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.

There is a significant price difference in the same type of sensor modules from different brand/suppliers, so I am not sure how to put in a table )

It will look like for example BME280 3$-31$ :slight_smile:

All Sensors price

SHT20 - 4$
SHT21-C - 12$
SHT21-G - 4$
SHT25 - 4$ (board) +10$ (chip) + work

SHT30 - 7$
SHT31 - 9$
SHT31-2 - 4$
SHT35 - 16$
Adafruit SHT31 - 14$ (~17$ with tax and delievery)

Sensirion SHT85 - 30$ (35$-40$ with delivery)

BME280 - 3.5$
BME280-G - 3$
BME680-C 11$
Adafruit BME280 - 23$ (31$ with tax and delievery)

Si7021 - 8$/2
Si7021-Y - 3$
Si7021-G - 4.5$
Adafruit Si7021 - 7$ (~10$ with tax and delievery)

HTU21d-Y - 3$
HTU21d-G - 10$ (sold as SHT that is why expensive)
Adafruit HTU21d - 18$

AHT10 - 1.3$

HDC1080-G - 2.5$
HDC1080-C - 4$

AM2320 - 2$

found the issues in previous results (SHT35 results was shown as SHT31-2, and vice-versa). Posts in topic updated to fix that. The initial post was rewritten (so no need to read all the posts): added project history, board v5 image with sensors label, sensors modules price range.

Not sure what you are trying to achieve here, you are comparing similar sensors and assuming one type is likely more accurate than another? They are not, the sensors chosen are fundamentally all the same technology, and all susceptible to thermal effect, so not mounting them in an environemental chamber (a box), and not circulating the air renders most of your results unusable save for the academic excercise of putting lots of sensors on one bus, or a cost comparison. A 1°C rise on the board lowers the humidity reading by 2.5%, so any thermal stratification or pich up from adjacent electronics will effect output. These things are sensors, not electronic chips, even though they look like chips! We spend an inordinate amount of time thermally isolating designs.

If you want to do this properly then you need compare with a chilled mirror sensor, yes they are truly expensive, but are truly the only way to measure humidity accurately and repeatedly, unsurprisingly its what national reference sensors are, and are fitted universally in environmental chambers.

So my apologies for apparenty 'dissing' your work, but when you spend as much time as I do expaining to electronic engineers that it's a sensor not a chip and cannot be treated as such, you'll understand my frustration.

BTW, you didn't include our ChipCap or the waterproof T9602 probe.

(1) why compare similar sensors?

Because they give different measurements. And that is not expected. People expect to get the same numbers from the two same types of sensors in the same device/project. Also, that is something not covered in previous "this kind" of sensors comparison I found. Some of the previous comparisons are about single SHT30 compared to single BME280 or HTU21d, and that is something I want to improve there. (to see how multiple SHT3x perform in comparison to multiple HTU21d)

(2) env chamber and airflow

I am not a lab. but I also did test in a box and with airflow, board upside-down and so on, trends are more or less the same. so that is definitely not something can be explained with board unequal heating.

(3) sensors are not a chip

I believe I understand that. But is that all humidity sensors are kind of inaccurate by-default and need per-device calibration or at least some expensive one might be trusted "from the box". Can I just buy the pre-calibrated sensor and use it my project or it is something "unavailable as an option" for all these sensors? And actually, any DIY weather station (no matter how good you follow thermal design guidance) has no chance to be accurate?

(4) ChipCap
I only test i2c t/RH sensors, one can buy for DIY Arduino project on Aliexpress or Amazon. Have no goal to cover all existing sensors of all types (it is actually too expensive). Did search again ChipChap not found on both platforms. That is why it is not on my board. Now working on adding HDC2080 and AHT15 (appears on Aliexpress recently)

see
Multiple i2c humidity sensors test (note)

Trends with Airflow

@AmphenolSensors

Ive recently started to use dhts to measure humidity and temp. First I was interested in measuring temp of a warehouse and second the humidity of coffee beans. I ran into these issues:

  1. Warehouse is far from wifi access so I used nrf radios to send data to building with wifi to post data to Thingspeak.com for logging. Since warehouse is remote and without power I had to use solar rechargeable battery pack to power project. When I tested in the field the t and h measurements were off or at least seemed off. 5% hum and 51C. Now I understand the thermal effect you mention since I was testing it out in the sun in order for the solar panel to charge the battery pack.

So I could separate the panel from the rest of my setup but the warehouse is going to be hot. At what temp does that thermal effect kick in and start distorting my data?

  1. Humidity in the coffee bean. I've long wondered what those $500 coffee humidity testers work on for humidity. I have noticed a flat prism like tip at the bottom of the coffee container which I'm guessing would be one of the mirrors. Ok so my idea was to make a cheaper version of them but if air circulation is important then I would have to add a fan as well. I've been testing just the dht22 and hdc1080 locked in a closed Tupperware a inside a room and it's still all over the place, from low 60's to high 70's.

So cooling it to a certain temp would actually be better for the reading?