Moisture sensor, using PWM-signal and A0

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Normal user
Posts: 174
Joined: 21 Oct 2016, 15:20
Location: Hengelo (Ov)/ NL

Moisture sensor, using PWM-signal and A0

#1 Post by Ton_vN » 29 Dec 2020, 23:25

T&H-sensors for soil measurements with long endurance & good quality are not cheap.
The simple moisture sensors with fork or pen have no quality in data, but may be useful to generate a very rough indication and for thresholding aimed at a alert.
The downside for the very simple resistive moisture-sensors is that they use DC to sense the earth's resistance between the legs of the fork, resulting in heavy/quick corrosion of the legs. The slightly positive side is that a fork-setup survives drowning without fatal consequences.
The capacitive moisture sensors are better related to corrosion, applying an AC-signal, but drowning is fatal.

Throwing away the resistive devices is easy, but recycling of the setup would be nice,
and ;) a 'useful' passing of time during the present crisis and/or rainy days .......
Triggered by the need to replace a 'fork'-sensor of a Soil-sensor lost by corrosion, came to revisit an idea suggested by a meteo-buddy.

:idea: The WEMOS/ESP8266 has an onboard AC-signal in the form of PWM.
This PWM-signal can have a max. level of 3V3 at 10mA.
Combining various infos, seems that it can be set as follows in ESPEasy
-- Basic command = PWM,<GPIO>,<state> or PWM,<GPIO>,<state>,<duration> or PWM,<GPIO>,<state>,<duration>,<frequency>
-- with <GPIO> 0...15, <state> & <duration> 0...1024, and <frequency> set between 100 and 40000 [Hz]
-- <state> = level/duty-cycle, alternating at standard 1kHz, unless <frequency> inserted
-- <duration> = causes fading expressed in ms (and 'no fading' if deleted or set to 0)
-- Example layout for command = http://<espeasyip>/control?cmd=PWM,13,500
Feeding the PWM-signal to Leg A of the fork, if sensing on the Leg B of the fork, then the signal from Leg B must be a portion of the original signal, reduced by the resistance between the legs.
The ADC of the Wemos/ESP8266 at pin A0 seems an available tool to measure the signal from Leg B of the fork.

2 'Usual' frontends for the WEMOS' A0-pin to interface to array (for Rain/Wetness-sensing) or to fork (for Soil-sensing).
humgrondprobe [320x200].jpg (13.02 KiB) Viewed 975 times
regensensor [320x200].jpg (18.21 KiB) Viewed 975 times
Now the question how to interface between Leg B and pin A0 at (almost) no cost:
1) apply the PCB (as shown above) normally used as frontend to A0?
[Probably not, because the PCB and A0 'behind it' will have problems to digest a PWM-signal of variable amplitude]
2) instead of the PCB some DIY-construction of diode, capacitor(s) and resistor for direct connection to A0?
[with the DIY-construction rectifying & smoothing the PWM-signal from Leg B into a semi-DC-signal]
3) = DIY-construction 2) as front for 1)?
[with the DIY-construction smoothing the PWM-signal for the entrance of the PCB, and the PCB amplifying/leveling that input signal]

Have fiddled with 3), but not yet a working result, suspecting that the signal from Leg B is too weak to trigger the PCB.

Consider this just as a teaser/challenge/playground aimed at better life cycle of the setup.
Somebody with experience/ideas for best DIY-construction for the frontend?
With related best setting for the PWM-signal?

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests