ADiea / libDHT

Arduino compatible DHT11/22 lib with heatindex, dewpoint and confort algorithms
MIT License
4 stars 8 forks source link

Need testing on arduino platforms with different sensor types. #1

Open ADiea opened 9 years ago

ADiea commented 9 years ago

Hi guys and girls, This lib needs people with some spare time and Arduino hardware to help test it. Comments are welcome Cheers!

Maxr1998 commented 9 years ago

Hi @ADiea, I am using a SainSmart Mega2560 and a SainSmart AM2302 sensor (DHT22 variant), but your library sadly returns 0.00 for temp and humidity. It probably connects fine, because when it's disconnected, it reports an error. Secondly, the lib from @RobTillaart gives me normal values.. I still like yours better, because it has dewpoint calculation :)

ADiea commented 9 years ago

Hi @Maxr1998 please enable debug in dht.h and tell me what you get on the console. I also use the AM2302 sensor for testing.

#define DHT_DEBUG 1

Thanks

ADiea commented 9 years ago

Make sure to use the latest code, I fixed some cornercases

Maxr1998 commented 9 years ago

@ADiea this is my log output atm:

libDHT: Detected DHT-22 compatible sensor.
40
0, 0, 0, 0, 0 =? 0
Temperature: 0.00
Humidity: 0.00
Dew point: nan

Here's my code, just to be sure:

#include "DHT.h"

#define DHTPIN 5

TempAndHumidity th;

DHT dht(DHTPIN);

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

  dht.begin();
}

void loop() {
  delay(2000);

  if(!dht.readTempAndHumidity(th)) {
    Serial.print("Failed to read from DHT sensor for reason: ");
    switch(dht.getLastError())
    {
      case errDHT_Timeout:
         Serial.print("TIMEOUT (no sensor?) \n");
      break;
      case errDHT_Checksum:
         Serial.print("CHECKSUM (are cables secured?) \n");
      break;
      case errDHT_Other:
         Serial.print("UNKNOWN \n");
      break;
    };
    return;
  }
  Serial.print("Temperature: ");
  Serial.println(th.temp);
  Serial.print("Humidity: ");
  Serial.println(th.humid);
  double dp = dht.getDewPoint(DEW_ACCURATE);
  Serial.print("Dew point: ");
  Serial.println(dp);
}

Also, it seems the Arduino IDE doesn't know debugf(), or is my Version just to old (1.5.6 r2)?

ADiea commented 9 years ago

Looking at your sensor's picture on the internet it seems it already has a pullup....

In dht.cpp try replacing the line

PULLUP_PIN(m_kSensorPin); 

with

pinMode(m_kSensorPin, INPUT);

and write back if this helps...

Maxr1998 commented 9 years ago

@ADiea Nope, sorry, still the same. And yes, it already has pullup resistor, I am using this one.

ADiea commented 9 years ago

Unfortunately I have no other idea at the moment I will try comparing the code to Rob's when I have some free time.

Maxr1998 commented 9 years ago

Ok, thanks for your efforts though :)

Maxr1998 commented 8 years ago

Any updates?

ADiea commented 8 years ago

Nothing yet sorry. I am planning a clean-up and a bit of restructuring of the code to make it simpler but not on the priority list unfortunately - so can't promise anything yet