# Moisture sensor circuit odd reading

#### Fyod

Joined Jun 2, 2019
17

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?

#### AlbertHall

Joined Jun 4, 2014
12,292
Welcome to AAC.
Without the resistance of the pot to ground, what you are seeing is the leakage of the transistor.

#### Fyod

Joined Jun 2, 2019
17
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
9,128
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.

#### Fyod

Joined Jun 2, 2019
17
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,777
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:

#### dl324

Joined Mar 30, 2015
16,111
I'm trying out this circuit
My advice would be to avoid using circuits from someone who doesn't know how to draw a clean schematic.

#### AnalogKid

Joined Aug 1, 2013
10,777
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:

#### AnalogKid

Joined Aug 1, 2013
10,777
Here are three different ways to draw the same schematic. All of them are better than post #1. I prefer B.

ak