DHT11 vs DHT22 vs LM35 vs DS18B20 vs BME280 vs BMP180

There are a wide variety of temperature sensors compatible with Arduino, ESP32, ESP8266 and other development boards. So, it can be difficult to to pick up the most suitable sensor for your project. In this article, we’ll compare 6 widely used temperature sensors: DHT11, DHT22, LM35, DS18B20, BME280 and BMP180.

DHT11 vs DHT22 vs LM35 vs DS18B20 vs BME280 vs BMP180 Temperature Sensors

We’ll compare the sensors when it comes to communication protocol, temperature range, accuracy, ease of use and much more.

We also run a simple experiment in which we measured the temperature in the same environment using all temperature sensors over time. With this experiment we could see how the sensors react to temperature changes. We’ve ran this experiment for approximately 36 hours and we’ll show you the results later in this article.

Recommended reading: 9 Arduino Compatible Temperature Sensors for Your Electronics Projects

Comparing Temperature Sensors: DHT11 vs DHT22 vs LM35 vs DS18B20 vs BME280 vs BMP180

For a quick comparison of the sensors, we’ve put together the following table that shows the most important information when it comes to select a temperature sensor namely: communication protocol, supply voltage, temperature range and accuracy.

Note: the table scrolls horizontally both on desktop computer, tablet and mobile.

SensorDHT11DHT22 (AM2302)LM35DS18B20BME280BMP180
MeasuresTemperature
Humidity
Temperature
Humidity
TemperatureTemperatureTemperature
Humidity
Pressure
Temperature
Pressure
Communication
protocol
One-wire One-wire AnalogOne-wireI2C
SPI
I2C
Supply
voltage
3 to 5.5V DC3 to 6V DC4 to 30 V DC3 to 5.5V DC1.7 to 3.6V (for the chip) 3.3 to 5V for the board1.8 to 3.6V (for the chip) 3.3 to 5V for the board
Temperature
range
0 to 50ºC-40 to 80ºC-55 to 150ºC-55 to 125ºC-40 to 85ºC0 to 65ºC
Accuracy+/- 2ºC (at 0 to 50ºC)+/- 0.5ºC (at -40 to 80ºC)+/-0.5ºC (at 25ºC)+/-0.5ºC (at -10 to 85ºC)+/-0.5ºC (at 25ºC)+/-0.5ºC (at 25ºC)
Support
(Arduino IDE)
Adafruit DHT Library

Adafruit Unified Sensor Library
Adafruit DHT Library

Adafruit Unified Sensor Library
analogRead()DallasTemperature

OneWire
Adafruit BME280 library

Adafruit Unified Sensor Library
Adafruit BME085

Adafruit Unified Sensor Library
Support
(MicroPython)
dht module (included in MicroPython firmware)dht module (included in MicroPython firmware) from machine import ADC
ADC().read
ds18b20 module (included in MicroPython firmware)BME280 Adafruit LibraryBMP180 module
Where to buy?Check pricesCheck prices Check prices Check prices
Check prices (waterproof)
Check prices Check prices

DHT11 vs DHT22 (AM2302)

DHT11 vs DHT22 Temperature and Humidity Sensor

The DHT11 and DHT22 (AM2302) are digital temperature sensors that measure temperature and humidity. They look very similar and work the same way, but have different specs.

Both sensors can be powered either with 3.3V or 5V. So, you can easily use them in your Arduino or ESP projects.

The DHT22 sensor has a better resolution and a wider temperature and humidity measurement range. However, it’s a bit more expensive and you can only request readings with 2 seconds interval.

The DHT11 is slightly cheaper, it has a smaller range, and it’s less accurate. But you can get sensor readings every second.

Despite their differences, they work in a similar way, and you can use the same code to read temperature and humidity. You just need to select in the code the sensor type you’re using.

So, if you’re willing to spend an extra dollar, we recommend the DHT22 over the DHT11.

We have several guides on how to use the DHT11 and DHT22 sensors:

LM35, LM335 and LM34

LM35 LM335 and LM34 Analog Temperature Sensor

The LM35, LM335 and LM34 are linear temperature sensors that output a voltage proportional to the temperature value. The LM35 comes calibrated in Celsius degrees, the LM335 in Kelvin and the LM34 in Fahrenheit. So, depending on the temperature units you’ll use in your project, one of these sensors might be more practical than the other.

We recommend using the LM35 or LM34 instead of the LM335, because subtracting a large number to the LM335 measurements to convert the temperature from Kelvin can compromise the results accuracy.

According to the datasheet, the LM35 and LM34 sensors require very little current to operate, about 60uA. This results in very low self-heating (around 0.08ºC in still air), which means that the temperature measurements won’t be affected by the sensor itself.

To read the temperature from these sensors you just need to read the sensor’s output voltage using an analog pin. If using an Arduino, you just need to use the analogRead() function and you’ll get temperature readings with two decimal points.

So, if you need a cheap and easy to use sensor to monitor temperature, the LM35 can be a good option. Also, because it consumes very little energy, it’s great for portable projects, where low power consumption is required.

Learn how to use the LM35, LM335 and LM34 temperature sensors with Arduino:

DS18B20 Temperature Sensor

DS18B20 Temperature Sensor

The DS18B20 temperature sensor is a one-wire digital temperature sensor. This means that it just requires one data line (and GND) to communicate with your microcontrollers.

It can be powered by an external power supply or it can derive power from the data line (called “parasite mode”), which eliminates the need for an external power supply.

Each DS18B20 temperature sensor has a unique 64-bit serial code. This allows you to wire multiple sensors to the same data wire. So, you can get temperature from multiple sensors using a single GPIO.

Additionally, the resolution of the temperature sensor can be set to 9, 10, 11, or 12 bits which corresponds to increments of 0.5°C, 0.25°C, 0.125°C, and 0.0625°C, respectively. The default resolution at power-up is 12-bit.

The DS18B20 temperature sensor is also available in waterproof version, ideal for outdoor projects or to measure liquid temperature.

DS18B20 Waterproof Temperature Sensor

You can follow our guides to learn how to use the DS18B20 temperature sensor with the ESP32, ESP8266 and Arduino using Arduino IDE or MicroPython:

BME280 vs BMP180

BME280 vs BMP180 Barometric sensor: temperature, humidity and pressure

The BME280 and BMP180 are barometric sensors which means they read atmospheric pressure. The BME280 is also equipped with a temperature and a humidity sensor, and the BMP180 with a temperature sensor. Because pressure changes with altitude, these sensors can also be used to estimate altitude.

When it comes to temperature range, the BME280 has a wider measurement range: -40 to 85ºC, while the BMP180 just measures from 0 to 65ºC. You should keep in mind that the BME280 module self-heats a little bit, so the temperature measurements may be 1 ou 2 degrees above the real temperature value.

The BME280 can use either I2C or SPI communication protocol while the BMP180 can only use I2C communication.

The BME280 sensor is more expensive but it has more functionalities. For example, you can build a weather station project with only this sensor. But if you’re not interested in measuring the pressure or humidity, you can get a cheaper temperature sensor.

Interfacing these sensors with Arduino, ESP8266 and ESP32 is very easy thanks to the Adafruit libraries.

You can use our guides to learn how to use these sensors:

We also have other projects with the BME280 that you may like:

Testing All Temperature Sensors

This experiment logged temperature readings from different temperature sensors over time in the same conditions.

Testing all Temperature Sensors DHT11 DHT22 LM35 DS18B20 BME280 BMP180 with Arduino

We wired all the following temperature sensors to an Arduino Mega:

The data was recorded on a microSD card using a microSD card module. The experiment run for approximately 36 hours and temperature readings were logged every 5 minutes.

We wired the data pins of the temperature sensors to the following pins on Arduino Mega:

  • DHT11: Pin 11
  • DHT22: Pin 12
  • DS18B20: Pin 14
  • LM35: Pin A0
  • BME280: software SPI on these pins: Pin 4 (MISO), Pin 5 (CS), Pin 6 (SCK), Pin 7 (MOSI)
  • BMP180: Pin 20 (SDA) and Pin 21 (CSL)

The microSD card module was connected via hardware SPI: Pin 51 (MOSI), Pin 50 (MISO), Pin 52 (SCK), Pin 53 (CS).

This is the code running in the Arduino Mega.

/*
 * Rui Santos
 * Complete Project Details https://RandomNerdTutorials.com
 */

#include "DHT.h"

#include <OneWire.h>
#include <DallasTemperature.h>

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

#include <Wire.h>
#include <Adafruit_BMP085.h>

#include <SD.h> // for the SD card

const int DHT11sensorPin = 11;  
const int DHT22sensorPin = 12;  

DHT dht11(DHT11sensorPin, DHT11);
DHT dht22(DHT22sensorPin, DHT22);

float DHT11temperature;
float DHT22temperature;

const int DS18B20sensorPin = 14;

OneWire oneWire(DS18B20sensorPin);
DallasTemperature ds18b20(&oneWire);

float DS18B20temperature1;
float DS18B20temperature2;

const int BME_SCK = 6;
const int BME_MISO = 4;
const int BME_MOSI = 7;
const int BME_CS = 5;

Adafruit_BME280 bme280(BME_CS, BME_MOSI, BME_MISO, BME_SCK);

Adafruit_BMP085 bmp180;
 
const int LM35sensorPin = A0; 
float LM35sensorValue;
float LM35voltageOut;
float LM35temperature;

const int chipSelectSDCard = 53; 
File myFile;

void setup() {
  Serial.begin(9600);

  dht11.begin();
  delay(2000);
  dht22.begin();

  ds18b20.begin();

  bme280.begin();

  bmp180.begin();
 
  pinMode(LM35sensorPin, INPUT);

  if(!SD.begin(chipSelectSDCard)) {
    Serial.println("SD card initialization failed!");
    return;
  }
  Serial.println("SD card initialization done.");
  
  myFile=SD.open("DATA.txt", FILE_WRITE);
  if (myFile) {
    Serial.println("File opened ok");
    // print the headings for our data
    myFile.println("DHT11,DHT22,DS18B20-1,DS18B20-2,BME280,BMP180,LM35");
  }
  myFile.close();  
}

void loop() {

  /*-------------------------------------------------------*/
  //DHT11
  DHT11temperature = dht11.readTemperature();
  if (isnan(DHT11temperature)) {
    Serial.println("Failed to read from DHT11 sensor!");
    return;
  }
  Serial.print("Temperature DHT11(ºC): ");
  Serial.println(DHT11temperature);
  
  /*-------------------------------------------------------*/
  //DHT22  
  DHT22temperature = dht22.readTemperature();
  if (isnan(DHT22temperature)) {
    Serial.println("Failed to read from DHT22 sensor!");
    return;
  }
  Serial.print("Temperature DHT22(ºC): ");
  Serial.println(DHT22temperature);

/*-------------------------------------------------*/  
  //DS18B20
  ds18b20.requestTemperatures();  
  DS18B20temperature1 = ds18b20.getTempCByIndex(0);
  DS18B20temperature2 = ds18b20.getTempCByIndex(1);

  Serial.print("Temperature DS18B20-1(ºC): ");
  Serial.println(DS18B20temperature1);
  
  Serial.print("Temperature DS18B20-2(ºC): ");
  Serial.println(DS18B20temperature2);

/*-------------------------------------------------*/
//BME280

  Serial.print("Temperature BME280(ºC): ");
  Serial.println(bme280.readTemperature());

/*-------------------------------------------------*/
//BMP180
  Serial.print("Temperature BMP180(ºC): ");
  Serial.println(bmp180.readTemperature());

/*-------------------------------------------------*/ 
  //LM35 SENSOR
  LM35sensorValue = analogRead(LM35sensorPin);
  LM35voltageOut = (LM35sensorValue * 5000) / 1024;
  
  // calculate temperature for LM35 (LM35DZ)
  LM35temperature = LM35voltageOut / 10;

  Serial.print("Temperature LM35(ºC): ");
  Serial.println(LM35temperature);

  Serial.println("");

  myFile = SD.open("DATA.txt", FILE_WRITE);
  if (myFile) {
    Serial.println("File open with success");
    myFile.print(DHT11temperature);
    myFile.print(",");
    myFile.print(DHT22temperature);
    myFile.print(",");
    myFile.print(DS18B20temperature1);
    myFile.print(",");
    myFile.print(DS18B20temperature2);
    myFile.print(",");
    myFile.print(bme280.readTemperature());
    myFile.print(",");
    myFile.print(bmp180.readTemperature());
    myFile.print(",");
    myFile.print(LM35temperature);
    myFile.println(",");
  }
  myFile.close();
  
  delay(6000);
}

View raw code

Note: in order to compile and run this code, you must install in your Arduino IDE all sensor libraries mentioned in the comparison table at the beginning of this article.

Results: Comparing Temperature Readings

After approximately 36 hours, we removed the microSD card and copied the results to a spreadsheet. We’ve plotted all readings to better compare the measurements from the different temperature sensors.

Results in Celsius degrees Temperature Sensors DHT11 DHT22 LM35 DS18B20 BME280 BMP180 with Arduino
Temperature in Celsius degrees (ºC)
Results in Fahrenheit degrees Temperature Sensors DHT11 DHT22 LM35 DS18B20 BME280 BMP180 with Arduino
Temperature in Fahrenheit degrees (ºF)

This chart doesn’t have a control group (we didn’t use a calibrated temperature sensor), but we have an idea on how these sensors behave.

If you take a closer look at the charts, the BME280 measured slightly higher values than the other temperature sensors. This behavior is normal, and this is described in the datasheet. The module self-heats a little bit and the temperature measurements can be 1 ou 2 degrees above the real temperature value.

However, the BME280 is also the temperature sensor that gave more stable temperature readings without many oscillations between readings. This has to do with the resolution of the sensor. It can detect changes up to 0.01ºC.

In case of the DS18B20 temperature sensors, we can see some oscillations between readings and it’s also noticeable that the resolution is not as good as the BME280. Additionally, the DS18B20 temperature sensor was the only one to give some “null” readings throughout the experiment. We’ve measured two DS18B20 temperature sensors in the same data line and one of the sensors failed to read the temperature 6 times throughout the experiment (during 36 hours).

The DHT22 and the BMP180 behave very similarly with little oscillations. The DHT11 couldn’t detect small temperature changes, because its resolution is of 1ºC.

Finally, the LM35 temperature sensor detected changes in temperature between 24ºC and 26ºC but with lots of oscillations between measurements.

This chart comparing the different temperature sensors clearly shows how each sensor differs from the others. It is easier to understand how they work and if they will be suitable for the projects you want to build.

Wrapping Up

In this article we’ve compared several temperature sensors that you can use with the ESP32, ESP8266, Arduino and other development boards. These sensors all measure temperature but they behave differently when put to the test in the same environment at the same time.

We hope you’ve found this article useful and that it helps you pick the best temperature sensor for your project requirements.

You might also like reading:

If there’s any other sensor that you’d like to see in this comparison, post a comment below.

Thanks for reading.


Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »

Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »


Enjoyed this project? Stay updated by subscribing our weekly newsletter!

45 thoughts on “DHT11 vs DHT22 vs LM35 vs DS18B20 vs BME280 vs BMP180”

  1. How is it possible to leave the MAX31865 RTD Amplifier and MAX31855 Thermocouple Amplifier boards out of a comparisons of temperature sensors story? These two boards are the only ones that are capable of reaching high temperatures with outstanding accuracy.

    • Could it possibly be because they are not temperature “sensors”? They are, as you have stated, “amplifier boards” which require the use of an external sensor (a Pt Resistance device or thermocouple).
      I think the article is a useful comparison of the accuracy and resolution of devices which can be used over a similar temperature range. Thank you, Rui!

      • Rui,

        Thanks for responding so quickly.

        I am absolutely too new to the Arduino world to engage in a detailed discussion about sensor versus amplifier boards like the Max31865 and Max31855 series from Maxim but just because the sensor (RTD or Thermocouple) is external rather than onboard loke the ones in the comparisons is kind of beside the point. The usefulness of a “high temperature measuring device” such as Maxim’s surely will gain traction if these devices can get the attention of smart guys like yourself, Sara and Rui.

    • Hi Carl.
      Thank you for your suggestion.
      We’ve compared some of the most widely used temperature sensors within the Arduino community and we tested the temperature sensors that we have in our lab.
      We need to get one of those sensors and see how it behaves and compare it with other temperature sensors.
      If there is enough interest, we can also publish some guides on how to use that sensor.

      Regards,
      Sara

  2. Thanks for comparison sensors on various temperature. I do always correct Bme280 ca 2grades Celsius down to get good measure.
    Maybe another article about humidity sensors?

    • Hi Jan.
      Thank you for your comment.
      If there is enough interest on that subject we might be able to make an article about that.
      Regards,
      Sara

  3. I didn’t search in the manuals but I remember a quite higher resolution for DS18B20 possibly 1/8 degree?
    There are different layouts for BME280 breakouts with different positions for resistors and so on? I didn’t remember great differences while testing some of the above temperature sensors.
    Please could you test again with air movement? eg. by a computer fan.
    I will use an metereoligic housing with an added small 5v fan.

  4. You are cleraly only using 9bit resolution on the Dallas 18b20 sensors as you can see from the roughly 0.5°C steps in the readouts.
    Try setting the resolution to 12bit (it is never good to trust in default settings …)

    BR, Jörg.

  5. Hi Rui,
    thank you so much for this excellent tutorial and comparison of very common temperature/humidity sensors. It was really enlightening for me!
    I’m also experimenting with bme280 with its fascinating resolution and accuracy compared with more expensive, semi-pro measuring instruments.
    Considering the price and its capabilities, I’m wondering why to use sensors like DHT22 instead of bme280 any more?
    Cheers, Bjoern.

    • Hi.
      Thank you for your comment.
      Yes, I also prefer the BME280 sensor.
      But for education purposes, using other sensors is a great way to learn how to work with different communication protocols and different libraries.
      Regards,
      Sara

  6. The TMP36 was also left out of the comparisons.
    Unstable sensor. Always take 10 readings and average.
    I think these sensors were chosen because they are quite common in the Arduino community.
    The DHT11 is cheap and ok for testing and education. The humidity sensor in the DHT11 slowly starts showing incorrect values and finally stops working after 2-3-4 years.
    When you buy BME280 from Ebay you most likely get a BMP280.
    The Chinese can’t tell the difference probably. Ask the seller for confirmation before buying. Some of my real BME280 have 4 pins and are purple in colour. The I2C address is 0x76 for both.Default is 0x77 in the library which must be changed. They have usually pull up resistors on the breakout module. Use an I2C scanner if in doubt.

    • Thanks. An excellent comparison, and a load of work put in. I think the main conclusions are:
      1, you get what you pay for
      2, it pays to calibrate against a mercury thermometer, especially if you are using a BME280.

      I believe reducing the read frequency on the BME280 reduces the self heating effect. May be worth an experiment on its own right.

    • Dear Ola Dunk,

      Thanks for your kindness to share this very useful information. What is the real difference between BME280 and BMP280 ??

      Thanks, Ola. Thanks! A hug coming your way 🙂

      • BME280 can measure humidity too.
        Very useful for home made weather station on Arduino,ESP8266,ESP32 or Raspberry Pi. There are many working examples on the net.
        The BME280 temp sensor is a bit inaccurate. Calibrate and compare using a mercury thermometer like used in chemistry. Also keep it 10-15 cm away from the microprocessor. It may pick up some heat.
        Don’t pay $US 20 this board. You will find it cheaper.

    • Hi Ola.
      Thank you for sharing your opinion.
      Yes, we chose these temperature sensors because these are very common in the Arduino community, so it made sense comparing these temperature sensors.
      Next time, we can experiment with the TMP36 too.
      Regards,
      Sara

  7. It would have made a lot of sense comparing the sensors with a calibrated source. It leaves a very subjective result as an outcome. Yes, a number of other factors come into the reckoning and I understand that this was not an experiment under lab conditions but it would have presented a more credible test and given users a better indication of which is the preferred sensor.

    • Dear Alan,

      What I get out of this excellent article is that we are left, ourselves to conclude. That is in my opinion greater science than recommending something. Now – this is “randomnerdtutorials” and not a science magazine, however, I applaud the author’s phenomenal sense of creating value for us readers.

      SIncerely
      David Svarrer

    • Hi Alan.
      You are absolutely right.
      We should have compared with a calibrated temperature sensor so we can see which sensor gives better results (closer to the real temperature value).
      This was just a simple experiment to see how the sensors behave. Next time, we should definitely take that into account.
      Thank you for your comment.
      Regards,
      Sara

  8. Excellent article.

    There is a detail I do not get. The expensive and praised sensors, are delivering very rough outputs – in jumps of full or double degrees at a time, while the cheap ones, are delivering almost smooth (analog like) output?

  9. Since the LM35 outputs a linear voltage signal, I would think that the oscillations shown for the LM35 sensor are likely a result of the Arduino AnalogRead() function. Simply averaging the readings will smooth that out.

  10. I would love to see a ground-truth comparison (for accuracy) and reliability comparison — I’ve once bought multiple quantities of the same sensors (eg. DHT22) and each one would give a different reading despite all being under the same conditions. So, again, reliability and accuracy are equally important factors when deciding which sensor to use.

  11. Fron datasheet on ds18b20..

    The resolution of the
    temperature sensor is user-configurable to 9, 10, 11, or 12 bits, corresponding to increments of 0.5°C,
    0.25°C, 0.125°C, and 0.0625°C, respectively.

    you seem to run it 8 bit mode..

    • Hi.
      You’re right.
      The datasheet says it runs on 12 bit, by default. So, I just run the code.
      Only after collecting the data, I realized that it didn’t run on 12 bit.
      Probably I should set the resolution in the code so it runs on 12 bit.
      Thanks for noticing.
      Regards,
      Sara

      • 9 bit it should say.. 🙂 i think the library you use, defaults at 9 bits, if not defined. the sensor itself should use 12 bits as default. but that default can also be changed in eeprom in sensor if digging a bit deeper.

  12. One thing I’ve found is a bit of forced airflow helps these sensors a lot. As you say the BME self heat, but IMHO they all do to a greater or lesser degree and having moving air tends to ameliorate this a little. The +/- 0.5c readings also give you things like your two DS sensors being so far spread from each other, although in their case it looks more like sensor calibration…

  13. Nice comparison, Rui! How about a comparison of the barometric pressure and humidity from different sensors. Like a comparison of these stats from AliExpress and other sources? Thanks! Nice work!

    • Thank you.
      Maybe in the future, if there is enough interest about these subjects, we might write an article about that.
      Regards,
      Sara

  14. The temperature range selected for the comparison is VERY narrow and for many real user cases the results are – sorry to say – absolutely useless. There are cases where one should be able to trust the sensor in temperatures close to the freezing point or at a higher end (say 50-100 centigrade).

  15. The problem with LM35 is also that it has a resolution from 10mv/°C.
    This gives a pretty problem when using directly at an analog input with Arduino: at 20°C it gives 200mV, that is 40 as a result in analogRead.

    This can be solved by using analogReference. Since I mostly use Mega256, I set it a Internal1V1.
    Another possibility, if you use more analog ports, is to amplify the signal before putting it to an analog port.
    I once did an instructable about it: https://www.instructables.com/id/Arduino-and-Floating-Data/

  16. Great, using two DS18B20 at a time.

    I wonder why the temperature difference between both is 2°C.
    If the accuracy is +/- 0.5 °C I would have expected a maximum difference of 1°C, and likely less than 1°C because chance should be low to get two components with its tolerance at its upper resp. lower limit.

  17. An interesting test for beginners. however, I think the results were influenced by the breadboard test set up, these cheap breadboards are notorious for bad connections and were, I suspect, the cause of noise spikes. I have used the waterproof versions of the DS18B20 for years and not experienced the spikes you had. There are occasions when a DS18B20 can out put an erroneous -127 but that is easily eliminated in code.
    I ran a test using the following sensors DS18B20, BME280, SHT21, SHT35, HDC1010, DHT22 and a SHT30 on a Wemos shield. The latter is utterly useless due to the heat from the ESP8266 beneath the shield. The SHT35 was used as an accurate reference for temperature and humidity and was purchased from ‘Closed Cube’ a reputable UK source, not cheap however!
    For the test all sensors were suspended in free air away from any direct heat source. All were connected using DuPont wires to a soldered ESP8266 test rig.
    I used MeguLink Pro to collect and analyse the data both filtered and raw. This is an excellent and cheap package for collecting / storing / analyzing data. I send the data to the package running on a PC via UDP WiFi.
    My conclusions were that for measuring temperature the encapsulated 18B20 are very reliable and good value for money, although all the tested sensors were within 1°C of each other. For measuring both temperature and humidity the BME280 is the best choice for accuracy and reliability.
    THE SHT21 (HTU21) performed well in my tests but other samples failed when I tried to deploy them in a project. The DHT22 is reasonable on temperature measurement but wildly inaccurate on humidity.
    There are many sensors that one can throw into the mix as others have noted and would make for interesting further comparisons. Again, as others have noted, any sensor used as a reference should be purchased from a reliable source that states it is a genuine original part.

    • Hi Bob.
      Thank you for sharing your study about these temperature sensors.
      It’s always good to share the things we learn from our own experiments.
      I agree with you, that the DHT22 is not the best when it comes to humidity measurements. I think it could be a good idea comparing humidity sensors and see how they behave.
      This was just a simple experiment to compare some temperature sensors. I wasn’t expecting our readers would be so interested in these subjects (I’m glad they do). So, we’ll probably write more articles with other similar experiments.
      Regards,
      Sara

  18. Hi Sara,
    may I add this information. Above you can read “the BME280 has a wider measurement range: -40 to 85ºC, while the BMP180 just measures from 0 to 65ºC”.
    The BMP operates also from -40 to 85°C see datasheets and with full accuracy from 0 to 65ºC for both.
    I’m interested in the temperature shift of your BME280.
    Did you some testing with I²C also?
    Could the use of sleep mode alter the behavior? someone could check the libraries…
    I own also HTU21D, BMP280 and BME680 temperature sensors.
    Regards,
    Peter

  19. You should really consider including the SHT31 sensor:
    sensirion.com/en/environmental-sensors/humidity-sensors/digital-humidity-sensors-for-various-applications/
    Very accurate sensor on both temperature and humidity readings

  20. Are there any “longer” sensors than the DS18B20? I have many projects where we need two sensors from one micro controller but the distances are greater than the maximum lengths of the DS18B20. I have had to use two micro controllers for these installations but would love to just use one.

  21. This is a good comparison and also explaination about the different connection types from analog to 1-wire and I2C.
    I would also like to have a ground truth, since I always experienced 1 to 2 degrees C measurements with DS18B20 compared to several analog and digital thermometers. So I always add a correction factor in my code.
    And +1 for a comparison of humidity detectors.

  22. Thank you very much for the enlightening experiment. I too would like to see the results of a 12 bit output from the 18B20 devices. I’m not very concerned with the absolute accuracy of the device as my applications are personal and I can always calibrate any that I use. My main concern is repeatability so any calibration I apply remains accurate.
    Another think i might suggest is to average the readings in a 5 minute period by taking a reading every few seconds and reporting the average at 5 minute intervals. That may smooth out some of the graphs. My experience with the 18B20 devices (4 of them so far) is that they all read about 1-2 °C low. I have a lab quality mercury thermometer for comparison. My Meade wall thermometer also seems fairly accurate which supprises me.

  23. Hi Sara,
    Great website and tutorials. I have made a weather station based on a BME280, this generates graphical data in real time on a 5″ TFT display. The biggest problem for the project is generating accurate measurements from the BME280. I have two Mikroelectronica Weather click boards with BME280, each produces different results with the same code and same location. I also bought from Amazon 5 x BME280 breakout boards, all of these boards generate different measurements. In general from the 7 x BME280 I have, the temperature readings are always high, the air pressure is always low and the humidity always low.
    The easiest calibration is for temperature, so to calibrate it should be possible for each BME280 to add a measured offset. As humidity and air pressure are difficult to calibrate, it might be possible to use the temperature offset and scale this in some way to generate humidity and air pressure offsets for each BME280.
    The BME280 is low cost and useful sensor, an article showing how to easily calibrate the three measurements, would help make it the de-facto sensor to use in projects.
    Regards
    Michael

  24. Hi Sara,
    thank you for this comparison. No doubt it was a great thing.

    When you collected the values and realized the resolution problems etc., why didn’t you just fixed that and did the experiment again? There was a lot of work with presenting the values, evaluating, publishing not mentioning answering the questions. All of it, with wrong collected data. The corrected experiment would save you all this.

    I wish you (and Rui) all the best in your continued work.
    Tony.

Leave a Comment

Download our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.