Electronic – NodeMCU ESP8266 DHT22 reading nan (2147483647)

#nodemcuesp8266

I am new to electronics and microcontrollers and hope this is the right spot on StackExchange. I have been playing around with an Arduino Micro, connecting different sensors and a display and display data.

I just bought a NodeMCU so I can send sensor values to a database using a DHT22. This is the first test, other sensors will follow.

I am using Arduino Studio with the board configuration for this device.

Everything works fine, Wifi, Serial, but I only get bad readings from the sensor.

  • I checked 2 DHT22 with my Arduino, they work.
  • I read that the Arduino has integrated pull-ups and a ESP8266 might not have them, so I added 4.7k and 10k between data and 3.3V. But I am not entirely sure about this.
  • The DHT22 is using 3.3V on the NodeMCU and the Arduino. Not 5V. -> Arduino works.
  • I tried different D pins
  • I tried removing or adding code lines like dht.begin, pinMode, etc.
  • I used the DHTtest example which also gets bad readings.
  • I found other projects – Weather monitoring – which showed their wiring. Some of them also did not use a pull-up resistor. I also tried it without.
  • Wiring checked multiple times -> I hope I'm not blind right now.
  • Measured the resistors i added -> ok
  • Measured the voltage between GND and 3.3V -> ok
  • I don't have an oscilloscope (yet) so I don't know whats on the data line.

So I am doing something wrong here but I can't figure out what.

Thanks for help. Very much appreciated.

Best Answer

Now had some time after a while to look after this problem.

I accidentally found the reason. At first I thought it was a problem with the breadboard or the jumper cables. But later I found out I unplugged the DHT22 while the controller was powered on.

So it is the same problem as DHT22 needs electrical reset?

Related Topic