DHT 11 can report decimals?
-
I'm running several sketches. DHT22 reports just fine values like xx.xx
But DHT11 reports 0 decimals. So it is always like xx.00
Is that standart for dht11?
-
According to the data sheet, the accuracy of DHT11 is ±2℃. So reporting with decimals doesn't make sense. If the sensor is reporting 22 degrees the temperature might be anywhere between 20 and 24.
The accuracy of the DHT22 (again, from datasheet) is ±0.2C. So for the DHT22 it makes sense to report one decimal, but be aware that if the sensor reports 22.4 degrees the real temperature can be anywhere between 22.2 and 22.6.
See also http://forum.mysensors.org/topic/2686/improve-ds18b20-resolution
-
@moskovskiy82 if it's allways reporting x.0 than you store the result of the reading in a double of long. If you want to get rid of the decimals. You only have to cast the value to an int. This will truncate the value.
long x = 2.3;
Serial.println( (int)x );
will result in 2
Suggested Topics
-
Over the air updates
General Discussion • 23 Mar 2014, 21:38 • ToSa 1 Mar 2015, 11:21 -
hlk-pm01 are to noisy for rfm69?
Hardware • 5 Aug 2023, 21:16 • Tmaster 9 Aug 2023, 16:28 -
Sleep mode for bmp280
Hardware • 20 Feb 2018, 13:24 • fishermans 5 Feb 2024, 18:30 -
Best time of year to buy higher quality small project solar panels?
Hardware • 10 Jun 2021, 19:19 • NeverDie 30 Aug 2024, 14:01 -
Best VOC sensor for detecting a wide range of VOC's?
Hardware • 26 Oct 2023, 23:59 • NeverDie 18 Nov 2023, 01:41 -
Newbie questions
Hardware • 14 Feb 2025, 20:03 • magwas 14 Feb 2025, 20:03