DHT11/ DHT22 snensor !

Hello !

I have a three sensors, two DHT11 sensor modules (http://www.ebay.com/itm/271096647277?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT and one DHT22 sensor (used with 10k pull-up resistor) http://www.ebay.com/itm/400985446261?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

The problem is sensors shows different values into one room. I fixed all values after 5 min of sensor work. I changed only sensors around and around in breadboard at the same position. For this poject I use Arduino Pro Mini.

Results:

DHT11 /1 DHT11 /2 DHT 22

T H T H T H

28 C 34% 23 C 19% 26 C 43%

Code for DHT 11

#include <U8glib.h> //https://github.com/olikraus/u8glib/wiki
#include <dht.h> //http://playground.arduino.cc/Main/DHTLib

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);

# define dataPin 8

dht DHT;

void setup() {


}

void loop() {

  u8g.firstPage();
  do {
    draw();
  } while ( u8g.nextPage() );
  delay(1); 
  
}

void draw() {

  int readData = DHT.read11(dataPin);

  float t = DHT.temperature;
  float h = DHT.humidity;

  u8g.setFont(u8g_font_fub25); //https://github.com/olikraus/u8glib/wiki/fontsize
  u8g.setPrintPos(40, 32);
  u8g.print(t, 0);
  u8g.setFont(u8g_font_fub25);
  u8g.setPrintPos(40, 64);
  u8g.print(h, 0);
  u8g.setFont(u8g_font_fub25);
  u8g.drawStr(95, 32, "C");
  u8g.setFont(u8g_font_ncenB12);
  u8g.drawStr(85, 15, "o");
  u8g.setFont(u8g_font_fub25);
  u8g.drawStr(85, 64, "%");

}

Code for DHT22

#include <U8glib.h> //https://github.com/olikraus/u8glib/wiki
#include <dht.h> //http://playground.arduino.cc/Main/DHTLib

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);

# define dataPin 8

dht DHT;

void setup() {


}

void loop() {

  u8g.firstPage();
  do {
    draw();
  } while ( u8g.nextPage() );
  delay(1);
}

void draw() {

  int readData = DHT.read22(dataPin);

  float t = DHT.temperature;
  float h = DHT.humidity;
 
  u8g.setFont(u8g_font_fub25); //https://github.com/olikraus/u8glib/wiki/fontsize
  u8g.setPrintPos(10, 32);
  u8g.print(t, 1);
  u8g.setFont(u8g_font_fub25);
  u8g.setPrintPos(10, 64);
  u8g.print(h, 1);
  u8g.setFont(u8g_font_fub25);
  u8g.drawStr(95, 32, "C");
  u8g.setFont(u8g_font_ncenB12);
  u8g.drawStr(85, 15, "o");
  u8g.setFont(u8g_font_fub25);
  u8g.drawStr(85, 64, "%");

}

So, maybe someone have experience with this? I don’t have normal thermometer with temperature and humidity identification. So, I can’t calibrate my sensors right now !

Yes, I tried sensors with 2 sec delay as it is recommended in datasheet ! The same results !

And I re- soldered all connections on both DHT11 modules. The same results !

The DTH11 is not very accurate. The DHT22 temperature should be okay.
The humidity is not very good for both. If you bought a DHT22 from Ebay, it might be not-calibrated or wrapped in the wrong plastic, and the humidity value will be very wrong.

A bad DHT11 could tell that the humidity is 20%, while it is 80%.

The DHT11 returns a negative error if there is a problem communicating with the DHT11. Do you test the return value of read11 ?

You should add a delay. For example 2 seconds at the end of the loop.

A common mistake with temperature sensors is that they could be near a voltage regulator, or in a draft, or next to a computer fan outlet. That could cause a different temperature of a few degrees. A room feels the same temperature to a person, but it is not.

The DHT11 returns a negative error if there is a problem communicating with the DHT11. Do you test the return value of read11 ?

No, I must explore and try it ! :wink:

You should add a delay. For example 2 seconds at the end of the loop.

If I add 2 seconds at the end of the loop, oled display can't fast redraw screen. Display make a really long delay to update screen. I don't know why. :frowning: There I asked for help without delay http://forum.arduino.cc/index.php?topic=396986.0

A common mistake with temperature sensors is that they could be near a voltage regulator, or in a draft, or next to a computer fan outlet. That could cause a different temperature of a few degrees. A room feels the same temperature to a person, but it is not.

No, my breadboard are on table and I only change sensors, other parts stay!