Temperature & Humidity DHT22 sensor + ESP8266 error

Hello everyone ! I'm trying to finish my EPS8266 d1 mini project and unfortunately I can't read temperature and humidity from my DHT22 sensor. I found on web that it is a problem with the libray and I switched to DHTstable library (wich one you can find here: Arduino/libraries/DHTstable at master · RobTillaart/Arduino · GitHub . I uploaded the dht22_test example to my board and I receive this on my serial monitor :

dht22_test.ino
LIBRARY VERSION: 0.2.3 - dhtstable

Type, status, Humidity (%), Temperature (C) Time (us)
DHT22, Time out error, -999.0, -999.0, 2144
DHT22, Time out error, -999.0, -999.0, 2076
DHT22, Time out error, -999.0, -999.0, 2076
DHT22, Time out error, -999.0, -999.0, 2076
DHT22, Time out error, -999.0, -999.0, 2076
DHT22, Time out error, -999.0, -999.0, 2076
DHT22, Time out error, -999.0, -999.0, 2076
DHT22, Time out error, -999.0, -999.0, 2076

My sensor it's good because it works on my arduino nano with the original dht library (DHT-sensor-library-master), but with this library don't. And the original library don't work on my d1 mini board.
So, right now it seems that I am in a very puzzling trouble. If anyone could give me an advice, I would be grateful.

Post a (complete) wiring diagram. You get that output if the wiring is wrong or no sensor is connected.

And post the actual code you used to produce the above output. Remember that on the ESP you cannot use 5 to specify pin D5, it must be D5 in the code!

That's my code:

#include <dht.h>

dht DHT;

#define DHT22_PIN D5

struct
{
    uint32_t total;
    uint32_t ok;
    uint32_t crc_error;
    uint32_t time_out;
    uint32_t connect;
    uint32_t ack_l;
    uint32_t ack_h;
    uint32_t unknown;
} stat = { 0,0,0,0,0,0,0,0};

void setup()
{
    Serial.begin(115200);
    Serial.println("dht22_test.ino");
    Serial.print("LIBRARY VERSION: ");
    Serial.println(DHT_LIB_VERSION);
    Serial.println();
    Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)\tTime (us)");
}

void loop()
{
    // READ DATA
    Serial.print("DHT22, \t");

    uint32_t start = micros();
    int chk = DHT.read22(DHT22_PIN);
    uint32_t stop = micros();

    stat.total++;
    switch (chk)
    {
    case DHTLIB_OK:
        stat.ok++;
        Serial.print("OK,\t");
        break;
    case DHTLIB_ERROR_CHECKSUM:
        stat.crc_error++;
        Serial.print("Checksum error,\t");
        break;
    case DHTLIB_ERROR_TIMEOUT:
        stat.time_out++;
        Serial.print("Time out error,\t");
        break;
    default:
        stat.unknown++;
        Serial.print("Unknown error,\t");
        break;
    }
    // DISPLAY DATA
    Serial.print(DHT.humidity, 1);
    Serial.print(",\t");
    Serial.print(DHT.temperature, 1);
    Serial.print(",\t");
    Serial.print(stop - start);
    Serial.println();

    if (stat.total % 20 == 0)
    {
        Serial.println("\nTOT\tOK\tCRC\tTO\tUNK");
        Serial.print(stat.total);
        Serial.print("\t");
        Serial.print(stat.ok);
        Serial.print("\t");
        Serial.print(stat.crc_error);
        Serial.print("\t");
        Serial.print(stat.time_out);
        Serial.print("\t");
        Serial.print(stat.connect);
        Serial.print("\t");
        Serial.print(stat.ack_l);
        Serial.print("\t");
        Serial.print(stat.ack_h);
        Serial.print("\t");
        Serial.print(stat.unknown);
        Serial.println("\n");
    }
    delay(2000);
}

and here's my wiring : https://ibb.co/jdKaGK

The DHT22 should work with 3V3 power, so connect it's Vcc to 3V3 instead of 5V. And the data pin should be pulled to 3V3 by a 10kΩ resistor. If your DHT22 already has that pull-up you might have fried the D5 pin of your ESP8266 as it got 5V which is over spec by far. Try to connect to another pin once you power it from 3V3.

Thank you for support, I solved by using my arduino nano to read temperature and then I send it to my esp8266. :wink:

Give a try with this Library.