Trouble running DHT22 over long (~8m) distance

Hi,

First up, I’ve posted to the Raspberry Pi forum and Adafruit forum on this, but hoping someone here might have the answer.

I’m planning on using a DHT22 connected to a Raspberry Pi to control a fridge and humidifier for a curing chamber. The DHT22 was working perfectly when I was testing it at 3.3V, but when I rewired it so it could reach the fridge about 8m away, the DHT22 stopped working. There were no other changes made other than replacing the wires with longer ones (5cm > 8m). On researching the issue, this seemed like an expected result and the solutions suggested include using shielded cable and running the DHT22 at 5V, rather than 3.3V, but I’m having little success.

I’m a total beginner and while there is a tonne of support and information available on how to:

  • Run the DHT at 3.3V from a Raspeberry Pi
  • Run the DHT at 5V from an Arduino

There is very little support for running the DHT22 at 5V from the Raspberry Pi where there is a need to reduce the signal voltage down to 3.3V. So, I’m reaching out and hoping someone here can help.

I’ve tried numerous things to try and get it working, but nothing seems to be giving reliably consistent results. The attempts I’ve made are:

  1. Replace standard wires with shielded cable and keep hookup the same (VCC = 3.3V) = Inconsistent readings, hangups and odd results including temperatures <0 and humanities > 3000%.

  2. Using this stepdown module as follows:


    No reading

  3. Wiring like this:


    Inconsistent readings, hangups and odd results including temperatures <0 and humanities > 3000%.

  4. Wiring like this:


    Inconsistent readings, hangups and odd results including temperatures <0 and humanities > 3000%.

I really want to use the Rpi and had everything working really well when the DHT22 was close to the Rpi, so I suspect that the software is fine and that this is a hardware/hookup issue. To rule out a faulty DHT22, I have ordered another one this morning and keen to give that a shot. If anyone can advice the technically correct way to run the sensor 8m from a Rpi that would be enormously appreciated.

Best Regards,
Daniel

Hi @Daniel67857, Do you need to have the RPi so far away? It might be simplest to just relocate the Pi to the fridge.


arb

1 Like

Thanks Arb, it would definitely be simple to leave the pi where it is. It already has a number of other things running to/from it.

That’s a shame @Daniel67857 - the simplest solution would have been to move the Pi. :wink:

Another possibility might be to use a wireless option - I have seen DHT22s mounted on an ESP wireless module (I think it was an ESP8266) - maybe something like this could work, then you could use (presumably) WiFi to collect the reading from the DHT22.

1 Like

Thanks again, Arb. Will have a look at that option. The other constraint is that the pi is already connected to the home Wifi network and I can’t easily run a network cable to it as it’s in a remote building. Really hadd my finger crossed there was a reliable way to get it to work at 8m.

@Daniel67857, my understanding is that the ESP will connect to your home WiFi, then your Pi can communicate with it wirelessly. Shouldn’t matter how far apart they are that way.

1 Like

Ahh, thanks Arb. That might be a good option.

Hey Daniel,
I would add a capacitor from the supply pin to ground Long cables are very prone to noise. I would also measure the resistance of the full cable and see how much voltage you are loosing over the full length.

Thanks Clinton. At what end of the cable would the capacitor go and what size should I use? Which wiring method should i go with?

Total resistance of each of the three wires in the 8m cable is about 40 ohms.

Just hooked up the new sensor and getting the same odd results at 8m, but perfect results at 5cm.

If you have a way to ground the sensor I would suggest a 100uF at each end of the cable, If not just the Pi side may do. The capacitors should be wired in so that the are connected to the supply line and ground(see picture below).

Another thing that might help would be to measure the voltage drop across the wires at each of the pins. Do you have an Oscilloscope that you can use to have a look at what the data signal is doing with?

1 Like

Thanks Clinton, unfortunately I don’t have an oscilloscope, but can give the capacitors a shot. Still concerned about the risk of sending 5v to the GPIO though. Is that a valid concern? I did measure the voltage drop and it was minimal (<0.1V).

Yeah it is, did you measure the voltage drop with the sensor running or under no load conditions? Yeah, be very careful that the voltage back to the PI does not exceed 3.3V. The capacitor will look like an open circuit to the DC 5V which is why we connect it like this. Do you have a logic level shifter that you could place on the Pi side of the circuit? Step down modules are generally designed for power supply and can be too noisy to do logic shifting.

Thanks again Clinton. Unfortunately no, I don’t have a logic level shifter. Would be happy to give it a crack, but starting to think the path of least resistance may well be to relocate the PI. I will try and add a capacitor at the pi end and run at 3.3V, but failing that, will just shift the PI i think.

Thanks allot for your support - much appreciated.

2 Likes

I have used logic level shifters similar to this one https://core-electronics.com.au/logic-level-shifter-4-channel-bidirectional.html with no problems - but moving the Pi might be the path of least resistance…

Let us know how it all works out. :+1:

Yeah, moving the Pi will definitely be the path of least resistance, long cables and high frequency are never friends.

Thanks again guys, will let you know how I go.

1 Like

Thanks again for your help Arb and Clinton. Just circling back to confirm I moved the Pi and everything is working OK now.

3 Likes