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

Forum de support pour les locuteurs de la langue française qui souhaitent écrire dans leur langue maternelle.

Moderator: Benj

Post Reply
User avatar
cubitus54
Flowcode v5 User
Posts: 110
Joined: Wed Jun 19, 2013 7:18 am
Has thanked: 7 times
Been thanked: 32 times

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

Post 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 13692 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 13692 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
Flowcode V6.1.2.0(11 05 2015)

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times

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

Post 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!!
Attachments
Uno_one-wire.fcfx
My program.
(11.71 KiB) Downloaded 655 times

User avatar
cubitus54
Flowcode v5 User
Posts: 110
Joined: Wed Jun 19, 2013 7:18 am
Has thanked: 7 times
Been thanked: 32 times

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

Post 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 661 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
Flowcode V6.1.2.0(11 05 2015)

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times

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

Post 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.

User avatar
cubitus54
Flowcode v5 User
Posts: 110
Joined: Wed Jun 19, 2013 7:18 am
Has thanked: 7 times
Been thanked: 32 times

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

Post 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
Flowcode V6.1.2.0(11 05 2015)

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times

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

Post 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.

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times

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

Post 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.

User avatar
cubitus54
Flowcode v5 User
Posts: 110
Joined: Wed Jun 19, 2013 7:18 am
Has thanked: 7 times
Been thanked: 32 times

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

Post 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
Flowcode V6.1.2.0(11 05 2015)

407charles
Posts: 122
Joined: Thu Jun 26, 2014 12:01 pm
Has thanked: 41 times
Been thanked: 19 times

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

Post by 407charles »

Got it, thank you very much. I will see you soon.

Post Reply