3
\$\begingroup\$

I have an ESP32, and use capacitive soil humidity sensors to check the humidity of my plants. They get shipped with about 15 cm of cable attached.

What is a reasonable/safe cable length I can use before it gives unrealistic readings? It is powered with 3.3 V.

enter image description here

\$\endgroup\$
6
  • 1
    \$\begingroup\$ You could answer this yourself, by trying longer wire until you no longer get sensible readings. \$\endgroup\$
    – LordTeddy
    Apr 26 at 14:12
  • \$\begingroup\$ @LordTeddy well, i just read a value, but i dont know how accurate that value is without any sort of reference point... so i dont know if adding 1 meter and it returns "1234", if that value makes any sense or if it should be "2345".. \$\endgroup\$ Apr 26 at 14:28
  • \$\begingroup\$ Start with a short length of wire as your reference point. \$\endgroup\$
    – LordTeddy
    Apr 26 at 14:30
  • \$\begingroup\$ You may want to calibrate your setup by measuring the ADC values for some points of interest (dry, reasonably moist, completely wet). \$\endgroup\$
    – Velvel
    Apr 26 at 14:37
  • \$\begingroup\$ It won't be that wrong. \$\endgroup\$
    – user253751
    Apr 26 at 15:05

2 Answers 2

3
\$\begingroup\$

The longer you make your wire, the more voltage drop the analogue signal will suffer along the wire. This will show itself as decrease in the maximum value you can see appearing on your input pin, where a short wire may get up to 3.2v, but a long wire might only get up to 3.1v . Therefore for the most part you could fix this in software by re-scaling your readings as needed, and you can have pretty much as long a wire as you would like.

However, the longer the wire the more noise you will pick up, so you may need to do some software de-noising to fix this.

In general, you should be fine to make it up to a few meters long without any problems

\$\endgroup\$
1
  • \$\begingroup\$ thank you very much! i am going for a 4 wire isolated cable. trying to get to 3 meters.. that would be optimal for me. \$\endgroup\$ Apr 26 at 14:29
0
\$\begingroup\$

From this "capacitive soil moisture sensor" you will get a voltage and if you measure the voltage with the high resistance of the ADC and a 10-100nF capacitor directly close to the ADC-pin every second, then you can use in theory a very long wire.

  • The biggest problem are the magnetic fields in the environment, they will induce current in the wire and create a voltage ripple on the wire.

The solution is a twisted wire (GND+Vout) or a shielded wire. You can use a coaxial cable or simply twist your wire like they have done it with each pair of wires in a network cable.

If you still have noise, then you should use a little LC- or RC-filter. You can use a 10k Ohm resistor from Vout of the sensor to the ADC-pin and directly very close to the ADC-pin a 100nF capacitor.

The cutoff frequency is here: f0 = 1 / (2 * Pi * R * C) = 1/(2 * Pi * 10000 Ohm * 0,0000001F) = 159Hz

If you only want to measure every minute, then you can use higher values for a lower cutoff frequency.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.