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?

8
  • DHT on A0? A0 is only analog input
    – Juraj
    Dec 6, 2020 at 18:04
  • Well as far as I've read, it's also possible to use A0 on esp8266 as input
    – Sparkm4n
    Dec 6, 2020 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 6, 2020 at 18:06
  • 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 6, 2020 at 22:10
  • 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, 2020 at 15:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.