Was wondering if anyone else has run into this oddity?
I have the NodeMCU connected to the DHT11. All goes fine upload sketch to print temp to serial monitor and it does just that. A funny thing happens when I reset the NodeMCU. When serial monitor starts posting the temp it fails but instead posts NAN.
If I reload the sketch the Temp is posted via serial monitor just fine that is until I reset the NodeMCU.
In order to test possible, bad DHT11 opened up a new one and tried again still same. Then I opened up a new NodeMCU and still the same problem.
Finally used a wemos mini D1 and it had the same problems using the above operation?
Looking for anyone finding this failure and or read a write up on it.
Wouldn’t it make more sense to have the “Temp=(dht2.readTemperature(true));” line in the loop() ? You appear to only read it once and reprint the same value over and over.
Yes - only reading it once (at startup) is bad on two levels. 1) You only read it once, and 2) you don’t give the device time to “warm up”. I would put it after the 5 second delay.
However, you are possibly going to swap this to a deep sleep mode, so you can wake up every period of time (which is essentially a reboot), read the value and then post it back to your server.
In which case you need to deal with the fact that the device hasn’t warmed up - wait for a short while, and then try again until you get a proper reading.
Sorry you are correct makes me wish more IOT devices used python. Thank you sorry for the fumble should have seen that myself. It has been corrected and all is functioning in IOT land.
Well, if it helps, I find python more natural to program personally so I always flash micro python to my 8266’s and use that.
I’ve used a dht11 and a dht22 on a 8266 running micro python.
I’m not knocking lua at all, I’ve just a fair amount of experience with python so I can knock something together quickly in it rather than learn the foibles of a new language
@Mr_Bonce Yes this is the next project, currently stumbling with a sensor used on my sprinkler system. It is giving me headaches beyond the load permit of my brain.
If you happen to know of the data sheet for this device please share.
…sorry, I’ve no idea what that is, certainly doesn’t look anything like a DHT11, neither does it look like a standard wemos board as they usually have headers on the left and right. when you bought it what was it described as, also does it have anything that identifies it on the underside of the board?
@Mr_Bonce No worries was making a point concerning my schedule and yes that is not a wemos board it is a sensor board I am currently struggling with ignore that part of the posting.