I am using the sample ReadTempAndHumidy (below), but getting error 253 starting with the second reading.
Looks like this:
Temperature: 28 °C Humidity: 72 %
Error 253 Reading from DHT11 timed out.
Error 253 Reading from DHT11 timed out.
Error 253 Reading from DHT11 timed out.
#include <DHT11.h>
DHT11 dht11(2);
void setup() {
Serial.begin(9600);
dht11.setDelay(1000); // Set this to the desired delay. Default is 500ms.
}
void loop() {
int temperature = 0;
int humidity = 0;
int result = dht11.readTemperatureHumidity(temperature, humidity);
if (result == 0) {
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.print(" °C\tHumidity: ");
Serial.print(humidity);
Serial.println(" %");
} else {
Serial.println(DHT11::getErrorString(result));
}
}
What's your hardware? At 3.3V your wiring has to be short. If you use bare sensor you need pullup.
Try with different library like dhtLib from Tillaart.
I find it strange and a little suspicious that these modules are made at all. It seems to contain a grand total of 2 components: the DHT11 and a 10K resistor. A bare DHT11 can be plugged straight into a breadboard, I've done that. And who doesn't have a 10K resistor? So what value is this module adding? My only answer is that the manufacturer can make more profit selling beginners this module than they could from selling the same beginners a DHT11 and a 10K resistor...
EDIT: OK, I may have worked it out. If you didn't have a breadboard, this module would be useful because you can simply connect it directly to an Uno with female-to-male Dupont wires. Those kind of wires probably would not make good contact with the pins of a bare DHT11 because the pins are quite thin. And without a breadboard, adding the 10K resistor would also be difficult.
But if you have a breadboard, you can save yourself a few pennies by buying a bare DHT11 and a 10K resistor. The module adds zero benefit if you have a breadboard.
Ok...
I suggest adding an external 10K resistor between the data pin and the Vcc pin of the DHT11. Most schematics for DHT11 show a 4K7 pull-up resistor. The combination of 2x 10K in parallel will be equivalent to that.
Also add a 0.1uF capacitor between the Vcc and ground pins of the DHT11, as close as you can get the cap to the DHT11.
Did you try another DHT11 library yet, as suggested by @kmin ?
I have not encountered the library you are using before, so trying a more commonly used one would be a good idea, to eliminate the possibility the library is at fault.
No, it's absolutely basic and commonplace. Almost every circuit has these 0.1uF "bypass" capacitors near major components like chips & sensors. It's better to add them always even if they don't seem to be needed, because they cost almost nothing and can avoid wasting loads of time trying to figure out why a circuit isn't behaving correctly.
Yes the web site was closed down by my ISP when they withdrew the free hosting you used to get. So I have transfered this tutorial to the Arduino site.