1

recently Ive set up an ESP8266 to control temperature and humidity in rooms, for this Im using DHT11 sensor, thats the basic code I have in order to check functionality in Arduino IDE

#include "DHT.h"                
#define DHTPIN A0
#define DHTTYPE DHT11
                     
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  Serial.println("DHT11 Testprogram");
  dht.begin();
}
void loop() {
  // Wait a few seconds between measurements.
  delay(2000);                  
                                    
  float h = dht.readHumidity();    
  float t = dht.readTemperature(); 
  
  if (isnan(h) || isnan(t)) {       
    Serial.println("Error");
    return;
  }

  Serial.print("Luftfeuchtigkeit: ");
  Serial.print(h);                 
  Serial.print("%\t");             
  Serial.print("Temperatur: ");
  Serial.print(t);                 
  Serial.write('°');               
  Serial.println("C");
}

So far as I've checked the code seems to be all right and doesn't have any issues. The bottleneck might be the circuit although I checked twice and I don't really understand what the issue still might be. esp8266 with dht11

the 3V is connected to the + and to the pull up resistor of the sensor which is 10K and A0 Pin according to the plan with data pin of the sensor as well as with a pull up resistor and G is connected to - of the sensor. I still get no response from the sensor, I even checked other 3 sensors and cannot understand what the issue might be, does anyone know a solution?

Sparkm4n
  • 111
  • 4
  • DHT on A0? A0 is only analog input – Juraj Dec 06 '20 at 18:04
  • Well as far as I've read, it's also possible to use A0 on esp8266 as input – Sparkm4n Dec 06 '20 at 18:05
  • analog input or for button. but not for digital communication. and I think A0 on nodemcu is directly connected to esp8266 analog input which is 0 to 1 V – Juraj Dec 06 '20 at 18:06
  • I tried also digital inputs, it's still the same issue, I get NaN as response – Sparkm4n Dec 06 '20 at 18:08
  • What digital inputs did you try? Have you tried other DHT libraries (the one from Adafruit for example)? It’s hard to make out the connections from your photo by the way. – StarCat Dec 06 '20 at 21:44
  • 1
    I tried all of them it didnt work, I used grove humidity sensor library but I might have a look if another library gonna do some magic – Sparkm4n Dec 06 '20 at 22:10
  • Try the "DHT for ESP" library. – Mats Karlsson Dec 07 '20 at 02:15
  • 1
    tried other libraries as well, still no success, I was thinking that the resistor might be an issue or some kind of other electronic part – Sparkm4n Dec 15 '20 at 15:14

0 Answers0