Arduino Forum

Using Arduino => Sensors => Topic started by: liutyi on Jul 02, 2019, 01:02 am

Title: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 02, 2019, 01:02 am
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 (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 (https://wiki.liutyi.info/display/ARDUINO/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$

(https://wiki.liutyi.info/download/attachments/35291140/Sensors_Board_v5_with_labels_wli.JPG) (https://wiki.liutyi.info/display/ARDUINO/v5+Sensors+Board+project?preview=/35291140/35291292/Sensors_Board_v5_with_labels_wli.JPG)


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 (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+5+v5+saturated+salt+solution)
https://wiki.liutyi.info/display/ARDUINO/Test+6+v5+above+water (https://wiki.liutyi.info/display/ARDUINO/Test+6+v5+above+water)
https://wiki.liutyi.info/display/ARDUINO/Test+7+v5+humidity+absorber (https://wiki.liutyi.info/display/ARDUINO/Test+7+v5+humidity+absorber)

Creation history:
Humidity sensors tester creation (Instagram stories) (https://www.instagram.com/stories/highlights/17878616644317342/)

Article
Multiple i2c humidity sensors test (Facebook Note) (https://www.facebook.com/notes/oleksandr-liutyi/multiple-i2c-humidity-sensors-test/10219983237397100/)

Unstable next (v6) version of board incl. 8xAHT15 (3$) and 8xHDC2080 (4.7$) (https://wiki.liutyi.info/display/ARDUINO/v6+Sensors+Board)
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: Coding Badly on Jul 02, 2019, 03:41 am

Do you have a question?

Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: Koepel on Jul 02, 2019, 06:33 pm
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() (https://github.com/Koepel/How-to-use-the-Arduino-Wire-library/wiki/Common-mistakes#1).
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.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 02, 2019, 11:23 pm
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() (https://github.com/Koepel/How-to-use-the-Arduino-Wire-library/wiki/Common-mistakes#1).
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.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: Koepel on Jul 02, 2019, 11:35 pm
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.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 02, 2019, 11:39 pm
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
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: Koepel on Jul 02, 2019, 11:45 pm
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.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 02, 2019, 11:47 pm
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)
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 03, 2019, 12:01 am
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.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 06, 2019, 06:26 am
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 (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. :(


(https://forum.arduino.cc/index.php?action=dlattach;topic=624204.0;attach=315326;image)
 (https://forum.arduino.cc/index.php?action=dlattach;topic=624204.0;attach=315326;image)


(https://forum.arduino.cc/index.php?action=dlattach;topic=624204.0;attach=315328;image)
 (https://forum.arduino.cc/index.php?action=dlattach;topic=624204.0;attach=315328;image)
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: GolamMostafa on Jul 06, 2019, 06:47 am
I could not help noticing a timeout after a Wire.requestfrom(). There is no such thing as a timeout after a Wire.requestFrom() (https://github.com/Koepel/How-to-use-the-Arduino-Wire-library/wiki/Common-mistakes#1).

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.  
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 14, 2019, 12:09 pm
Some high humidity test results
at RH ~75%

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

(https://wiki.liutyi.info/download/attachments/35291231/test51-rh75-h.png)

So the RH measurements are:

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

(https://wiki.liutyi.info/download/attachments/35291231/test51-rh75-t.png)

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

BME280, BME680 - Above expected

Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: Koepel on Jul 14, 2019, 01:29 pm
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 (https://github.com/arduino/ArduinoCore-avr/blob/master/libraries/Wire/src/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.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 15, 2019, 10:29 am
Low humidity (~20% RH) test:

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

Humidity
(https://wiki.liutyi.info/download/attachments/35291259/test71-rh20t25-h.png)

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
(https://wiki.liutyi.info/download/attachments/35291259/test71-rh20t25-t.png)

BMEx60 above expected

Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: Koepel on Jul 16, 2019, 09:51 am
Would it be possible to add a price to the table (https://wiki.liutyi.info/display/ARDUINO/Test+i2c+humidity+sensors) 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.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 16, 2019, 11:58 am
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$ :)

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$

Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Jul 23, 2019, 09:42 pm
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.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: AmphenolSensors on Aug 05, 2019, 07:01 pm
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.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Aug 20, 2019, 01:23 pm
(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 (https://wiki.liutyi.info/display/ARDUINO/HDC2080) and AHT15 (https://wiki.liutyi.info/display/ARDUINO/AHT15) (appears on Aliexpress recently)

see
Multiple i2c humidity sensors test (note) (https://www.facebook.com/notes/oleksandr-liutyi/multiple-i2c-humidity-sensors-test/10219983237397100/)

Trends with Airflow (https://wiki.liutyi.info/display/ARDUINO/Test+9+v5+external+fan+off+and+on)

Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: Marciokoko on Aug 27, 2019, 03:19 pm
@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?

2. 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?
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: Marciokoko on Aug 28, 2019, 11:39 pm
Wait, does that thermal effect work proportional or inversely, for t vs t?

Because right now I have a cooking thermometer and a digital one next to the dht11.  The dht11 reads 33 and the cooking reads 40 and the digital 39.8.  So it seems the hotter the dht11 gets, the lower it's temp reading.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Aug 31, 2019, 12:33 am
Wait, does that thermal effect work proportional or inversely, for t vs t?

Because right now I have a cooking thermometer and a digital one next to the dht11.  The dht11 reads 33 and the cooking reads 40 and the digital 39.8.  So it seems the hotter the dht11 gets, the lower it's temp reading.
sensor self-heating (like bosch BME) or sensor near hot electronic components (like CPU, MCU, voltage regulator) show higher than real temperature, and lower than real humidity. But that is only part of a problem.

Other problem is - two sensors almost always measure somehow differently. The same type of sensor also. And relatively expensive sensors too.

Cheap sensors like DHT11 is inaccurate "by design".

And as I understand it is kind of per sensor/device calibration needed for all devices using sensors to be sure measurements are more or less correct.
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Aug 31, 2019, 12:46 am
Updated v6 Board includes 84 sensors listed below (incl. new AHT15 and HDC2080)


Board v6
(https://wiki.liutyi.info/download/attachments/35291351/board_v6.jpg) (https://wiki.liutyi.info/display/ARDUINO/v6+Sensors+Board?preview=/35291351/35291504/board_v6.jpg)

Tests


Sensors


Code
https://github.com/liutyi/arduino-humidity-sensors-test/blob/v6/arduino-humidity-sensors-test.ino (https://github.com/liutyi/arduino-humidity-sensors-test/blob/v6/arduino-humidity-sensors-test.ino)

Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Sep 02, 2019, 01:20 am
Yet another tests results:

at ~RH=17% (https://wiki.liutyi.info/display/ARDUINO/Test+3+v6+Humidity+absorber)
at ~RH=75% (https://wiki.liutyi.info/display/ARDUINO/Test+4+v6+Saturated+NaCl+solution)
at ~RH=100% (https://wiki.liutyi.info/display/ARDUINO/Test+5+v6+above+water)

An impression from new sensors in general, AHT15 is better than AHT10 (I expected the same results).
CJMCU modules HDC2080 is better than HDC1080 in humidity measurement, but not in temperature.
(self-heating? start wondering about "more feature in sensor more +temperature it measures").

(https://wiki.liutyi.info/download/attachments/35291425/v6t4_t_diff.png) (https://wiki.liutyi.info/display/ARDUINO/Test+4+v6+Saturated+NaCl+solution?preview=/35291425/35291447/v6t4_t_diff.png)

(https://wiki.liutyi.info/download/attachments/35291425/v6t4_rh_diff.png) (https://wiki.liutyi.info/display/ARDUINO/Test+4+v6+Saturated+NaCl+solution?preview=/35291425/35291446/v6t4_rh_diff.png)
Title: Re: Compare different i2c temperature and humidity sensors (SHT2x, SHT3x, SHT85, ..)
Post by: liutyi on Sep 08, 2019, 02:16 pm
Inside AHT15 and AHT10
Pulling out sensor module from board accidentaly got cover off AHT15. Decide to compare with AHT10.
(https://wiki.liutyi.info/download/attachments/35291485/AHT10_AHT15_inside.jpg) (https://wiki.liutyi.info/display/ARDUINO/AHT10+inside?preview=/35291485/35291486/AHT10_AHT15_inside.jpg)