
Originally Posted by
HenrikOlsson
Anyway, if you want to use the DHT11 instead of the DS18B20 what you want to do is make sure to scale the raw value so that they both give you the same value at a certain temperature. They might already DO that but you need to verify it. In the DS18B20 code your raw value seems to be the TempC variable while in the DHT11 code it's the temp variable.
At a known temperature (roughly) run the 18B20 code and output the TempC variable on the LCD. What does it say? Something like 225 for 22.5 degrees?
At the same temperature (roughly) run the DHT11 code and output the Temp variable on the LCD. What does it say? Something like 220 for 22.5 degrees? Or something else?
/Henrik.
Hi Henrik,
I've merged the two sections of code for some crude testing (I'll try you refined version for the DTH sensor later). Yes you are correct in that the DS18B20 results are stored in the variable TempC and the result is a three digit value as you summarized - ie 234 would be 23.4 degreed C. The DHT does the same, but the value for the result is in double figures - I've changed the variable for the result of reading the DHT to TempB.
Reading the values from the LCD using
Code:
lcdout $FE,$C0,#tempb," ",#tempc
I'm getting 19 for tempb (DTH sensor) and 205 (18B20 sensor) for tempc. I'm guessing that the DS18B20 is more accurate given the two sensors are side by side. I'm guessing if I multiply tempb by ten this should then in theory work - which it did.
I'll play about with the code, but at least I've now got something to work with
Bookmarks