Help for DHT22 Sensor

Hello everybody!!
It's the whole day that i'm trying to use the DHT22 sensor, but I just get blatantly fake values. : smiley-confused:
I just wanted your opinion to understand if i make something wrong, or is the sensor that does not work and I stop banging my head on.
I tried several libraries, but the result does not change, I always get 1% as humidity value, and the temperature rising steadily up to 32 degrees and then remained constant. : or
Now in my house there are 25 degrees and 38%, temperature, so the sensor values are blatantly wrong.
The connections are those of the image attached, and the libraries are those of Adafruit:

And the sketch is the example included in the library:

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#include "DHT.h"

#define DHTPIN 2 // what pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors. This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.
DHT dht(DHTPIN, DHTTYPE);

void setup() {
Serial.begin(9600);
Serial.println("DHTxx test!");

dht.begin();
}

void loop() {
// Wait a few seconds between measurements.
delay(2000);

// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}

// Compute heat index in Fahrenheit (the default)
float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);

Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" *C ");
Serial.print(f);
Serial.print(" *F\t");
Serial.print("Heat index: ");
Serial.print(hic);
Serial.print(" *C ");
Serial.print(hif);
Serial.println(" *F");
}

I made something wrong, or is that the sensor is defective?
Any help would be appreciated,
Thank you.

collegamenti.jpg

Some questions..

Where did you buy the sensor?
There are known fake/bad ones on ebay

What board are you using?
What is the length of the cable used?
Do you use a pull up resistor?

Thank you for replay:

  1. I bought on aliexpress.com
  2. I'm using Arduino UNO
  3. my cables are 20 cm long
  4. i use 10K resistor between VCC and the data pin

can you try my DHT lib

it is slightly different implemented than adafruit but is confirmed to work by many people.

Thank you.
I've tried, but no changes.
Still i get 1% humidity and wrong values of temperature as the image attached.
I guess the sensor is broken...
Any other help?

Broken sensor can be tested by testing another one.
Do you have a spare or maybe you know someone nearby that has another sensor...

and definitely send this one back with a replace/refund request.

I don't have another DHT22, but i have a TMP36 that works perfectly and with whom I can compare the temperature and see that DHT22 is wrong.
Ok, i'll definitely send this one back with a replace/refund request.
I don't know what else to do to make it work.
Thank you for help.