Receiving Timeout nan nan nan from dht11 Sensor using wemos d1 mini

Hello there,

I wired up my dht11 Sensor to my “wemos” d1 mini and tried to read data from it using this code:

#include "DHT.h"

DHT dht;

void setup()
{
  Serial.begin(9600);
  Serial.println();
  Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)");
  dht.setup(5); // data pin 2
}

void loop()
{


  delay(dht.getMinimumSamplingPeriod());

  float humidity = dht.getHumidity();
  float temperature = dht.getTemperature();

  Serial.print(dht.getStatusString());
  Serial.print("\t");
  Serial.print(humidity, 1);
  Serial.print("\t\t");
  Serial.print(temperature, 1);
  Serial.print("\t\t");
  Serial.println(dht.toFahrenheit(temperature), 1);
}

I wired it up like i used to do with my arduino nano where everything works fine (see attachments)

This is the Output I get:

Timeout nan       nan        nan

Timeout nan       nan        nan

Timeout nan       nan        nan

Timeout nan       nan        nan
.
.
.

Thanks for helping me out.

circuit.png

Frekkel:

DHT dht;

void setup()
{
  ...
  dht.setup(5); // data pin 2
  ...
}

i think your forgot to add DHTTYPE and dht.begin() sir

I wired it up like i used to do with my arduino nano where everything works fine

Yes, but the Nano is a 5V board while the Wemos is a 3V3 board. Connect Vcc to 3V3 and add a pull-up (10kΩ) from the Data pin to 3V3.

Post a link to the library you're actually using. Many DHT libraries use AVR-specific registers and cannot be used on ESP hardware.

pylon:
Post a link to the library you're actually using. Many DHT libraries use AVR-specific registers and cannot be used on ESP hardware.

This is the library i am using.

pylon:
Yes, but the Nano is a 5V board while the Wemos is a 3V3 board. Connect Vcc to 3V3 and add a pull-up (10kΩ) from the Data pin to 3V3.

Tried it out but i am still getting the same results.

On that line:

  dht.setup(5); // data pin 2

the comment is wrong and according to the circuit it must read

  dht.setup(D5); // data pin 2

For the AVR platform pin 5 and pin D5 are identical. This is not the case for the ESP platform.

pylon:
On that line:

  dht.setup(5); // data pin 2

the comment is wrong and according to the circuit it must read

  dht.setup(D5); // data pin 2

For the AVR platform pin 5 and pin D5 are identical. This is not the case for the ESP platform.

I tried this out but I am still getting the Timeout nan nan nan Error I described earlier :frowning:

Thanks for your help anyways :slight_smile:

Did you check if the D5 pin of your Wemos is still working? The wrong connection of the DHT to 5V might have fried it.

Make a simple sketch that puts out HIGH and LOW in a frequency of 0.1Hz, then check the output with a multimeter.

Make another sketch that prints the input value of D5 to the serial interface and check that value if you connect the pins to Vcc over a 5kΩ resistor or to GND using the same resistor.