DHT11 to DHT22!

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

DHT11 to DHT22!

Post by jgu1 »

Hi All!

I have played with Enamul's and John's fine examples of DHT11 which works very very well. I can see that DHT22 has greater accuracy. And I can see the data for the 2 sensors are not equal.

I've tried to look at the example of DHT11 (John's) FC to try to "decode" the program, but it contains C code which I am not able to read and therefore can not see how the 40 bits are read from DHT11.
I dare to ask, because I think it's a very good project and can be useful in many respects and deserves a DHT22 with greater accuracy, is it very difficult to change the program to a DHT22 sensor. :?: and someone will make the attempt. I myself am not able to do so. :roll:

John´s Poject http: //www.matrixmultimedia.com/mmforums/viewt ... t11#p44939

I would be very grateful if anyone can help....

Best regard

Jorgen
Attachments
DHT11 - Alarm-Eblock-Works.fcf
(48.52 KiB) Downloaded 700 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
Contact:

Re: DHT11 to DHT22!

Post by cubitus54 »

Hello,

I made this program for DHT11 or DHT22

It works very well :)
Warning this is a macro (macro import)
PGM_Humidite_Temp.fcm
(11.88 KiB) Downloaded 738 times
Flowcode V6.1.2.0(11 05 2015)

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Cubitus!

Thank you very much, I am very greatfull. I Will test it later today and you hear from me. :D :D
But I wonder how it is possible to use both DHT11 and 22 in same program.

Thanks in advance

Jorgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Again Cubitos!

I have tested your macro. I made a program (att.) The only thing I see in the display is 0,% and 0, c. I use a Pic16f876a and change the input for the DHT22 to C4

Are you able to se what i have done wrong?

Best regard

Jorgen
Attachments
DHT22.fcf
(23.49 KiB) Downloaded 706 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
Contact:

Re: DHT11 to DHT22!

Post by cubitus54 »

Hello,

Must leave some time between acquisitions (eg 0.5 s)

Must adjust the value. "Chrono>35" depending on the speed of the microcontroller. 35 is a PIC 64MHz. At 19MHz, your good value should be around the value 10.
Image1.gif
Image1.gif (8.15 KiB) Viewed 25598 times
MSO4014_20140424-202310.png
(22 KiB) Downloaded 18468 times
Flowcode V6.1.2.0(11 05 2015)

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Again!

Now humidity seem to work :lol: But not the temp. If I change the same Crono for temp I get the value 10,2c but it stuck´s same value all the time.

I don´t understand 100% where I have to place a delay for 500ms "Must leave some time between acquisitions (eg 0.5 s)".

B R.

Jorgen

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

Re: DHT11 to DHT22!

Post by cubitus54 »

For the 500ms
Image3.gif
Image3.gif (6.03 KiB) Viewed 25591 times
You can try to change the value 8 9 10 11 12 of .chrono,

You can also try changing the first delay 2ms to 4ms
Flowcode V6.1.2.0(11 05 2015)

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Again and Again! :D

Meanwhile I found a bug ( I made ), now it Work :D :lol: Wery nice, and looks very promising. Compared with my proff. reference humidity/temp. measure, they are very equal :D

again thank you very much your help. :wink:

Best regard

Jorgen

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

Re: DHT11 to DHT22!

Post by cubitus54 »

I'm happy for you :D
Flowcode V6.1.2.0(11 05 2015)

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi!

If anyone is interested I would like to share with you all.

It works very fine the readout from DHT22 Cubitus made. :D

B Regard

Jorgen
Attachments
DHT22.01.fcf
(23.93 KiB) Downloaded 704 times

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Cubitus!

Oooopps. During test I discovered when the temerature is lower than 10 degre the display begin to show 99,c and 98,c ect.

I could imagine it is the decimal place which is not correct when below 10,0c :?:

Will you help me to correct this. Pls

Best regard

Jorgen

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

Re: DHT11 to DHT22!

Post by cubitus54 »

Yes :oops: :mrgreen:
Image1.gif
Image1.gif (21.16 KiB) Viewed 25552 times
Flowcode V6.1.2.0(11 05 2015)

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Ok you Can se it!

But the only ting I understand is "To string funtion" and I could imagine this is not the problem :?:

Is it possible to solve, and do you have an idea :?:

B R.

Jorgen

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

Re: DHT11 to DHT22!

Post by cubitus54 »

Sorry, I do not understand your question ...
DHT22.fcf
(22.98 KiB) Downloaded 669 times
Flowcode V6.1.2.0(11 05 2015)

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Again!

Sorry but my English is not so good.

What I meant, was that of all your calculations, in the calculation box, was the only thing I could figure out was the "to string" command. :D :D ( I do not have the deep experience with programming as you have).

I see you have been so kind to make a new FCF file or changes for me. I'll test it tomorrow. You hear from me.

So far, many thanks.

Jorgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Cubitus!

I have tested the temperature with coolspray: IT IS PERFECT : :D :D
For the humidity I am not able to test this. I have no dry air on spray :lol: But i suppose you have corrected the bug for both.

Thank´s Again Cubitus.


Best regard :D

Jorgen

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

Re: DHT11 to DHT22!

Post by cubitus54 »

Hello,

No, I did not correct the humidity, I do not know if this is really useful.
The humidity of the air diminishes very rarely below 30%
The principle is the same as for the temperature.
Flowcode V6.1.2.0(11 05 2015)

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

Re: DHT11 to DHT22!

Post by cubitus54 »

Hello

For the négative temp.
temp_neg.gif
temp_neg.gif (12.06 KiB) Viewed 23970 times
◎Special Instructions:
When the temperature is below 0 ℃, the highest position of the temperature data.
Example: -10.1 ℃ Expressed as 1 000 0000 0110 0101
Temp.:0000 0000 0110 0101 = 0065H(Hexadecimal)= 6×16 +5 = 101
=> Temp. = -10.1℃
Attachments
DHT22.fcf
(23.56 KiB) Downloaded 501 times
Flowcode V6.1.2.0(11 05 2015)

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Cubitus!

Thank you very very much. I am really grateful.

I will test it tonigth, and you hear from me.

One more small thing. I have 10 pc of DHT22. When I test them in same program and hardware, I get 10 different result, in temp and humidity, small differences. So in my view, its the DHT22 which not is 100% accurate. If I have one DHT22 wich I want to use as reference, where in the program in calculationbox can I add + or - to adjust it so it fit to my reference.

Hope it´s not to much :D

Thank´s in advance.

Jorgen

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

Re: DHT11 to DHT22!

Post by cubitus54 »

Hello

You put a variable or constant with offset

offset = 3 for example (+0,3°C)

Code: Select all

.temperature = .temperature + offset
.temperature = .temperature AND 0x03ff
.entier = .temperature / 10
...
OR

Code: Select all

.temperature = .temperature + 3
.temperature = .temperature AND 0x03ff
.entier = .temperature / 10
...
:D
Flowcode V6.1.2.0(11 05 2015)

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Again Cubitus!

Again thank´s. You get a reply. :D

BR.

Jorgen

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Cubitus!

I am sorry, but the last version doesn't work. The temperaturen is stocking, never changing even when the temperature is changing. The display show the same temp when I start. The humidity seemed to work.

Br.

Jorgen

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

Re: DHT11 to DHT22!

Post by cubitus54 »

Hello,

I have not tested on the hardware ... Normally it should work.

Cubitus
Flowcode V6.1.2.0(11 05 2015)

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DHT11 to DHT22!

Post by jgu1 »

Hi Again

Ok, but it doesn´t Work. The temp is "stock" it only change temperature when I reset the Pic. If I put the "old" program in the same hardware Again, it Work Again (without minus)

Sorry. :(

Br. Jorgen

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: DHT11 to DHT22!

Post by kersing »

Jorgen,

Could you post the contents of the calculation box?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Post Reply