DHT11 returns the temperature with one decimal?

Hi everyone,

I am currently using a DHT11 sensor with the Adafruit library ( GitHub - adafruit/DHT-sensor-library: Arduino library for DHT11, DHT22, etc Temperature & Humidity Sensors ) and when I upload the example code for DHT11 to my ESP8266, I see in the serial monitor that the temperature contains decimals. However, I see everywhere on the internet, especially on some websites, on forums and in other libraries that DHT11 has a temperature resolution of 1°C and no 0.1°C, and with an accuracy of ±2°C (I agree on this last point). So I asked myself, if there was no error in the code.

So I took the DHT11 datasheet to find out if it could return a temperature with decimals. ( https://akizukidenshi.com/download/ds/aosong/DHT11.pdf )
There is no mention on any decimals except on the last byte (the checksum byte): (PDF page 5)

Parity bit data definition

“8bit humidity integer data + 8bit humidity decimal data +8 bit temperature integer data + 8bit temperature fractional data”8bit checksum is equal to the results of the last eight.

The datasheet also specifies that the temperature resolution is 16 bits (2 bytes). (PDF page 3).

So, I wanted to check myself if the DHT11 returns decimals. I took my oscilloscope and analyzed a DHT11 packet according to the datasheet:

Which verifies the serial data (last line):

So... The 4th byte returns data, interpreted by the library and basically showed by the datasheet as the first temperature decimal. Even if the accuracy is ±2°C, having a decimal makes it possible to better delimit the value of the actual temperature.

To wrap it up with this experience, can we say that DHT11 returns one decimal contrary to what everyone is saying? Do you have any information to add to these remarks?

Thanks in advance.

When you look at the datasheet page 2 section 5 Product parameters

Temperature
Resolution: 16Bit
Repeatability: +-0.2°C
Range: At 25°C +-2°C

it’s clear that the sensor has a resolution of smaller than 1°C, otherwise it could not have a repeatability of +-0.2°C. Meaning the sensor might only be accurate within +-2°C but if you measure the under the same condition multiple times the result will be within +- 0.2°C.

So... The 4th byte returns data, interpreted by the library and basically showed by the datasheet as the first temperature decimal. Even if the accuracy is ±2°C, having a decimal makes it possible to better delimit the value of the actual temperature.

The sensor has a resolution of 16bits where 8bits are used for the fractional part (so the resolution is about 0.04°C). As the accuracy is +/- 2°C (which is a range of 4°C!) most libraries don't output the fractional part of the measurement as it leads to unsatisfiable expectations. As the repeatability is much better (0.2°C) you might get more usable results if you calibrate the sensor yourself and include the measurement error in your code.

But always keep in mind you don't get a better value by using this fractional part as the accuracy is not increased by reading out these bits. If you need more accuracy, use a better sensor.

I was under the impression, that you couldn't get decimal figures with a DHT11 but my code is far from advanced. This is the reason I switched to the DHT22, with success.