Page 1 of 1

Capteurs d'humidité et de température DHT11, DHT22, AM2302

Posted: Thu Aug 20, 2015 4:06 pm
by cubitus54
Bonjour,

Je vous présente mon programme pour lire les capteurs d'humidité et de température DHT11, DHT22, AM2302

Ce capteur transmet 40 bits: l'humidité en 16 bits, la température en 16 bits, et une somme de contrôle en 8 bits.
trame.gif
trame.gif (5.77 KiB) Viewed 13393 times
DHT11 humidité en 8 bits, température 8 bits (boitier bleu)
DHT22 ou AM2302 humidité en 16 bits, température en 16 bits. (Boitier blanc)
capteur.jpg
capteur.jpg (27.04 KiB) Viewed 13393 times
Branchement Port F0 ou An0 sur Arduino pour les autres l'adaptation est facile.
Le programme
DHT22.png
(334.45 KiB) Downloaded 5608 times

Re: Capteurs d'humidité et de température DHT11, DHT22, AM23

Posted: Fri Aug 21, 2015 7:02 pm
by 407charles
How you doing cubitus54, I'm glad to work with you again. I really appreciate your time and help. I study your program an it looks awesome. I tried to run it yesterday but it did not work, I'm not sure in what phase but is getting locked up in one of the loops because my display macro is at the end and it's not being run. I double check today and I had one of the delays in 40ms. instead of 40us. could this be the problem? I'm posting my program, could you take e look at it? You maybe able to find if I did a mistake or just not using the right settings. I appreciate your help in these topics because I'm never hed the chance of implementing them, and still some of them a mystery for me. I'm reading and studying more in my free time. I learned a lot by just studying the programs you shared with me, Thanks a lot!!

Re: Capteurs d'humidité et de température DHT11, DHT22, AM23

Posted: Sat Aug 22, 2015 7:49 am
by cubitus54
Hello,

Ce n'est pas possible de simuler le programme sur Flowcode.
Il faut le tester avec un microcontrôleur.

Voici le programme que je n'avais pas pu mettre (3 PJ maxi) (Importer Macro)
mesureDHT.fcm
(3.64 KiB) Downloaded 647 times
Voici une application qu'il est possible de faire en l'interfaçant avec Matlab Simulink.
DHT11.png
(31.87 KiB) Downloaded 5566 times

Re: Capteurs d'humidité et de température DHT11, DHT22, AM23

Posted: Sat Aug 22, 2015 2:31 pm
by 407charles
Thanks for your reply. I did run it in the micro-controller but it just display 255 as a value at both, temperature and humidity. I did try to open your program but is in a different format, I could not opened it with Flowcode. How can I see it? Thanks a lot for your help.

Re: Capteurs d'humidité et de température DHT11, DHT22, AM23

Posted: Sat Aug 22, 2015 4:13 pm
by cubitus54
407charles wrote:Thanks for your reply. I did run it in the micro-controller but it just display 255 as a value at both, temperature and humidity. I did try to open your program but is in a different format, I could not opened it with Flowcode. How can I see it? Thanks a lot for your help.
Menu -> Macro -> Import

Re: Capteurs d'humidité et de température DHT11, DHT22, AM23

Posted: Sat Aug 22, 2015 5:51 pm
by 407charles
Hello my friend, now I can see some activity in my display but the variable values are in a 16 bit format right? How do I separate the integers numbers from the decimal numbers? It's 8 bit integral humidity - 8 bit decimal humidity - 8 bit integral temp. - 8 bit decimal temp. How can I achieve the right display reading? Thanks a lot for your support.

Re: Capteurs d'humidité et de température DHT11, DHT22, AM23

Posted: Sun Aug 23, 2015 12:02 am
by 407charles
I finally did it! Thanks a lot my friend, I really appreciated. I believe I found the way to display the humidity and temp.in real numbers. I have to check vs. a digital humidity temp. I got at work. I would not accomplished this without your expertise. See you soon.

Re: Capteurs d'humidité et de température DHT11, DHT22, AM23

Posted: Sun Aug 23, 2015 7:16 am
by cubitus54
Hello,

For the DHT11
8 bit integral humidity
8 bit decimal humidity =0
8 bit integral temp.
8 bit decimal temp =0

Le DHT11 ne transmet que l'entier sur 8 bits en BCD, la partie décimale =0
Le DHT22 transmet la partie entière et décimale en BCD sur 16 bits

Re: Capteurs d'humidité et de température DHT11, DHT22, AM23

Posted: Sun Aug 23, 2015 6:01 pm
by 407charles
Got it, thank you very much. I will see you soon.