Help with DHT11

I am trying to get my dht11 sensor up and running. I am using the library and example from Stigern.Net » Blog Archive DHT11 Library for Arduino 1.0 - Stigern.Net on arduino 1.o and am having an issue. It tells me that "dht11 does not name a type". Help. Is there something wrong. I have checked that the library was uploaded right. Is it a bad library? Is there a better one?

At least there is another one - Arduino Playground - DHTLib -
You can test yourself if it better suits your needs.

Just tried the link you gave me. Replaced the .ccp and .h then used the sketch provided. It still says the same error.
code line: dht11 DHT11;
error: 'dht11' does not name a type

ideas?

How and where did you install the library?

Which version of the IDE are you using?

I installed the library in the library folder, just like I did for my Dallas OneWires and have had no issue with them reading the library. I installed it by downloading the .zip file to the library folder then extracting the file to the same location. The dht library folder contains the .h .ccp and example. The library shows up in the IDE examples and can load the example sketch, but the example sketch shows the error previously listed.

I am running IDE version 1.0

Try opening a new file, copy and paste your existing code into the new file, then try and compile.

I had the same issue with Easy Transfer on a file that had worked in the past and the copy and paste did the trick for me.

Copy and paste did work! I now need to get the code to calculate dew, convert the temp to F and get evevrything to return whole numbers only. I am hoping to have my dht11 and my dallas onewires both integrated tonight. I can get the dht11 to print to the lcd and separately get the onewire to print to lvd, but can't get them both to print.

mitaccio:
Copy and paste did work! I now need to get the code to calculate dew, convert the temp to F and get evevrything to return whole numbers only. I am hoping to have my dht11 and my dallas onewires both integrated tonight. I can get the dht11 to print to the lcd and separately get the onewire to print to lvd, but can't get them both to print.

Have a look at this -> http://arduino-info.wikispaces.com/TemperatureHumidity there some code there that will be helpful :slight_smile:

Give this a try:

// 
//   FILE:  dht_test.pde
// PURPOSE: DHT library test sketch for Arduino
//
// From left to right
// 1 : VCC (5V)
// 2 : SIGnal
// 3 : NC Not connected
// 4 : GND

#include <dht.h>

dht DHT;

#define DHT11_PIN 4


void setup()
{
  Serial.begin(9600);
  Serial.println("DHT TEST PROGRAM ");
  Serial.print("LIBRARY VERSION: ");
  Serial.println(DHT_LIB_VERSION);
  Serial.println();
  Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
}

void loop()
{
  printTemp();
  delay(1000);
}

void printTemp(){
   // READ DATA
  Serial.print("DHT11, \t");
  int chk = DHT.read11(DHT11_PIN);
  switch (chk)
  {
    case 0:  Serial.print("OK,\t"); break;
    case -1: Serial.print("Checksum error,\t"); break;
    case -2: Serial.print("Time out error,\t"); break;
    default: Serial.print("Unknown error,\t"); break;
  }
 // DISPLAT DATA
  Serial.print(DHT.humidity,1);
  Serial.print(",\t");
  Serial.println(DHT.temperature,1);
}


//
// END OF FILE
//

I have the same problem.....

https://picasaweb.google.com/lh/photo/rbsdks-ALfyU-FFVgMU859MTjNZETYmyPJy0liipFm0?feat=directlink

did the steps above, but with no results.

What is wrong? Can somebody help me?

Grtx,

Marcel

you must first install the library and then open the IDE. The IDE reads a list of libs during startup and ignores the ones installed when it is running.

tried this one - - Arduino Playground - DHTLib - It explains how to install the lib ...

Rob,

Yes i followed the website.... My sketchbook path is not in programfiles, so i even tried to copy the lib folder to the sketchbook folder. But that doesn't work also.

I really don't know what i am doing wrong.

AAhhhhhh

This error i get:
sketch_mar17a.cpp:6:17: error: dht.h: No such file or directory
sketch_mar17a:7: error: 'dht' does not name a type
sketch_mar17a.cpp: In function 'void setup()':
sketch_mar17a:17: error: 'DHT_LIB_VERSION' was not declared in this scope
sketch_mar17a.cpp: In function 'void loop()':
sketch_mar17a:26: error: 'DHT' was not declared in this scope

I think i have a problem with the paths on my laptop.

This is the error i get now!

In file included from DHT11.cpp:8:
C:\Program Files (x86)\arduino-1.0\libraries\DHT11/dht11.h:19:22: error: WProgram.h: No such file or directory

Okay i found this link on a dif forum:
http://nootropicdesign.com/forum/viewtopic.php?t=2434

the include for Wprogram.h is compatible with Arduino1.0???? You must include arduin.h ??
Weird.....

But it works now!

is 1.0 compatible but I have to update

going to fix it now ...

done.

If you are looking for dew point and conversions, I use this code:

// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm 
double dewPoint(double celsius, double humidity)
{
  double A0= 373.15/(273.15 + celsius);
  double SUM = -7.90298 * (A0-1);
  SUM += 5.02808 * log10(A0);
  SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
  SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
  SUM += log10(1013.246);
  double VP = pow(10, SUM-3) * humidity;
  double T = log(VP/0.61078);   // temp var
  return (241.88 * T) / (17.558-T);
}

// delta max = 0.6544 wrt dewPoint()
// 5x faster than dewPoint()
// reference: http://en.wikipedia.org/wiki/Dew_point
double dewPointFast(double celsius, double humidity)
{
  double a = 17.271;
  double b = 237.7;
  double temp = (a * celsius) / (b + celsius) + log(humidity/100);
  double Td = (b * temp) / (a - temp);
  return Td;
}

//Celsius to Fahrenheit conversion
float Fahrenheit(float celsius)
{
  return 1.8 * celsius + 32;
}

duckie