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 -
Best VOC sensor for detecting a wide range of VOC's?
Hardware • 26 Oct 2023, 23:59 • NeverDie 18 Nov 2023, 01:41 -
Does MySensors require Arduino Timer 2?
Hardware • 6 Jan 2024, 19:39 • OldSurferDude 11 Jan 2024, 04:39 -
Newbie questions
Hardware • 14 Feb 2025, 20:03 • magwas 14 Feb 2025, 20:03 -
Arduino Nano Every problem
Hardware • 1 Feb 2020, 09:18 • hakha4 5 Dec 2023, 02:21 -
"Remote Irrigation with LoRaWAN: LM27313 Challenges and PCB Design"
Hardware • 24 Jan 2024, 23:06 • wrendral 3 Feb 2024, 07:13