#### Litch

Joined Jan 25, 2013
85
Attached is the concept of my ADC circuit as it stands now.

Runknown is somewhere from 10KΩ to 1MΩ. Rshunt can be anything I want, but is required to keep the input from floating when Runknown nears open circuit (and the ADC reading is all over the place).

Now the ADC says its input impedance is 69KΩ.

That's as far as I've got - is there any "rules of thumb" I should follow?

I guessing, since my ADC is 69KΩ, then Rshunt should be ≈ 69KΩ so current is equally shared across Rshunt and the ADC - the voltage is parallel so that doesn't matter.

What about calculating the value of Ruknown? How would I do that - The ADC gives a value from 0 to 4095 representing the voltage on the input pin relative to Vref: 0 = 0v, 2048 = 50% Vref, 4095 = 100% Vref, etc...

Obviously my reading will never be 100% Vref - the maximum will probably never exceed 50% Vref (Runkown <= 69KΩ).

Guess I just answered my own question there, but I'd still like some input (excuse the pun) on what the experienced players out there would think of...

-KB

#### Attachments

• 18.3 KB Views: 19

#### ErnieM

Joined Apr 24, 2011
8,010
I guessing, since my ADC is 69KΩ, then Rshunt should be ≈ 69KΩ so current is equally shared across Rshunt and the ADC - the voltage is parallel so that doesn't matter.
Rshunt should be much less then the ADC, 1/10th at max, less if possible.

The input impedance is NOT a precise number, hopefully your resistors are. By scaling them that way you toss away the input R's tolerance, and I'm not guessing.

#### #12

Joined Nov 30, 2010
18,167
If the input resistance of the ADC is variable from chip to chip, that screws the accuracy, and that is the reason Rshunt should be way less than the advertised Rin.
That number also wrecks the range of measurement for high input impedances (Runknown). This looks like a weak way to use an ADC. Better to process Runknown with analog methods, then send the result to the ADC.

#### Litch

Joined Jan 25, 2013
85
Background: Runknown will be 2 probes in soil, measuring water content by resistance, so for arguments sake, let's say I only require a reference value of "high resistance" (needs watering) and anything below that (adequate water is present)

I realise to begin with by using the ADC this way it inhibits the accuracy of the device, because the voltage drop across Runknown will generally be 50% or more because of it's inherent high values (compared to the ADC or Rshunt).

Better to process Runknown with analog methods, then send the result to the ADC.
Please elaborate? I am a n00b when it comes to electronics, but I'm a quick learner - if you could explain some theory as to why my circuit is inefficient and then supply and example of a better one?

-KB

#### killivolt

Joined Jan 10, 2010
742
Please elaborate? I am a n00b when it comes to electronics, but I'm a quick learner - if you could explain some theory as to why my circuit is inefficient and then supply and example of a better one?

-KB
I'm not sure how #12 would manage this?

I found this on the net, it seems that electrolysis is developing over time, if your not reversing the voltage. It would be an issue for me, I'm lazy.

This is worth reading...........analog fed into the arduino.

voltage is produced with a flipflop resistance is measured by the arduino.

http://gardenbot.org/howTo/soilMoisture/#The_local_circuit_-_simple_voltage

#### #12

Joined Nov 30, 2010
18,167
I'm not sure how #12 would manage this?
Not a problem. I'm an old analog guy from WAY back.

What is the supply voltage, max? What is the supply voltage to the ADC? What is the voltage measuring range for the ADC input?

Yes, it is true that a square wave is good to measure conductivity, but if you're just going to stab some probes in the earth a few times a month, like the ones you can get retail for less than $20, DC will suffice. You didn't give me values before I could draw these circuits, so this will have to do. Here are 2 ways to do it. #### Attachments • 14.9 KB Views: 18 Last edited: Thread Starter #### Litch Joined Jan 25, 2013 85 Not a problem. I'm an old analog guy from WAY back. What is the supply voltage, max? What is the supply voltage to the ADC? What is the voltage measuring range for the ADC input? Yes, it is true that a square wave is good to measure conductivity, but if you're just going to stab some probes in the earth a few times a month, like the ones you can get retail for less than$20, DC will suffice.

You didn't give me values before I could draw these circuits, so this will have to do.
Here are 2 ways to do it.
Now we're talkin!

Thanks for that, but wouldn't the low gain of the OP be not-so accurate as the Op Amps generally like a higher gain that x2 ? (Read that somewhere on "ADC Rules and Theory")

Params:
• Vmax = 5v (Avalable before the low noise 3v3 VREG - but that defies the purpose of the low noise device - and there is noise before it!)
• ADC Vdd = 3.3v (via said VREG)
• ADC Vref = 3.3v (Same bus as Vdd; Vref must <= Vdd, and cannot change since the i2c is 3v3)
• ADC Input Range = 0.0v to Vref

Give me a bit and I'll whip up the schematic.

#### WBahn

Joined Mar 31, 2012
24,987
Background: Runknown will be 2 probes in soil, measuring water content by resistance, so for arguments sake, let's say I only require a reference value of "high resistance" (needs watering) and anything below that (adequate water is present)
If you are only interested in two conditions, why are you using an ADC at all? Why not just a comparator circuit?

#### Litch

Joined Jan 25, 2013
85
If you are only interested in two conditions, why are you using an ADC at all? Why not just a comparator circuit?
I don't want to adjust a trimpot every time I need to calibrate (I can do it programmatically, to coin a word).

Plus values will still be logged, and graphed.

#### Litch

Joined Jan 25, 2013
85
Give me a bit and I'll whip up the schematic.
As promised, here's my current design.

• Some things omitted for brevity.
• ULN2303 is a Darlington array driving 7 relays, but the 8th unit in the array has been utilised for this relay driving the V supply to the probes (to prevent electrode decay / oxidisation) - the NPN symbol has been used to represent that.

#### Attachments

• 59.2 KB Views: 18

#### #12

Joined Nov 30, 2010
18,167
Thanks for that, but wouldn't the low gain of the OP be not-so accurate as the Op Amps generally like a higher gain that x2 ? (Read that somewhere on "ADC Rules and Theory")

Params:
• Vmax = 5v (Avalable before the low noise 3v3 VREG - but that defies the purpose of the low noise device - and there is noise before it!)
• ADC Vdd = 3.3v (via said VREG)
• ADC Vref = 3.3v (Same bus as Vdd; Vref must <= Vdd, and cannot change since the i2c is 3v3)
• ADC Input Range = 0.0v to Vref

Give me a bit and I'll whip up the schematic.
Some op amps are not stable at low gains, and some will not run on 3.3 volts. It is up to you to choose an op amp that will do these things. In this case, the Log101 by Texas Instruments needs at least 4.5 volts. Lucky you! You have 5 volts.

We had op amps that were dead accurate at a gain of 1, in the 1970's. Don't tell me they don't make 'em that good any more
You gotta go back and figure out exactly what conditions cause an op amp to be inaccurate at low gain. (I never met that one before.)

#### Litch

Joined Jan 25, 2013
85
Some op amps are not stable at low gains, and some will not run on 3.3 volts. It is up to you to choose an op amp that will do these things. In this case, the Log101 by Texas Instruments needs at least 4.5 volts. Lucky you! You have 5 volts.

We had op amps that were dead accurate at a gain of 1, in the 1970's. Don't tell me they don't make 'em that good any more
You gotta go back and figure out exactly what conditions cause an op amp to be inaccurate at low gain. (I never met that one before.)
Thanks #12, a couple of questions:
* Would running the LOG101 on the noisy 5v rail reduce it's output accuracy?
* I have no knowledge of Op Amps, there are so many categories in the distributor web site - Precision, Low Noise, High Speed, General Purpose, High Gain, Rail to Rail, CMOS - what do I look for?

#### WBahn

Joined Mar 31, 2012
24,987
You might start with the datasheet for your ADC as they often have circuit ideas for different things and usually specify part numbers for thngs like opamps.

#### MrChips

Joined Oct 2, 2009
19,778
I agree with killovolt. Your electrodes will become polarized if you use DC voltage.
You need to use AC signal. I would scrap the ADC and use two I/O pins of the MCU and a capacitor between the two pins. Measure frequency instead of voltage.

#### #12

Joined Nov 30, 2010
18,167
I agree with MrChips and killivolt. You have no right to talk about accuracy if you're going to use DC to measure conductivity. Pick one. Accuracy or DC.

#### Litch

Joined Jan 25, 2013
85
I agree with MrChips and killivolt. You have no right to talk about accuracy if you're going to use DC to measure conductivity. Pick one. Accuracy or DC.
Ok lets talk range.

When I say accuracy I mean it's not going to be +/- 20% due to power supply ripple.

What I don't need to +/- 1% - and reasonable amount of tolerance is acceptable. 5%? 10%?

My primary concern was if it was feasible - no point building it if I'm going to be reading garbage values.

Also - MrChips - the measurements will be taken over 100ms every hour or two. The power to the probes is cut via relay. I doubt soil ionisation will be an issue.

WBahn - Good idea, I'll start there.

#### #12

Joined Nov 30, 2010
18,167
Feasible? Of course it's feasible. You can buy one in the Garden Shop of Home Depot for less than \$20.

Noisy supply? It's called PSRR, power supply rejection ratio on the amplifier chip datasheets. Usually more than 70db reduction of power supply noise. You would have to build a circuit to inject enough noise to queer the readings.

What to look for in an op amp: runs on 5 volts or 3.3 volts, your choice, stable at a gain of one, input bias current less than 1% of the 5ua that you are inputting, input offset voltage less than 1% of the 2.5 volt input range you are inputting. If your main concern is accuracy, choose, "precision".