DHT22 signal drops when 12v fans are triggered

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ActionAnt
New user
Posts: 7
Joined: 01 Mar 2023, 12:53

DHT22 signal drops when 12v fans are triggered

#1 Post by ActionAnt » 17 Mar 2023, 15:52

Hi folks

I'm having an issue which has so far eluded me.

I have an esp32 dev kit module connected to the following:
- 2x DHT22 sensors, measuring temp and humidty in greenhouse and outside. (GPIO 2 and 4)
- 4x float sensors, measure water levels in my water tanks (GPIO 5, 18, 19, 21)
- 1x 4-way relay module, powered from the esp32 5v pin (GPIO 25, 26, 32, 33). The fan is connected to GPIO 32

I then have a 12v fan connected to one of the relays above, with power coming from a separate supply.

Everything works perfectly, except when the fans are triggered through the relay. After the fans have been running for about 2 min, I get "nan" from my DHT22 sensors and it won't recover the readings unless I turn the power to the esp32 off and on again.

I thought maybe the 12v power supply was interfering with the sensor cables and have tried to separate them, but no joy.

Any ideas what else might be causing the issue or do I need to do more to separate the power supply from the sensor cables?

Thanks in advance
ActionAnt

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: DHT22 signal drops when 12v fans are triggered

#2 Post by Ath » 17 Mar 2023, 16:51

You should check the power-source for your ESP.

Then, with what type of signal are you turning your relay(s) on, active high or active low? When using active high, the ESP has to deliver current to the relay, probably causing the power-supply, or the on-board LDO, to be overloaded, with unstable 3.3V as a result. Adding a 10-100 uF capacitor close to the ESP on the 3.3V and GND pins might improve things.
/Ton (PayPal.me)

ActionAnt
New user
Posts: 7
Joined: 01 Mar 2023, 12:53

Re: DHT22 signal drops when 12v fans are triggered

#3 Post by ActionAnt » 17 Mar 2023, 17:03

Thanks for the tip.

I should probably also have mentioned the following:
I can trigger all of the relays without any issues so long as I haven't switched on the 12v external power source. Only when I switch on the 12v power supply, which sends power to the fan, via one of the relays, do I stop getting values from the DHT22's.

Do you think this points to a different issue?

thanks in advance

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: DHT22 signal drops when 12v fans are triggered

#4 Post by Ath » 17 Mar 2023, 18:58

Is the DHT22 mounted close to that power supply?
Is the wiring to the DHT22 long? (Over 60cm)?
Is the I2C but terminated correctly?
/Ton (PayPal.me)

ActionAnt
New user
Posts: 7
Joined: 01 Mar 2023, 12:53

Re: DHT22 signal drops when 12v fans are triggered

#5 Post by ActionAnt » 17 Mar 2023, 19:02

DHT22 is on a cable about 2 meters long.
Not using I2C.

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: DHT22 signal drops when 12v fans are triggered

#6 Post by Ath » 17 Mar 2023, 19:49

Maybe using a shielded cable to the DHT22, and connecting the shield to GND on the ESP side only, could improve the signal.

Do you have a pull-up resistor on the data line of the DHT22's? For that cable length I'd suggest to use 4k7, to better stabilize the signal, the internal pull-up of the ESP is way too weak (high, 80..100k) for this.
/Ton (PayPal.me)

ActionAnt
New user
Posts: 7
Joined: 01 Mar 2023, 12:53

Re: DHT22 signal drops when 12v fans are triggered

#7 Post by ActionAnt » 20 Mar 2023, 10:34

Thanks I'll give that a try

ActionAnt
New user
Posts: 7
Joined: 01 Mar 2023, 12:53

Re: DHT22 signal drops when 12v fans are triggered

#8 Post by ActionAnt » 31 Mar 2023, 15:50

so finally coming back to you. I've tried a whole bunch of different things; shielded cable, separate power supplies, 4k7 resistor, etc. The only thing that worked was to shorten the cable. It's now about 30cm and not experiencing any issues any longer!

Thanks for the help!

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: DHT22 signal drops when 12v fans are triggered

#9 Post by Ath » 31 Mar 2023, 16:33

Thanks for the feedback, great it is now solved.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests