0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Post a schematic and code of what you have tried. Preferably, stick to sample code which someone tested. \$\endgroup\$ – Dmitry Grigoryev Jun 14 at 10:55
  • \$\begingroup\$ pastebin.com/f0x5xada - The example from the DHT library. I changed only the DHTPIN \$\endgroup\$ – Silberling Jun 14 at 10:59
  • \$\begingroup\$ pasteboard.co/IjmFJmf.jpg - Picture is okay? i4 and i5 is 3V and GND. The resistor C6 C7 is 10k, the other one the 4.7k i tried before. e8 is empty. If there is anything else which helps I'd be happy to provide it. \$\endgroup\$ – Silberling Jun 14 at 11:05
  • \$\begingroup\$ In this picture data is connected to D3. I modified the example code and set DHTPIN to 3. \$\endgroup\$ – Silberling Jun 14 at 11:14
1
\$\begingroup\$

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?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.