Help with programming the sensor DHT11

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Help with programming the sensor DHT11

Post by nc56 »

Hello
to finich my program http://www.matrixmultimedia.com/mmforum ... =3&t=11509
I need a help to program the sensor DHT 11 with flowcode using 16f877A
Does somebody worked with this sensor ?
Really I need your help
Thank you

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Help with programming the sensor DHT11

Post by JohnCrow »

Hi
Sorry , Im not familiar with that sensor.
I've just looked on you-tube and there are a lot of tutorials about it with both PICs and Arduinos
Maybe you will find some information on that site.
1 in 10 people understand binary, the other one doesn't !

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Hi

I am writing code for you for the chip with the help of Ben's earlier post. Hopefully I can finish that tonight.

Thanks,
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Help with programming the sensor DHT11

Post by Steve001 »

have a look here may be of some use

http://embedded-lab.com/blog/?p=4333

Steve
Success always occurs in private and failure in full view.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Hi Steve

I am using that link and Ben's macro for data read to write flowcode file. You have guided to right one.
Enamul
University of Nottingham
enamul4mm@gmail.com

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: Help with programming the sensor DHT11

Post by nc56 »

thank you for you help :)
I m also trying to write the code in flowcode but i didn't arrive yet :(

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: Help with programming the sensor DHT11

Post by nc56 »


User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Yes, I have seen that.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Here is the code I have been working on..I have followed the c code given in the following link
http://embedded-lab.com/blog/?p=4333
Most of the thing I have tried to follow and even PIC but you can change that to any PIC you want. Please let me know how it's behaving. I don't have the sensor that's why I can't test it but hopefully it will work.
Attachments
DHT11.fcf
(26.08 KiB) Downloaded 619 times
Enamul
University of Nottingham
enamul4mm@gmail.com

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: Help with programming the sensor DHT11

Post by nc56 »

Thank you so much ; I will test it in the test board and i will tell you the result
I hope that it work :)

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: Help with programming the sensor DHT11

Post by nc56 »

Hello Enamul
The code of the dht11 doesn't work , it shows always No response from the sensor
I tested he .hex of http://embedded-lab.com/blog/?p=4333 and it works correctly
so I am trying to change some parametres

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Hi

I think there is a problem in the code for managing TMR0..I have modified that. Can you please try now? By the way what crystal frequency you are using for the code I have posted? Time is very critical for this device and the code.
It need to be 4MHz..
Attachments
DHT11.fcf
(27.15 KiB) Downloaded 439 times
Enamul
University of Nottingham
enamul4mm@gmail.com

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: Help with programming the sensor DHT11

Post by nc56 »

yes I am using the 4MHZ crystal
ok i will try this code now

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: Help with programming the sensor DHT11

Post by nc56 »

now it didn't show anything ! I wrote "hello" in the beginnig of the program to see if te program is running and it is shown
then nothing in te LCD ! and when I remove the data pins it shows checkSum ERROR
that means that CheckSum is not equal to (RH_Byte1 + RH_Byte2 + T_Byte1 + T_Byte2)
so the program entred in the working mode .

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Yes, you are right. If it's showing nothing in the LCD that means program entered in the working mode. That's a good sign. But it seems to me now that Read_Byte macro is not working properly. If it stuck at some point only then LCD can be blank otherwise LCD should say "Checksum error!" or right results. I have to have a look again in the Read_Byte macro..but that is ok I think as Ben has written that.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Hi
I have checked the code but I can't get any issue. Just disabled TMR0 after timing requirements. You can try if still don't work what I can do I have to order one for me to test practically. You have to wait couple of days in that case.
Attachments
DHT11.fcf
(27.79 KiB) Downloaded 316 times
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Hi

I have ordered one for me..I will get that in Friday..so hopefully we can solve that by Friday
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Hi

One more try with change in checksum...as the datasheet says checksum will be the last byte of the summation of first 4 bytes.
Attachments
DHT11.fcf
(28.09 KiB) Downloaded 403 times
Enamul
University of Nottingham
enamul4mm@gmail.com

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: Help with programming the sensor DHT11

Post by nc56 »

Nothing has changed
OK Enamul ; until that moment I will try with it again
Tank you so much :)

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Have you tried my last post?
Enamul
University of Nottingham
enamul4mm@gmail.com

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: Help with programming the sensor DHT11

Post by nc56 »

yes I tried it but nothing new ; when I removed the dht11
and I start the lcd shows CheckSum Error !! Normally it goes to NOT response , isn't ?

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

After spending one whole evening I have manged to make the sensor working... :mrgreen:

I will make a separate thread for that...I will post link to you..but you need 20MHz crystal 4MHz isn't enough for this.
Enamul
University of Nottingham
enamul4mm@gmail.com

nc56
Posts: 60
Joined: Thu Nov 15, 2012 1:21 pm
Has thanked: 14 times
Been thanked: 4 times
Contact:

Re: Help with programming the sensor DHT11

Post by nc56 »

Good work , what was the problem in the precedent proram ? No problem for the quartz
I think it's the same thing when I use it with another pic 18f , I mean th horloge doesn't change
Thanks

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Help with programming the sensor DHT11

Post by Enamul »

Enamul
University of Nottingham
enamul4mm@gmail.com

Post Reply