DHT11 Temperature and Humididty Sensor

I have recently bought a DHT11 temperature and humidity sensor and when I went to run the code (down below), I got an output of both the humidity and temperature to be zero. I did a lot of research and some other people had the same problem, however, they said to switch the order of the wires because they had it hooked up wrong. I tried the suggested wire arrangement(GND-5v-Signal), and also the arrangement it says on the sensor itself(GND-Signal-5v). Please help, I have the 3 pin sensor and using the latest DHT library that is on the Arduino online editor(and am using an Arduino Nano if that matters).

#include <dht.h>

dht DHT;

#define DHT11_PIN A0

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

void loop(){
  int chk = DHT.read11(DHT11_PIN);
  Serial.print("Temperature = ");
  Serial.println(DHT.temperature);
  Serial.print("Humidity = ");
  Serial.println(DHT.humidity);
  delay(100);
}

Do you have a pull-up resistor on the signal line?

I am using this to setup my board. When I do this, I get an output of 250 for the humidity and 246 for the temperature. I have tried using both with and without a resistor and they both do not work like I want them to.

Hi Stuart. From your diagram I note a 4.6 k pullup resistor. Please use a 10k.
Further i note that you are using A0. In my Nano weather station I am using a DHT11 of which the data pin is wired to pin D7 of the Nano. Please find a description and a sketch on my website, (8) Nano Weather station - Zonnestroompanelen in Nederland

Succes !

Hi Stuart, I stripped one of my DHT11 sketches down to the very basic bones. The correct wiring of the DHT11 is in the attached picture. Here is the sketch for the Arduino (with Serial Monitor output):

// single DHT 11 temp-humidity sensor on Arduino with serial monitor reporting only
// original written by Tim Stephens 2013 - Temperature Logger | tjstephens
// public domain
// modified Floris Wouterlood July 1, 2017

// based on DHT11 examples by Ladyada.
// data pin of DHT11 sensors wired to pin 10 on Arduino
// 10k pull up resistor (between data and 5V)

#include "DHT.h"

float h, t;
DHT DHT_sens(10, DHT11); //datapin sensor to pin 10 Arduino

void setup()
{

DHT_sens.begin();

Serial.begin (9600);
Serial.println ("===============================================");
Serial.println ("Bare DHT11 temp-humidity sensor - June 30, 2017");
Serial.println ("===============================================");
Serial.println (" ");
}

void loop(){

// ================== read from buffer and display =========================

h = DHT_sens.readHumidity();
t = DHT_sens.readTemperature();

delay (1000); // pause a second
Serial.print ("Humidity: ");
Serial.print (h,0); // zero decimal
Serial.print (" %\t");
Serial.print ("Temperature: ");
Serial.print (t,1); // one decimal
Serial.println (" *C");
delay (1000); // pause a second

}

DHT11_wiring.png