PDA

View Full Version : dht22 using bit field array and ext references



richard
- 3rd March 2015, 00:16
I thought I would have a go at making a better dht reading routine , note this code uses a 64mhz clk that conveniently provides a 1uS increment with for a timer prescale of 16. if you choose a different clk then the timer prescale and or the timing limits will need adjusting.

mackrackit
- 6th March 2015, 14:50
Hi Richard,

Have you tested the length of cable/wire that can reliably be used with these sensors? And if you have, does it make a difference if the resistor is at the sensor or at the PIC?

richard
- 6th March 2015, 17:05
Have you tested the length of cable/wire that can reliably be used with these sensors? And if you have, does it make a difference if the resistor is at the sensor or at the PIC?
no not at all I have the unit mounted on the cpu pcb with no pull up resistor at all , just using wpub and a 3.3v rail. The data sheet (am2302) implies that 100m transmission is possible with a 1k pull up and shielded cable . not really sure why the pull up resistor location would make a difference assuming that the cable resistance is very low compared to the pull up value . my remote sensor (outside) is a wireless connection with a rfm69cw , so cable transmission is not something I have looked into

mackrackit
- 7th March 2015, 21:32
Thanks Richard. I have used the DHT11 with 50 foot of wire and the resistor at the MCU. My boy is trying a DHT22 with the resistor at the module. He is getting strange readings. I have not seen his setup yet to figure out the problem.

richard
- 1st April 2015, 03:20
with a little bit more code now it can do dht11 and dht22 sensors just by setting a var sens_type to 11 or 22

see this thread for adjusting timers for a different fosc

http://www.picbasic.co.uk/forum/showthread.php?t=19873