Moisture sensor circuit odd reading

Thread Starter

Fyod

Joined Jun 2, 2019
11
1653607732695.png

Hi everyone,
I'm trying out this circuit with the difference that mine is 3.3V instead of 5V and I do not have the resistor (pot in schematic), just straight to mcu.
The odd behavior is that when the probes are not connected in any way, I'm getting an ADC reading of about 3900 (12 bit ADC).
When I put a damp paper towel between the probes, I get 4095.

I would expect around 0 when nothing is connecting the probes. What could be wrong?
 

Thread Starter

Fyod

Joined Jun 2, 2019
11
@AlbertHall I had a notion that resistor had a purpose.
How can I calculate what value would be correct in this circuit? Should I test resistors that bring the ADC value to 0, but don't hamper positive reading?
 

djsfantasi

Joined Apr 11, 2010
8,389
@AlbertHall I had a notion that resistor had a purpose.
How can I calculate what value would be correct in this circuit? Should I test resistors that bring the ADC value to 0, but don't hamper positive reading?
The ‘resistor’ labeled ‘pot’ is not a resistor, but a potentiometer. It’s resistance is stated on the diagram. You need a 10k linear potentiometer, which you’ll adjust with its knob to zero out the circuit.
 

fileandfit

Joined May 20, 2022
8
If you have two resistors around the 5k value put them in series from the emitter to ground to make a voltage divider. Connect the junction of the resistors to the controller. It will be a start at least.
 

Thread Starter

Fyod

Joined Jun 2, 2019
11
It think I might have a 10K pot lying around, but would like to eventually keep the circuit fixed values.
So ideally I would connect as per schematic, find the value that zeros out the read value, then find the closest two resistors to match (Rpot / 2) and replace the pot with a voltage divider using these two resistors?
 

AnalogKid

Joined Aug 1, 2013
10,096
I had a notion that resistor had a purpose.
Parts on schematics usually do.

It think I might have a 10K pot lying around, but would like to eventually keep the circuit fixed values.
So ideally I would connect as per schematic, find the value that zeros out the read value, then find the closest two resistors to match (Rpot / 2) and replace the pot with a voltage divider using these two resistors?
Good plan, but -

The circuit is basically an emitter follower biased with a very high impedance. As the gain of the transistor varies with temperature, aging, and even barometric pressure, the output voltage will wander around. If this is for simple wet/dry sensing, your plan will work. If you want an indication of moisture level, such as ground moisture to determine if things need to be watered, then you need to do your calibration at the wet and dry ends of the scale, and average the two sets of resistor values to try to center the moisture voltage scale in the middle of the A/D input voltage range.

Even for simple wet/dry sensing, remember that you have an analog signal and an analog input. Consider treating the A/D as a 1-bit quantizer rather than a non-zero detector. Any value below a certain transition level (such as 2048) is considered dry, and anything above it is considered wet. In this way, a little leakage current keeping the input from being 0.0000000 V will not affect the results. This should give you a much larger range of workable input resistor values.

ak
 
Last edited:

AnalogKid

Joined Aug 1, 2013
10,096
My advice would be to avoid using circuits from someone who doesn't know how to draw a clean schematic.
Totally agree.

It sounds like we're being pissy, but we're not. A good schematic should have consistent directions for signal flow and power flow. It shows that the designer has training, experience, and discipline. When you know nothing about the source, the quality of the schematic tells you not only about the circuit, but also about the competence of the designer.

ak
 
Last edited:

Thread Starter

Fyod

Joined Jun 2, 2019
11
@AnalogKid Thank you, your explanation was very helpful.
I added the pot and calibrated the reading to be even at about 300-3700. I think I'd need a 100K pot to get near 0-4000.
But this is good enough for my current testing.
 
Top