Trying to get readings from DHT22 sensor

Hello everyone,
i am fairly new to arduino and electronics but already have a programming background.

I am trying to get readings from a DHT22 sensor from an Arduino Uno, but all i’ve got is “nan”.

I think that there is something wrong with the sensor i’ve bought as there is a difference in ther pins it has (the pins order)

I’ve bought this sensor
https://www.banggood.com/SHTC3-High-Precision-Digital-Temperature-and-Humidity-Sensor-Measurement-Module-I2C-Communication-AM2302-DHT22-p-1598372.html?rmmds=myorder&cur_warehouse=CN

All the sensors i’ve seen online has vcc , data, nc, grd
mine has vcc, grd, sda, scl

I’ve connected 5volts at vcc
ground at grd
and digital pin 7 to sda

I’m trying to get reading using the examples found online to get me started

#include <DHT.h>
#include <DHT_U.h>

//Constants
#define DHTPIN 7 //DHT Digital Pin
#define DHTTYPE DHT22 // DHT 22 (AM2302)

DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino

//Variables
int chk;

float temp; //Stores temperature value

void setup()
{
Serial.begin(9600);
dht.begin();
}

void loop()
{
delay(2000);
//Read data and store it to variables hum and temp

temp = dht.readTemperature();
//Print temp and humidity values to serial monitor

Serial.print(“Temp: “);
Serial.print(temp);
Serial.println(” Celsius”);
delay(2000); //Delay 2 sec.
}

Is there a change my sensor ( Brand new ) is broken ?
Is there something wrong with its type? or maybe connectivity?
Any help appreciated

Your sensor uses I2C serial bus to read the data. You can learn the basic from Wikipedia.

I2C needs pull up resistors on both lines SDA and SCL. They might be on your modul. Please verify.

You need to find out which pins on your Arduino are the I2C pins and connect them directly SDA to SDA and SCL to SCL. If you google "DHT22 I2C Arduino Uno you will find a couple of simple schematics that will help you get started.
Try to verify the information using the datasheets to help you learn and understand. The schematics for the Arduino boards are available in the store under Documentation. They are easy to read.

https://store.arduino.cc/arduino-uno-rev3

Ok i've connected the sensor using SDA / SCL at A4 / A5 which are I2C ports
Is there any code example about reading temp values?

The key is to understand that this sensor is SHTC3, not DHT22. The lovely people at Banggood just spammed "DHT22" into the listing title so it would show up in more searches.

Now that you know the name of the sensor, you can find code by doing a search for: arduino SHTC3. There are a couple libraries with example sketches.

I've just missed it.
Thanks a lot mate, i've managed to get readings using the following lib

Thanks again!

I'm glad to hear you got it working with the library. That was fast! Enjoy.
Per

Klaus_K:
Your sensor uses I2C serial bus to read the data. You can learn the basic from Wikipedia.

I²C - Wikipedia

I2C needs pull up resistors on both lines SDA and SCL. They might be on your modul. Please verify.

You need to find out which pins on your Arduino are the I2C pins and connect them directly SDA to SDA and SCL to SCL. If you google "DHT22 I2C Arduino Uno you will find a couple of simple schematics that will help you get started.
Try to verify the information using the datasheets to help you learn and understand. The schematics for the Arduino boards are available in the store under Documentation. They are easy to read.

Arduino Uno Rev3 | Arduino Official Store

I believe the DHT22 which the op posted, which comes on a breakout board, usually has pull up resistors installed.

Glad you've got it working but just thought I'd say, I've had success with this lib too.

It's not a DHT22, it's an SHTC3. It just has a misleading product title that makes it sound like it's a DHT22. So I very much doubt the DHT sensor library will work with it.