Measurement of temperature and relative humidity using DHT11

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

Hi,
I tried DHT11v1.01.fcf with ECIO-40P. But it gives CheckSum Error, Trying again... Can you help me please.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9141
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Measurement of temperature and relative humidity using D

Post by medelec35 »

Hi paridhi,
The errors are caused because ECIO-40 has a 16bit timer0 but the V5 flowchart was designed for 16F877A which has a 8bit timer.
Therefore all the C code blocks referring to tmr0 will produce an error.
You could use timer2 instead of timer0 and change all

Code: Select all

 tmr0 
to

Code: Select all

tmr2
.
Also when changing timer interrupt component to timer 2, it would be best if you can change to the following values:

Code: Select all

Prescaler = 1:4
Postscaler = 1:3
Rollover = 205.
Then if all goes correctly should compile:

Code: Select all

File name:     C:\Users\Martin\Downloads\DHT11v1.01.c
Title:         
Description:   
Generated by:  Flowcode v5.5.2.1
Date:          Wednesday, April 06, 2016 22:22:06
Licence:       Professional
Registered to: Martin ********
Licence key:   6HEP0Q
http://www.matrixmultimedia.com
Launching the compiler...
C:\Program Files (x86)\Flowcode\v5\Tools\boostc\boostc_pic18_flowcode.exe -v -t PIC18F4455 "DHT11v1.01.c"
BoostC Optimizing C Compiler Version 7.04 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2011 Pavel Baranov
Copyright(C) 2004-2011 David Hobday

Licensed to FlowCode User under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


DHT11v1.01.c
Starting preprocessor: C:\PROGRA~2\Flowcode\v5\Tools\boostc\pp.exe DHT11v1.01.c -i C:\PROGRA~2\Flowcode\v5\Tools\boostc\include -d _PIC18F4455 -la -c2 -o DHT11v1.01.pp -v -d _BOOSTC -d _PIC18 -d _CHAR_INDEX 


.............................

DHT11v1.01.c success

success
Return code = 0
Launching the linker/assembler...
C:\Program Files (x86)\Flowcode\v5\Tools\boostc\boostlink_pic.exe -rb 0x800 -ld "C:\Program Files (x86)\Flowcode\v5\Tools\BoostC\lib" libc.pic18.lib rand.pic18.lib float.pic18.lib "DHT11v1.01.obj" -t PIC18F4455 -d "C:\Users\Martin\Downloads" -p "DHT11v1.01"
BoostLink Optimizing Linker Version 7.03
http://www.sourceboost.com
Copyright(C) 2004-2011 Pavel Baranov
Copyright(C) 2004-2011 David Hobday


Warning unreferenced functions removed:
	 FC_CAL_Port_In__x	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_IO.c
	 FC_CAL_Port_In_DDR__x	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_IO.c
	 FC_CAL_Port_Out__x	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_IO.c
	 FC_CAL_Port_Out_DDR__x	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_IO.c
	 Wdt_Delay_S	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Delay.c
	 FCI_DELAYINT_US	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Delay.c
	 FCI_DELAYINT_MS	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Delay.c
	 FCI_DELAYINTWDT_MS	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Delay.c
	 FCI_DELAYINT_S	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Delay.c
	 FCI_DELAYINTWDT_S	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Delay.c
	 FCI_GETCHAR	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_GETLENGTH	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_MIDSTRING	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_LEFTSTRING	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_RIGHTSTRING	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_TOSTRING	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_TOLOWER	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_TOUPPER	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_COMPARE	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_FLOAT_TO_STRING	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_NUMBER_TO_HEX	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_STRING_TO_INT	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_STRING_TO_FLOAT	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_STRREV	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_STRMOV	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_SHEAD	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 FCI_SCOPY	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_String.c
	 isinf	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Float.c
	 flt_round	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Float.c
	 flt_floor	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Float.c
	 flt_ceil	 in: C:\Program Files (x86)\Flowcode\v5\CAL\PIC\PIC_CAL_Float.c
	 FCD_LCDDisplay0_Command	 in: C:\Users\Martin\Downloads\DHT11v1.01.c
	 FCD_LCDDisplay0_ScrollDisplay	 in: C:\Users\Martin\Downloads\DHT11v1.01.c
	 FCD_LCDDisplay0_ClearLine	 in: C:\Users\Martin\Downloads\DHT11v1.01.c
	 FCD_LCDDisplay0_RAM_Write	 in: C:\Users\Martin\Downloads\DHT11v1.01.c

Building CASM file
Memory Usage Report
===================
RAM available:2048 bytes, used:73 bytes (3.6%), free:1975 bytes (96.4%), 
Heap size:1975 bytes, Heap max single alloc:127 bytes
ROM available:22528 bytes, used:2872 bytes (12.8%), free:19656 bytes (87.2%)



success
Return code = 0

FINISHED
Martin
Martin

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9141
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Measurement of temperature and relative humidity using D

Post by medelec35 »

To make life that bit easier, I have converted DHT11v1.01.fcf to work with a lot more devices.
So should work with ECIO40P or a 16F1937 with internal osc or external crystal from 16MHz.

Only way I could think of doing that is to remove timer interrupt altogether and just use delays.

Martin
Attachments
DHT11v1.01 No timer interrupt.fcf
(38.91 KiB) Downloaded 401 times
Martin

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

I tried DHT11v1.01 No timer interrupt.fcf, its not working. When I displayed the delay count, it showed 4 .
I also did the above mentioned setting of presacalar ratios and timers in DHT11v1.01.fcf program. It always give checksum error.
My Dht11 is working correctly, I checked it with Arduino microcontroller.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9141
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Measurement of temperature and relative humidity using D

Post by medelec35 »

I tried my DHT11 with ECIO40p and I got the humidity and temp displayed OK with the non timer interrupt version.
Are you referring to ECIO-40p Eblock?
Martin

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

I am using the USB programmable microcontroller ECIO 40P. I have connected Dht11 directly through the bread board with the same connections as shown on the the first page. Can you send me the edited program of chip PIC 18F4455? Maybe I made an error somewhere...

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9141
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Measurement of temperature and relative humidity using D

Post by medelec35 »

Hi paridhi,
To make sure, I have downloaded

Code: Select all

DHT11v1.01 No timer interrupt.fcf
from a couple of posts above.
Changed target to ECIO-40
Re- programmed ECIO-40p and got the following:
ECIO-40P.jpg
ECIO-40P.jpg (96.79 KiB) Viewed 13365 times
If you are using with a separate 18F4455 and not ECIO-40p then the clock speed must be 16MHz or above.

If you have modified flowchart, then if you post it I can take a look at it for you.

Martin
Martin

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

DHT11v1.01 No timer interrupt.fcf shows Delay_count 1. Also the clock speed is 48MHz.
Attachments
P_20160415_181947_p.jpg
(1.29 MiB) Downloaded 4442 times

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

Sorry, I don't know how to make this picture small.
The clock frequency is by default 48MHz. As shown in datsheet.
Attachments
Untitled.png
(37.5 KiB) Downloaded 12080 times
Last edited by paridhi on Fri Apr 15, 2016 2:15 pm, edited 1 time in total.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9141
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Measurement of temperature and relative humidity using D

Post by medelec35 »

paridhi wrote:shows Delay_count 1. Also the clock speed is 48MHz.
Confused with that.
The flowchart shows :

Code: Select all

Delay = 25 
Also not sure if its the camera angle or not, but it looks like connection to DHT11 is going to port A1 and not port A0?
Martin

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

It is A0 port only.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9141
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Measurement of temperature and relative humidity using D

Post by medelec35 »

Must be camera angle then.
But A0 should be 4th socket along and looks like nothing in 4th, but red wire in 5th (A1)
Unless GND in in socket 2 in stead of socket 1 of bread board?
Can't tell from pic.
Just going over everything.
What's the colour bands on resistor?
Martin

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

yellow, purplel, red, golden 4.7k

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

and its A0 only. The pin is working fine. I just tested it. And it is getting signal from DHT11 (tested with led). DHT11 is working fine (also tested).
However, it doesnt Checksum error now. When i remove the wire and connect it again multiple times, it shows Checksum error then.

Ground is blue wire.

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

It worked, momentraily. I was testing the input provided by DHT11. Just as I removed it from the board, it showed the temp and humidity. Its not working properly due to Breadboard I think. :o

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

Thank you, alot.
Sorry, I wasted your time.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9141
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Measurement of temperature and relative humidity using D

Post by medelec35 »

paridhi wrote:Sorry, I wasted your time.
Please don't think that.
You have not wasted my time at all.
I'm here to help.
Martin

User avatar
stregato
Posts: 18
Joined: Tue Feb 25, 2014 12:28 am
Contact:

Re: Measurement of temperature and relative humidity using D

Post by stregato »

Good day to all
Someone could help me to adapt the code for Arduino UNO or NANO or MEGA Thanks

paridhi
Posts: 16
Joined: Tue Mar 29, 2016 6:16 pm
Contact:

Re: Measurement of temperature and relative humidity using D

Post by paridhi »

I thought my mistake was wires. But it was the the Delay used in Delay us. It had no value. The warning text was showing during compiling, but since it scrolled upwards, I didn't see it.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9141
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Measurement of temperature and relative humidity using D

Post by medelec35 »

So long as all is working.

Martin
Martin

Oderlando
Posts: 29
Joined: Tue Jul 17, 2018 11:30 am
Contact:

Re: Measurement of temperature and relative humidity using DHT11

Post by Oderlando »

Hi. I'm trying to show the humidity values, read by the DHT11 sensor, on a 7-segment 4-digit display, but I'm not getting it. I was able to display ADC values on the display, but I do not know how to do this for the DHT11. I'm posting the file to the test I did for the ADC. Could anyone modify it for me so that it shows the humidity reading of DHT11?
Attachments
Display_7Segments.fcfx
(11.18 KiB) Downloaded 58 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1233
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Contact:

Re: Measurement of temperature and relative humidity using DHT11

Post by QMESAR »

Hi.
It would be better if you post your flowchart that you tried ,people will more easily help with correcting your mistakes as
making the Flowchart for you
Regards
QMESAR

Oderlando
Posts: 29
Joined: Tue Jul 17, 2018 11:30 am
Contact:

Re: Measurement of temperature and relative humidity using DHT11

Post by Oderlando »

I'm posting the flowchart I've assembled so far. I could not progress in the formulas to be able to show the reading of the DHT11 in the display 7 segments of 4 digits. I am a beginner in FlowCode and I am doing a lot of research to try to achieve this.
Attachments
7Segment.JPG
7Segment.JPG (97.09 KiB) Viewed 5821 times
Display_7Segments.fcfx
(10.81 KiB) Downloaded 63 times

Oderlando
Posts: 29
Joined: Tue Jul 17, 2018 11:30 am
Contact:

Re: Measurement of temperature and relative humidity using DHT11

Post by Oderlando »

I've made a breakthrough. I can already display the numbers in the diplay. Now all I need to do is find out why this odd behavior of the numbers go up to 100 and return to zero as the humidity value increases to the maximum.
Attachments
Controle_Umidade.fcfx
(11.32 KiB) Downloaded 55 times

mnf
Valued Contributor
Valued Contributor
Posts: 1001
Joined: Wed May 31, 2017 11:57 am
Contact:

Re: Measurement of temperature and relative humidity using DHT11

Post by mnf »

Hi,

You are currently trying to display the humidity - but - the sensor can't be read particularly quickly so I would add a delay to your loop and also just wait until you have a read value before displaying anything.

And the variables need to be changed to floats - you are currently reading a float value into a byte which won't have the result you are after - you would need to use a float to read the humidity and temperature to.

Try something like:
Controle_Umidade1.fcfx
(10.5 KiB) Downloaded 74 times
- here I got the humidity as a string - but you could also use GetTempWhole etc to avoid the floating point math.

Martin

Post Reply