- Tue Jul 28, 2015 3:06 am
#24446
jankop wrote:Test it!
1. Is your sensor really connected to GPIO2 ?
2. Is sensor properly connected to ground?
3. Is your terminals wiring okay?
Save test program wots.lua and modul testdht.lua
Load it to esp8266 and run wots.lua.
Bring result.
Then we can talk of an additional cases.
This is proper communication with DHT11. DHT22 is very similar.
Code: Select alldofile("wots.lua")
checksum 58
checksumTest 58
humidity - timing of bits 0 1 5 1 1 5 1 4 1 1 1 1 1 1 1 1
temperat - timing of bits 1 1 1 5 1 5 1 4 1 1 1 1 1 1 1 1
checksum - timing of bits 1 1 5 5 5 1 5 1
Humidity: 37%
Temperature: 21 deg C
And here the sensor is disconnected .
Code: Select alldofile("wots.lua")
checksum 255
checksumTest 252
humidity - timing of bits 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
temperat - timing of bits 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
checksum - timing of bits 10 10 10 10 10 10 10 10
Humidity: 0%
Temperature: -127.99609375 deg C
Here's mine:
Code: Select allNodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4
lua: cannot open init.lua
>
dofile(wots.lua) martedì 28 luglio 2015 10:02:15
dofile("wots.lua")
checksum 239
checksumTest 239
humidity - timing of bits 0 1 2 1 1 2 1 5 5 5 5 2 1 5 1 1
temperat - timing of bits 2 2 1 1 1 1 1 5 1 1 1 1 5 1 1 5
checksum - timing of bits 5 5 5 2 5 5 5 5
Humidity: 1.890625%
Temperature: 1.03515625 deg C
With the ufficial code I'm able to get the right temperature but the humidity is always "-0.1", "-0.1.9" or "-1".... I tried another DHT22 (working on the GPIO of the raspberryPI) without any luck. I tried with or without the pullup between the data and vcc (3.3v).
As you can see the nodeMCU version is 0.9.5-20150318 but I tried 20150212, 20150213 with the same results. My ESP is version ESP-01 (tried two of them).
How can I get the right humidity?
[UPDATE]: I missed to set the sensortype to DHT22. It works!! Using your dhttest.lua even my scripts are working, not only temperature but also humidity! Can you explain what can be different from the "ufficial" library
https://github.com/javieryanez/nodemcu- ... /dht22.lua compared to yours? Thanks Again!
Last edited by aventrax on Wed Jul 29, 2015 9:09 am, edited 1 time in total.