DHT11 not decimal values?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
freijn
Normal user
Posts: 29
Joined: 28 Jan 2017, 17:48

DHT11 not decimal values?

#1 Post by freijn » 04 Feb 2017, 12:22

I have been searching the internet and this forum but can't find the answer.

My DHT11 is only showning temperature in full degree's nothing in decimals. So only 20 21 22.
Is the sensor not sending it ? Like 19.5 ?
Or have I done something wrong.
In the ESP it does have decimals 2 defined.

many thanks for your help !

Frank

Ton_vN
Normal user
Posts: 300
Joined: 21 Oct 2016, 15:20
Location: Hengelo (Ov)/ NL
Contact:

Re: DHT11 not decimal values?

#2 Post by Ton_vN » 11 Feb 2017, 14:51

My DHT11 is only showning temperature in full degree's nothing in decimals.
Where are you looking?

Assuming that DHT22 is treated same as DHT11, I see in ESPEasy the DHT-values with 2 decimals, and in Domoticz the Temperature-value with 1 decimal, and the Humidity-value without decimal (but who cares about the latter?)

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: DHT11 not decimal values?

#3 Post by papperone » 18 Feb 2017, 17:55

DHT11 has this limit, it can read temperature and humidity only by integer value.
If you need better precision up to 0.1° then use DHT22 which is more advanced and expensive of course.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

svde
New user
Posts: 8
Joined: 07 Aug 2018, 19:35

Re: DHT11 not decimal values?

#4 Post by svde » 29 Oct 2018, 16:19

My usecase requires 2 decimals. The DHT22 on my ESP shows 2 decimals, but the second decimal is always "0". I also have a luftdaten sensor which has a BME280 and DHT22 attached, I see that the BME280 on the luftdaten sensor does have 2 decimal values (the DHT22 connected to the lufdaten also only shows "0" as the second decimal). My question: does a BME280 support 2 decimals with esp easy?

HomeJCL
Normal user
Posts: 89
Joined: 03 Feb 2018, 10:42

Re: DHT11 not decimal values?

#5 Post by HomeJCL » 29 Oct 2018, 20:34

BME280 shows something with 2 digits, but when I compare to a calibrated Pt100, I don’t even think the 2 decimals are ... worthy to be used :roll:

98710533: BME280: dew point 1.74C
98710545: BME280 : Address: 0x76
98710545: BME280 : Temperature: 6.36
98710546: BME280 : Humidity: 72.58
98710546: BME280 : Barometric Pressure: 999.12
Belgium and land of ESP ... counting :D

svde
New user
Posts: 8
Joined: 07 Aug 2018, 19:35

Re: DHT11 not decimal values?

#6 Post by svde » 30 Oct 2018, 10:39

HomeJCL wrote: 29 Oct 2018, 20:34 BME280 shows something with 2 digits, but when I compare to a calibrated Pt100, I don’t even think the 2 decimals are ... worthy to be used :roll:

98710545: BME280 : Temperature: 6.36
Perfect. Thanks!

I have a use case which involves making predictions based on temperature delta's between 20 minutes ago and now. One decimal resolution is insufficient to make it work reliably.

j-ghost
New user
Posts: 7
Joined: 14 Feb 2019, 20:57

Re: DHT11 not decimal values?

#7 Post by j-ghost » 14 Feb 2019, 21:15

Hi there,

thanks to the support of Gijs and Grovkiller I now have some basic sliding average filter implemented.

Looks like:

On Temperature#Value Do
Let,2,[VAR#1]*4
Let,1,[Temperature#Value]
TaskValueSet,12,1,([VAR#1]+[VAR#2])/5
EndOn

Now, as I understand, the DHT11 only gives integers as a value. And esp easy sends it to domoticz as a floatingpoint with 2 digits after the dot. True?
So, is it because the numbers are integers, an inbetween value cannot be calculated? ( i was hoping it did, to have also have values like 17.35 or so)
Of course I understand it has nothing to do with accuracy, but i just like smooth lines:)

Is there a solution to that?

Jan

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: DHT11 not decimal values?

#8 Post by grovkillen » 14 Feb 2019, 21:57

You can set your decimals on that dummy value. Given that you have a filter you still get decimals even if the dht only deliver integers.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

j-ghost
New user
Posts: 7
Joined: 14 Feb 2019, 20:57

Re: DHT11 not decimal values?

#9 Post by j-ghost » 14 Feb 2019, 22:23

Dear grovkillen,

maybe my learning curve is not so steep...?

I expected to have decimals with the filter. But I don's see it.
Maybe is mis the point on "you can set your decimals on that dummy value" ?

A hint for me?

best regards!

Jan

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: DHT11 not decimal values?

#10 Post by grovkillen » 14 Feb 2019, 22:35

In the task settings for your dummy device, what number of decimals do you have set?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

j-ghost
New user
Posts: 7
Joined: 14 Feb 2019, 20:57

Re: DHT11 not decimal values?

#11 Post by j-ghost » 14 Feb 2019, 22:41

I dont understand dummy device. have a dht11 connected, rules as suggested, always xx.00 degrees.
Attachments
Knipsel.PNG
Knipsel.PNG (45.3 KiB) Viewed 16489 times
Last edited by j-ghost on 14 Feb 2019, 22:45, edited 1 time in total.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: DHT11 not decimal values?

#12 Post by grovkillen » 14 Feb 2019, 22:45

Ok, so you have the dht on task number 12? Our suggestion was to use a separate device called dummy device. The DHT should only add it's values not be the one publishing them. So that last line where we use the TaskValueSet we should point it to a dummy device, not back to the DHT device.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

j-ghost
New user
Posts: 7
Joined: 14 Feb 2019, 20:57

Re: DHT11 not decimal values?

#13 Post by j-ghost » 14 Feb 2019, 22:50

added a picture in prev post, can do dht on task number 1 or put sensor on different row (12)

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: DHT11 not decimal values?

#14 Post by grovkillen » 14 Feb 2019, 22:56

Code: Select all

On DHT11#Temperature Do
Let,2,[VAR#1]*4
Let,1,[DHT11#Temperature]
TaskValueSet,2,1,([VAR#1]+[VAR#2])/5
EndOn
Only change is to set the TaskValueSet to 2 instead of 12.

You should see that value being populated with values once you have updated the rule.

Also your device names in the rules need to match your device names
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

j-ghost
New user
Posts: 7
Joined: 14 Feb 2019, 20:57

Re: DHT11 not decimal values?

#15 Post by j-ghost » 14 Feb 2019, 23:08

No changes,

VAR#1 and 2 , do i need to change that to DHT11#Temperature ?
WHere does VAR#2 come from?

(sorry for the apparently 'i should know' questions)
Attachments
Knipsel.PNG
Knipsel.PNG (11.11 KiB) Viewed 16469 times

j-ghost
New user
Posts: 7
Joined: 14 Feb 2019, 20:57

Re: DHT11 not decimal values?

#16 Post by j-ghost » 14 Feb 2019, 23:13

On Temperature#Value Do
Let,2,[dummydev#Dtemp]*4
Let,1,[DHT11#Temperature]
TaskValueSet,2,1,([DHT11#Temperature]+[dummydev#Dtemp])/5
EndOn

with:
Attachments
Knipsel.PNG
Knipsel.PNG (19.39 KiB) Viewed 16466 times

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: DHT11 not decimal values?

#17 Post by grovkillen » 14 Feb 2019, 23:29

Copy and paste my code, it'll work. Please study your code and you'll see that you're not using the correct event trigger.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

j-ghost
New user
Posts: 7
Joined: 14 Feb 2019, 20:57

Re: DHT11 not decimal values?

#18 Post by j-ghost » 14 Feb 2019, 23:42

Thanks for you patience,

modifying to much at the same time...your code works,
but still have difficulty understanding the syntax a bit.
Can i modify var#2 to dummydev#Dtemp or does that not make sense? or is 2 here not a variable but a location?



On DHT11#Temperature Do
Let,2,[VAR#1]*4
Let,1,[DHT11#Temperature]
TaskValueSet,2,1,([VAR#1]+[VAR#2])/5
Let,4,[VAR#3]*4
Let,3,[DHT11#Humidity]
TaskValueSet,2,2,([VAR#3]+[VAR#4])/5
EndOn

GReets

Jan

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: DHT11 not decimal values?

#19 Post by grovkillen » 15 Feb 2019, 05:39

You set the internal variables by the use of the Let command, these variables are "stored" under the name VAR followed by the variable number. You need to use at least one of them variables but my idea was to use two to not confused too much. You would otherwise need to set the variable after the filter...

In short, use the VAR#n syntax.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests