5

Temperature / humidity sensors benchmark for Raspberry Pi and Arduino

 3 years ago
source link: https://michael.bouvy.net/post/temperature-humidity-sensors-benchmark-for-raspberry-pi-and-arduino
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Temperature / humidity sensors benchmark for Raspberry Pi and Arduino

temperature arduino raspberry humidity pressure
Published on 2020/09/13

Almost ten years ago, as I began tinkering with an Arduino Uno, my first project required measuring indoor and outdoor temperature. As the Uno has analog inputs, I used very affordable 47K thermistors.

thermistor-150x150.jpg

Thermistor 47K

Few years later, the Raspberry Pi was introduced (2012), and the ESP8266 (ESP-01 model) became popular in 2014.

The RPi has no built-in Analog-to-Digital-Converter (ADC), and the ESP8266 analog input was not made available on the ESP-01 form factor (and expects 0-1V voltage range in other form factors).

Many digital temperature and humidity sensors with different communications protocols are commonly used in DIY projects:

Sensor Price Form factor Communication protocol Temperature Humidity Pressure DHT11 / DHT22 ~$5 / ~$10 Standalone, 4 pins Custom yes yes no BME280 ~$20 Breakout board, 7 pins I2C / SPI yes (internal) yes yes DS18B20 ~$4 Standalone, 3 pins 1-Wire yes no no Si7021  ~$9 Breakout board, 5 pins  I2C yes yes no

All these sensors have a different accuracy, so I wanted to compare the values they report, to check their consistency.

For the purpose of this benchmark, I wired all those sensors on a Raspberry Pi Zero, and wrote a simple Node.js script, reporting the measured temperature and humidity values every 30 seconds.

pi-zero-temperature-sensors-1024x768.jpeg
All 4 temperature sensor types wired to a Pi Zero

As you may notice, I actually wired 2 DS18B20 sensors, one of them being the waterproof version, so I can compare the values I get. Here are the results after 1 night running:

temperature-1024x468.png
Temperature comparison between 4 modules

This chart brings many conclusions:

  • BME280 and Si7021 have a much better precision than the other modules
  • No difference is measured between the bare and the waterproof versions of the DS18B20
  • The BME280 reports higher temperature than the other modules: this is because this sensor reports internal temperature, altered by the components dissipated heat

Analysing deeper this BME280 reported temperature difference:

diff-bme280-1024x468.png
Temperature difference between BME280 and average of others

This difference is fairly constant; ~1°C can be removed from BME280 reported values to get an acceptable value. Let's see about humidity:

humidity-1024x468.png
Humidity comparison between 3 modules

Of three modules embedding a humidity sensor, DHT22 reported values are way lower than the other two ones (BME280 and Si7021): around 12% (points). I used the following Node.js libraries for this benchmark (thanks to all their authors/contributors):

Conclusion

Except for the BME280 (internal temp sensor), reported temperatures are all within a few tenth of a degree Celsius, which is quite satisfying. So which sensor to choose? I'd go for the DS18B20 for temperature only, which is quite cheap, easy to connect, and has a good precision. If humidity measurements are also needed, I'd go for the Si7021. At last, if atmospheric pressure measurements are needed, I'd go for the BME280, subtracting about a degree Celsius from the reported temperature.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK