DHT11 and Atmega 8MHz
-
Hello everybody,
I have trouble with DHT11 on Atmega328 3.3V 8MHz. I use the Humidity sketch and I have a lot of reading error.
When I try the exemple sketch included in Arduino IDE, everything is ok, no error during 5 hours.
With the humidity sketch, I have an error every 5 or 7 readings. Maybe an error in the library with timing communication with DHT11??
Anybody can help me??
Thank you in advance.
-
The sleeping time is 30 seconds.
-
@Thibthib02 Modify the arduino ide example sketch to work with mysensors and try it .
-
The example sketch is too complicated to modify to work with mysensors. Nobody here use the Humidity sketch with arduino @ 8MHz?
-
Did you try what they suggest here:
http://forums.adafruit.com/viewtopic.php?f=19&t=46863
This is for the DHT22, but maybe it relates to the DHT11? They also use a different library I think, but you could integrate that easily, I suppose. -
I use this one => Adafruit
#include <DHT.h>#define HYGRO_PIN 4 // Pin DHT11DHT dht(HYGRO_PIN, HYGRO_TYPE);float hygrometrie_mem; float hygro_temp_mem;// hygrometrie MyMessage msg_hygro(HYGROMETRIE_CHILD, V_HUM);float hygro_temp = dht.readTemperature(); float hygrometrie = dht.readHumidity(); // isnan => Is Not A Number if (isnan(hygro_temp) || isnan(hygrometrie)) { Serial.println("Echec lecture du DHT"); } else if (hygro_temp != hygro_temp_mem) { hygro_temp_mem = hygro_temp; } Serial.print("Temperature hygro : "); Serial.print(hygro_temp); Serial.println('C'); if (hygrometrie != hygrometrie_mem) { hygrometrie_mem = hygrometrie; gw.send(msg_hygro.set(hygrometrie, 1)); Serial.print("Hygrometrie : "); Serial.print(hygrometrie); Serial.println('%'); } -
Hi,
no problem at all. The humidity scetch is running fine with a pure atmega328p-pu and a DHT11.
I have build it on a breadboard for you to see if it is working:

As you see, the sensor starts and sends temperature and humidity value:
sensor started, id 99 send: 99-99-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1 send: 99-99-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0 read: 0-0-99 s=255,c=3,t=6,pt=0,l=2:M send: 99-99-0-0 s=255,c=3,t=11,pt=0,l=8,st=ok:Humidity send: 99-99-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0 send: 99-99-0-0 s=0,c=0,t=7,pt=0,l=5,st=ok:1.4.1 read: 99-1-0 s=0,c=0,t=7,pt=0,l=5:1.4.1 send: 99-99-0-0 s=1,c=0,t=6,pt=0,l=5,st=ok:1.4.1 read: 99-1-0 s=1,c=0,t=6,pt=0,l=5:1.4.1 send: 99-99-0-0 s=255,c=3,t=0,pt=1,l=1,st=ok:62 read: 99-1-0 s=255,c=3,t=0,pt=1,l=1:62Normally I am using a DHT22 on my selfmade board.

Andreas
-
Maybe a bad DHT11. I will more investigate tomorrow. Thank you guys.
-
Hi,
no problem at all. The humidity scetch is running fine with a pure atmega328p-pu and a DHT11.
I have build it on a breadboard for you to see if it is working:

As you see, the sensor starts and sends temperature and humidity value:
sensor started, id 99 send: 99-99-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1 send: 99-99-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0 read: 0-0-99 s=255,c=3,t=6,pt=0,l=2:M send: 99-99-0-0 s=255,c=3,t=11,pt=0,l=8,st=ok:Humidity send: 99-99-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0 send: 99-99-0-0 s=0,c=0,t=7,pt=0,l=5,st=ok:1.4.1 read: 99-1-0 s=0,c=0,t=7,pt=0,l=5:1.4.1 send: 99-99-0-0 s=1,c=0,t=6,pt=0,l=5,st=ok:1.4.1 read: 99-1-0 s=1,c=0,t=6,pt=0,l=5:1.4.1 send: 99-99-0-0 s=255,c=3,t=0,pt=1,l=1,st=ok:62 read: 99-1-0 s=255,c=3,t=0,pt=1,l=1:62Normally I am using a DHT22 on my selfmade board.

Andreas
@Andreas-Maurer Nice looking board!!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login