Arduino peripherals guide series
How accurate are thermometer sensors?
Is the temperature reading from your sensors close to being real? What is real temperature? What are some of the main considerations?
The manufacturer publishes accuracy information on the datasheet, and they often look impressive. But when you use these sensors in "real life", their measurements often seem substantially different to the actual temperature. The actual temperature can be given by another thermometer that you trust, or by a calibrated reference thermometer.
Which of the aforementioned sensors is "better"?
Here are a few things to remember when you use them.
Comparing temperature sensors
It may sound weird, but comparing these devices is like comparing oranges and apples (and lemons). They are all fruit, but they are different.
In the case of these thermometer modules, they are all able to measure *a* temperature. This temperature will only be moderately accurate within a short-range compared to a reference (i.e., "true") temperature.
The two common digital modules (DHT22 and BME280) are calibrated in the factory but are made with different tolerances, accuracy, and materials.
Have a look at the DHT22 datasheet.
It's operating temperature is -40 to 80 Celsius, but you can assume that its stated accuracy of 0.5C is only achieved around the middle of this range. Still, this accuracy is measured in a lab with controlled conditions. Parameters such as air currents, humidity, exposure to sunlight, the age of the device itself are within specific ranges. The stated accuracy for this sensor will be different when you use it in any other conditions.
The BME280 is a more professional sensor (and expensive) in the sense that although it is factory calibrated, it provides a way for the user to custom-calibrate it for the given application and conditions; this provides a way to adjust the sensor. If you plan to use it in warm, humid climates, for example, you can take temperature and humidity with a reference instrument, or use a calibration chamber to calibrate the offset of the BMP180 so that it matches the reference. Here is an excellent article on the calibration topic.
Once the BME280 is calibrated, you can expect a typical temperature accuracy of ±1.0°C. The datasheet (look at page 12) becomes as bad as ±1.25°C for temperatures towards the edges of its useful range. It gets even worse (±1.5°C) towards the edges of its operating range of -40°C to -60°C.
The TMP36 is a linear analog sensor. It gives you a voltage that is linearly proportional to the temperature it senses. Although its stated accuracy is ±2°C (see first page of the datasheet), on top of this and everything else discussed above, a lot depends on the conversion formula you use.
To get the temperature from the TMP36, you have to convert the charts in Figure 5, page 5, of the datasheet into a formula (I have copied the charts below).
The temperature you get from the sensor depends on how well your calculation formula matches the line, and how accurate your microcontroller can measure the voltage from the sensor. As you can see from the chart, the line is mostly straight and flat for temperatures that we are likely to encounter in a regular application (between 5°C and 90°C). Other issues to consider (and perhaps include in your calculation) are the heat produced by other parts of your circuit, and even accurate the calculation is performed on the microcontroller..
From all this, you can see that there are significant differences between these sensors, which result in the differences that we see when we take measurements with one next to the other.
Without a good reference or at least trusted thermometer, you can't be sure how close either of the mentioned sensors are to the true temperature.
If the true temperature is what you want, you can't depend on subjective observation, like "it feels like 25C, but the sensor says 21C" because you just can't trust yourself for things like this. You'll have to get into the details of how the sensor works, and how to calibrate it or compensate its readings.
"Arduino Peripherals" series
Jump to another article
2. Basics of the TimerOne library
3. How to find device I2C address
4. Getting started with I2C on the Arduino
5. Using I2C: True digital to analog conversion on the Arduino Uno
6. How accurate are thermometer sensors?
7. MCP9808: an accurate thermometer module for your Arduino
8. Getting useful motion data from the MPU-6050 device
9. What to do with unused pins on an Atmega328P or Attiny85?
New to the Arduino?
Arduino Step by Step Getting Started is our most popular course for beginners.
This course is packed with high-quality video, mini-projects, and everything you need to learn Arduino from the ground up. We'll help you get started and at every step with top-notch instruction and our super-helpful course discussion space.
Done with the basics? Looking for more advanced topics?
Arduino Step by Step Getting Serious is our comprehensive Arduino course for people ready to go to the next level.
Learn about Wifi, BLE and radio, motors (servo, DC and stepper motors with various controllers), LCD, OLED and TFT screens with buttons and touch interfaces, control large loads like relays and lights, and much much MUCH more.