rpiuser2016
Posts: 81
Joined: Tue Jan 12, 2016 1:53 pm

Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 8:33 am

Good day everyone. I have an Raspberry Pi2B + two DTH22 sensors ( https://www.aliexpress.com/item/2-pcs-D ... 21151.html)

To read sensors data, I am using ADAfruit Python DTH library - https://www.instructables.com/id/Raspbe ... midity-lo/

Then I connect sensors with a short cables (approximatly 30 cm) to Raspberry Pi2B, everything goes fine, I can read temperature and humidity from both sensors.

I want to put one sensor outside the window to measure weather, so i connect this DTH22 sensors to Pi2 with a wire (LAN) with length about 1.5 meters. And my DTH22 fail to work. Now it is ureachable, or read some strange data, for example humidity 3388%.

Have anyone tested, that is the maximum length of a cable to connect DTH22 to RPI2B?

pcmanbob
Posts: 13298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 10:50 am

Hi.

Did you even bother to google the question.

first result in a list of about 218,000 results

http://www.home-automation-community.co ... -as-chart/

The maximum cable length can be up to 30 meters / 98 feet if you use 5 V power and 1 meter / 3.3 feet if you use 3.3 V power (see Datasheet).
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

rpiuser2016
Posts: 81
Joined: Tue Jan 12, 2016 1:53 pm

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 11:21 am

I knew, that according to Google, the maximum length is up to 30 meters, but have anyone test it? As a fact, I cannot read values from sensor at a lenght over 1.5 meters

rpiuser2016
Posts: 81
Joined: Tue Jan 12, 2016 1:53 pm

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 11:27 am

Oh MAN, 30 meters if power supply 5V and only 1 meter if power supply 3.3 V. I will test later

NotRequired
Posts: 339
Joined: Sat Apr 29, 2017 10:36 am
Location: Denmark

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 11:30 am

If the wire is too long or too thin the voltage will drop to a point where the sensor does no longer work. Try to put your wire, voltage and amp into this calculator and see how it goes: http://www.calculator.net/voltage-drop-calculator.html
rpiuser2016 wrote:
Mon Oct 23, 2017 11:27 am
Oh MAN, 30 meters if power supply 5V and only 1 meter if power supply 3.3 V. I will test later
I doubt this is true, but it depends on the used wire gauge.
Glowing in the dark!

rpiuser2016
Posts: 81
Joined: Tue Jan 12, 2016 1:53 pm

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 11:35 am

I am using good and thick wire, I have tested voltage on a sensors pins of DHT22:

3.27 V if power supply 3.3 V,
4.96 V if power supply 5 V

danjperron
Posts: 4208
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 11:36 am

For outside connection using a DTH22 I prefer another method which imply no wire and it is good for 3 months.

viewtopic.php?f=44&t=104359&p=1156616&h ... 01#p742704

http://temp.is-very-nice.org

I do have the sensor outside for 2 years and it's working fine. It is also connected to my echo dots.

https://www.dropbox.com/s/zykyqqtk0fqpj ... e.MP4?dl=0

danjperron
Posts: 4208
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 1:42 pm

I am using good and thick wire, I have tested voltage on a sensors pins of DHT22:
Try to add a 0.1uF between the ground and vcc at the sensor. Also decrease the pull up resistor to 3K3, or put two 4K7 on both ends, to reduce the capacitance effect of the cable. A long cable increase de capacitance and also create reflection effect. By decreasing pull up resistor you increase de slew rate, making the waveform more square.

You could also power up your DHT22 with 5V and use a adafruit/sparkfun 3.3V converter. This is a mosfet which is activated by 0V only. On 3.3V and 5V the system only see the pull-up resistor.

rpiuser2016
Posts: 81
Joined: Tue Jan 12, 2016 1:53 pm

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 8:15 pm

I have tested a wire about 5 meters. It does not work on 3.3 V power, successfully works on 5V power. Tomorrow I will test a wire about 25-30 meters

pcmanbob
Posts: 13298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 8:22 pm

rpiuser2016 wrote:
Mon Oct 23, 2017 8:15 pm
I have tested a wire about 5 meters. It does not work on 3.3 V power, successfully works on 5V power. Tomorrow I will test a wire about 25-30 meters
If you were using 5v to power your sensor I hope you converted the 5v signal back to the gpio to 3.3V or you will damage your pi.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

rpiuser2016
Posts: 81
Joined: Tue Jan 12, 2016 1:53 pm

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 8:32 pm

Thanx. I think that the pull-up resistor is already assembled into this sensor - https://www.aliexpress.com/item/2-pcs-D ... 21151.html

As you can see, there are a blue board before DHT22


pcmanbob
Posts: 13298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 23, 2017 9:34 pm

rpiuser2016 wrote:
Mon Oct 23, 2017 8:32 pm
Thanx. I think that the pull-up resistor is already assembled into this sensor - https://www.aliexpress.com/item/2-pcs-D ... 21151.html

As you can see, there are a blue board before DHT22
Looking at the sensor it looks like you are pulling the output of the sensor up to VCC which when you run the sensor with a 5v supply as you have been you are pulling the output up to 5v .

This means you are putting 5v on the pi gpio the pi gpio is not 5v tolerant and you will damage your pi.

if you are going to run your sensor on 5v do as danjperron said.
danjperron wrote:
Mon Oct 23, 2017 1:42 pm
You could also power up your DHT22 with 5V and use a adafruit/sparkfun 3.3V converter. This is a mosfet which is activated by 0V only. On 3.3V and 5V the system only see the pull-up resistor.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

rpiuser2016
Posts: 81
Joined: Tue Jan 12, 2016 1:53 pm

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 30, 2017 11:14 am

1) Pi 2B is not damaged without any additional resistor - every thing works fine for 2 week
2) DHT22 with supply of 5 V works perfect then wire length is about 6 meters
3) DHT22 with supply of 5 V does not work then wire length is more than 10 meters. It returns right value once per 10-20 attemps

User avatar
jadro
Posts: 456
Joined: Sun Oct 02, 2016 1:20 pm
Location: Croatia

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 30, 2017 11:32 am

Did you try to connect with CAT5 one wire from cable? I read a year ago that CAT5 handle 3.3 V with 5 meters long wire. Try and writte comments about this to others to know!

Jadro
Oracle backend database developer
SmartHome IoT & Microprocessor enthusiast and hobbyist

rpiuser2016
Posts: 81
Joined: Tue Jan 12, 2016 1:53 pm

Re: Rapberry Pi2 B + DHT 22 - ERROR THEN WIRE LENGTH >1METER

Mon Oct 30, 2017 12:28 pm

CAT 5 wire with a power 3.3 V works not far then 1 meter

Return to “General discussion”