News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Looking for help with analogue design

Started by TimB, Apr 27, 2023, 02:07 PM

Previous topic - Next topic

TimB


Hi,

I'm looking for help with an analogue design. I can pay...

It should be simple but is flummoxing me.

Basically water level probes.

I have a vessel and at the bottom a connection that is always under water.

In the vessel I have 3 probes 1 bottom one near the middle and one right at the top

Bottom drive probe being driven by 5v.

Before I had each probe grounded with a 2M resistor 2 of them is under pic control as they are tied to a pic pin

I always had an issue in that the bottom probe worked great, the middle and top had what I thought was tracking issues so did loads of work preventing water tracking.
Again I got very odd readings so I removed the pull down resistors and let the signals float.

With no water covering the bottom probe I'm getting sensible results low numbers around 10 on the adc. When the water hits the probe the bottom ADC jumps up, as expected but then so does the other 2. No idea why. They keep steady until they see the water then jump a little more.
This is not at all what I would expect so must be doing something really stupid. Could be schematic or code eg ADC set up.

Hence I need help. Please PM

Tim






trastikata

#1
Quote from: TimB on Apr 27, 2023, 02:07 PMWith no water covering the bottom probe I'm getting sensible results low numbers around 10 on the adc. When the water hits the probe the bottom ADC jumps up, as expected but then so does the other 2. No idea why. They keep steady until they see the water then jump a little more.

Hello TimB,

Just a reminder, you might be aware of - you need sufficient time between ADC readings of different channels to allow full discharge of the S&H capacitor otherwise you will see cross-talking between the channels. So I guess because of the high impedance of the probes and no ground return, the S&H capacitor can't fully discharge before reading the second probe.

If you need faster ADC times you can buffer the signals with a follower through an OPAMP, the low impedance signal from the OPAMP will be able to faster discharge the S&H cap .

TimB

Thanks

I changed my code so after a ADC read I set the bottom drive low for 40us, then back high for 20us

As an example after the bottom probe is wetted and then level is lowered. I get the following


B probe 266
M probe 204
T probe 131

Water level raised above bottom probe and I get
B probe 1023
M probe 900
T probe 625

Water level raised to middle probe
B probe 1009
M probe 1015
T probe 709


This is set up code

    Device 16F1823

    xtal 32

' Positron Declares

    Declare ADin_Tad = FRC ' RC oscillator chosen for the ADC
    Declare ADin_Stime = 20 ' Allow 20us sample time

John Lawton

Yes I've had this charge storage effect myself causing apparent interaction between ADC channels.

If you don't have some sort of pulldown resistors on your probes then they can float to any voltage so basically that won't work. 

Also I can't see where your PIC 0V (common) connects in this scheme so what are the ADC inputs measuring with respect to?

TimB

Some more testing

I put my scope on it and just the scope on line made the figures make sense. So I will try adding back the middle and top pull downs. Before I had 2m pull downs. I will try putting 1M back in.


TimB

Hi John

Can you explain where you think the grnd connection should be?

As part of my testing I made it so I can push pull just about in any combination. It was better but still did not get clear readings.


John Lawton

I might have assumed that the vessel was grounded, but if it is non-conducting then to my mind you need a ground/common (0V) probe also, otherwise what is your reference? Perhaps I have misunderstood what you are trying to measure.

trastikata

TimB,

can you post a simplified schematic if it is not proprietary?

Another thing comes to mind - how do you drive the probes AC or DC?

If I remember correctly you said there's a possibility for tap water to enter in the system? With tap water and DC drive in time you will have problems with Calcium deposition on the probe's surface. Also there will be other galvanic effects.

TimB

The vessel is plastic

The probes are stainless steel. Water will be very pure in use but in testing on the bench to start with tap.
Voltage through the probes is controllable so I can supply +v B source to the probes then reverse it. So I can balance any galvanic currents.


Below is the schematic


schematic.png

TimB

This is a simplified sketch of the vessel and the probes

Vessel.png

trastikata

Quote from: TimB on Apr 27, 2023, 04:48 PMThe probes are stainless steel. Water will be very pure in use but in testing on the bench to start with tap.

The maximum input impedance for PIC ADCs is around 10k. With those 1.2k resistors in the current path you'll have troubles with pure water, which has very high resistance. I'd buffer any ADC inputs with OPAMP voltage followers.

TimB


Thanks trastikata

I agree now I will start on a design that does that.

I changed the 2M to 1M and it worked a lot better. I will also drop the 1k2 to around 470 or less. I agree on the OPAMP voltage followers.

Very much appreciated for the advice. Electronics especially analogue are not my forte.   

JohnB

I have used the LMC6001 op amp for ORP and pH potentiometric sensors.  The devices have a ultra low input current.
 Here's a link  Hope it helps.  I'll try and dig out my circuit if you like.
JohnB

JonW

Tim take a look at the new PIC16F17xx series. These have a programmable opamp for signal conditioning. Not sure when the compiler will support them.

Another vote for the LMC6001, these are nice opamps.

david

Quote from: trastikata on Apr 27, 2023, 05:18 PM
Quote from: TimB on Apr 27, 2023, 04:48 PMThe probes are stainless steel. Water will be very pure in use but in testing on the bench to start with tap.

The maximum input impedance for PIC ADCs is around 10k. With those 1.2k resistors in the current path you'll have troubles with pure water, which has very high resistance. I'd buffer any ADC inputs with OPAMP voltage followers.

That's always an interesting one.   The 10k figure is about right and relates to the 10-15pF S/H capacitor in the chip.  If you can tolerate some capacitance on the ADC pin then the resistive source impedance of the input can be much higher and still be accurate.  The S/H capacitor is effectively taking a small charge off the input capacitor when sampled rather than dropping voltage through the source resistance. 
I would try adding something like 10nF capacitors on the ADC inputs BUT remember that if the voltage source is changing rapidly then these capacitors need time to charge/discharge to the new level and this may be an issue for you.
For slow changing applications like battery monitoring there is no problem using several hundred k provided you add some capacitance.  Ultimately input pin leakage and gate protection diode leakage will dictate the upper limit.

Cheers,
David

TimB



Thanks for all the advice it explains why I was having the issues I was.

The LMC6001 is out of the question as they are expensive ~£20 and I need 3 unless I reverse the direction of current flow (also it has to be SMT)

Each probe in turn and detected by the bottom probe rather than by each of the 3 probes. (Hmm I might try that....)

I'm now looking at devices like MCP604-I/SL 

One more thing that came to mind was that there will be a signal path of the water to the drain valve then to chassis grnd when in real use.

trastikata

Quote from: TimB on Apr 28, 2023, 07:20 AMI'm now looking at devices like MCP604-I/SL 

One more thing that came to mind was that there will be a signal path of the water to the drain valve then to chassis grnd when in real use.

MCP604 are good general purpose opamps.

But if you have ground loop through the valve then you'll need to rethink the entire schematic as you won't be able to accuratly measure any low side signals - your probes are low side if I understand correctly.


TimB

I include a revised image showing the vessel

I can if need be isolate the valve with appropriate plastic spacers

Signal path can be from the very bottom one to be detected at each of the other probes or I can turn on each probe in turn detect it at the very bottom probe (BottomDrive)

Vessel 2.png

Stephen Moss

Quote from: TimB on Apr 27, 2023, 04:48 PMThe vessel is plastic
Presumably the vessel is being filled from the bottom rather than the top so we can eliminate the possibility of spray affecting the reading of the other probes.

In which case although you would not think so with it being filled with water I have a vague (and probably incorrect) recollection that under certain conditions it is possible that flowing liquids can produce a static charge. That may not be happening here, but if it is and the vessel is not grounded then maybe that is what is affecting the readings of the other probes.

JonW

Tim you may want to power the opamps with a split supply so you can get really close to GND, add common mode chokes and low capacitance ESD diodes.