Moisture sensor, using PWM-signal and A0
Posted: 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 .......
2 'Usual' frontends for the WEMOS' A0-pin to interface to array (for Rain/Wetness-sensing) or to fork (for Soil-sensing). 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.
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
Pictures from my antique oscilloscope provide evidence that the operation of the loop ESP to Sensor & back is OK, when the sensor is wet. For a dry sensor the Input_signal is just noise & hum (as could be expected) collected between the wires and at the sensor.
The ADC of the Wemos/ESP8266 at pin A0 seems an available tool to measure the signal from Leg B of the fork or port B of the Rain/Wetness-sensor.
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/port 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 2) and 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 PWM-signal set to constant/1000Hz/symmetric
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 .......
2 'Usual' frontends for the WEMOS' A0-pin to interface to array (for Rain/Wetness-sensing) or to fork (for Soil-sensing). 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.
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
Feeding the PWM-signal to Leg A of the Fork-sensor, 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. For the Rain/Wetness-sensor similarly port A as input and port B as output.-- 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
Pictures from my antique oscilloscope provide evidence that the operation of the loop ESP to Sensor & back is OK, when the sensor is wet. For a dry sensor the Input_signal is just noise & hum (as could be expected) collected between the wires and at the sensor.
The ADC of the Wemos/ESP8266 at pin A0 seems an available tool to measure the signal from Leg B of the fork or port B of the Rain/Wetness-sensor.
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/port 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 2) and 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 PWM-signal set to constant/1000Hz/symmetric