Skip to main content
updated info. added question
Source Link
blfuentes
  • 221
  • 2
  • 7
  • 18

UPDATED: I found a library that works. I also changed the wiring because I found out the sainsmart dht11 switches the pins:

-left: signal with 10kO and to 5v

-middle: 5v

-right: GND

Now just a question. What is the difference between these two dht11 sensors. Dht11 basic dht11 with board

The one from sainsmart has a piece of circuit I don't know what it is.(I have a lack on electronics I try to fix step by step...)

It is a resitor, capacitor? it says 103.

How does this affect to the wiring?

UPDATED: I found a library that works. I also changed the wiring because I found out the sainsmart dht11 switches the pins:

-left: signal with 10kO and to 5v

-middle: 5v

-right: GND

Now just a question. What is the difference between these two dht11 sensors. Dht11 basic dht11 with board

The one from sainsmart has a piece of circuit I don't know what it is.(I have a lack on electronics I try to fix step by step...)

It is a resitor, capacitor? it says 103.

How does this affect to the wiring?

added 6 characters in body
Source Link
blfuentes
  • 221
  • 2
  • 7
  • 18

The wiring:   

-left pin: 5v   

-right pin: gnd   

-middle pin: 5v - digital2 - through 10kO resistor

The wiring:  -left pin: 5v  -right pin: gnd  -middle pin: 5v - digital2 - through 10kO resistor

The wiring: 

-left pin: 5v 

-right pin: gnd 

-middle pin: 5v - digital2 - through 10kO resistor

Source Link
blfuentes
  • 221
  • 2
  • 7
  • 18

Basics with DHT11

I just bought the sensor DHT11 and trying to test it with the library code provided by the IDE, but I always get the same error on .read() . Code -2

/*####################################################################
FILE: dht11_functions.pde - DHT11 Usage Demo.
VERSION: 2S0A

PURPOSE: Measure and return temperature & Humidity. Additionally provides conversions.

LICENSE: GPL v3 (http://www.gnu.org/licenses/gpl.html)
GET UPDATES: https://www.virtuabotix.com/

  --##--##--##--##--##--##--##--##--##--##--
  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
  | ##  ##  ##  ##  ##  ##  ##  ##  ##  ## |
  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
  | ##  ##  ##  ##  ##  ##  ##  ##  ##  ## |
  ##  ##  ##  ## DHT11 SENSOR ##  ##  ##  ##
  ##  ##  ##  ##  ##FRONT ##  ##  ##  ##  ##
  | ##  ##  ##  ##  ##  ##  ##  ##  ##  ## |
  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
  | ##  ##  ##  ##  ##  ##  ##  ##  ##  ## |
  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##
  --##--##--##--##--##--##--##--##--##--##--
      ||       ||          || (Not    ||
      ||       ||          || Used)   ||
    VDD(5V)   Readout(I/O)          Ground

HISTORY:
Joseph Dattilo (Virtuabotix LLC) - Version 2S0A (27 May 12)
-Rewritten to with more powerful Versalino functionality
Joseph Dattilo (Virtuabotix LLC) - Version 0.4.5 (11/11/11)
-Made Library Arduino 1.0 Compatible
Joseph Dattilo (Virtuabotix LLC) - Version 0.4.0 (06/11/11)
-Fixed bugs (squish)
Mod by Rob Tillaart - Version 0.3 (28/03/2011)
Mod by SimKard - Version 0.2 (24/11/2010)
George Hadjikyriacou - Original version (??)
#######################################################################*/


#include <dht11.h>

dht11 DHT11;

void setup()
{
    DHT11.attach(2);
    Serial.begin(9600);
    Serial.println("DHT11 TEST PROGRAM ");
    Serial.print("LIBRARY VERSION: ");
    Serial.println(DHT11LIB_VERSION);
}

void loop()
{
    Serial.println("\n");

    int chk = DHT11.read();

    Serial.print("Read sensor: ");
    switch (chk)
    {
        case 0: Serial.println("OK"); break;
        case -1: Serial.println("Checksum error"); break;
        case -2: Serial.println("Time out error"); break;
        default: Serial.println("Unknown error"); break;
    }

    Serial.print("Humidity (%): ");
    Serial.println((float)DHT11.humidity, DEC);

    Serial.print("Temperature (°C): ");
    Serial.println((float)DHT11.temperature, DEC);

    Serial.print("Temperature (°F): ");
    Serial.println(DHT11.fahrenheit(), DEC);

    Serial.print("Temperature (°K): ");
    Serial.println(DHT11.kelvin(), DEC);

    Serial.print("Dew Point (°C): ");
    Serial.println(DHT11.dewPoint(), DEC);

    Serial.print("Dew PointFast (°C): ");
    Serial.println(DHT11.dewPointFast(), DEC);

    delay(2000);
}

And this is my ouput:

DHT11 TEST PROGRAM 
LIBRARY VERSION: 2S0A


Read sensor: Time out error
Humidity (%): 0.0000000000
Temperature (°C): 0.0000000000
Temperature (°F): 32.0000000000
Temperature (°K): 273.1499938964
Dew Point (°C): nan
Dew PointFast (°C): nan


Read sensor: Time out error
Humidity (%): 0.0000000000
Temperature (°C): 0.0000000000
Temperature (°F): 32.0000000000
Temperature (°K): 273.1499938964
Dew Point (°C): nan
Dew PointFast (°C): nan

The wiring: -left pin: 5v -right pin: gnd -middle pin: 5v - digital2 - through 10kO resistor

enter image description here enter image description here