News:

;) This forum is the property of Proton software developers

Main Menu

Looking for help with analogue design

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

Previous topic - Next topic

TimB

#20
Quote from: Stephen Moss on Apr 28, 2023, 08:32 AM
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.


The water actually enters from the top and at slow feed rate. The design has the water tracking down the walls of the tube. I cannot fill from the bottom as the water has air bubbles and they will pop and if right near the top probe will make contact and also the volume of the bubble in the water as it rises will increase the volume temporarily.

Calibration is done with water from the bottom.

I had a complex system to sample every which way then analyse the results. In the end though I think with the better understanding of what is going on I can reduce that to a much simpler system.

I'm past trying to keep secrets on this as I have a patent for other aspects so can explain the way it will work.

Some basic issues

1 The conductivity of the water will change from the tap water used in calibration to Ultra Pure in use. (what that will do to the vessel is a long term problem)
2 On start up I do not know the level of the water it could be anywhere

I only need 2 probes top and bottom the middle is used as a kind of referance

The logic is like this

Start up
Probes not known

(State 1)If bProbeval > Middle and top then Bottom in water
Threshold level of middle and top can be calculated eg current middle and top are current ADC + Xstepvalue

Force the water level to that state. eg close the valve and let water in

If not in state 1 open drain until it is

State 2 Close drain until middle > calculated threshold. Now you can calculate bottom threshold Bottom Threshold = current ADC - Xstepvalue

Now you have thresholds I can use. One thing I do is that I calculate the thresholds all the time if state 1 then calc middle + top if state 2 then bottom

The issue I had was that the ADC levels would change depending on the water level on the bottom probe and the top. I think I now know why that is and can eliminate it.

One issue also was that as soon as the middle probe saw water the bottom reading would drop. This is that there is a conductive path to grnd added. I feel that swapping the detection to just the bottom probe will solve this. I will drive each probe High and the others to inputs and read the very bottom probe. This will mean I have only one grnd path not the 3 I have now.



TimB

Quote from: JonW on Apr 28, 2023, 09:08 AMTim 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.



I will try and see if I can do that

John Lawton


JonW

They get "Close" to the ground read the datasheets carefully, then you have the input bias currents, and input offsets to deal with.  If you are biasing the inputs and are away from the rails then that's fine.  VOUT = (VSS + 100mV) is load dependent and can deviate from linear operation close to the rails, in this case, VSS + 100mV is the min output for linear operation


John Lawton

The input range is quoted as Vss - 0.3V, so it's below ground.

Tim's application doesn't need precision but he may well need fairly low input currents although he's currently using 1M input loads so I think that part should be fine in that case.

JonW

#25
Its the output that will feed in to the ADC.  Thus operation close to GND may be an issue

John Lawton


TimB

This is my new design

schematic 2.png

JonW

Tim  What voltages do you normally detect on the probes during normal operation? 

I would add provisions for 10k resistor on the input and a 10k on the feedback in parallel with a 330p cap.  Also tie a couple of BAV99 diodes to clamp the input to -VF BAV99 and VDD + VF BAV99 (although you will have input ESD diodes internally).

Add a series 220R on the output of the Opamp so you can remove and isolate if necessary (for debug and measurement)


TimB

Thanks John I will look at implementing the recomendations

After a lot of testing today I have a system working now

The voltages are 5v applied to the probes in turn and I get an ADC reading with tap water of around 650 so the amp will see approx 3.1v
With pure water and another set up the adc values dropped to approx 180 (0.8v) but I had different pull down etc.

Just to recap my set up now

1 I'm using now 2 probes Bottom and Top these are pic pins and I can drive them to 5v and make them an input
2 I have 1 permanent probe (Base) that should stay in the water all the time, this probe I use to perform the ADC conversion on
3 The bottom probe has a 1M pull down
4 I Drive the bottom probe to 5v and then wait 50us to let the ADC cap charge and also have a 50us ADin_Stime then I read the value one the Base probe
5 I Drive the top probe to 5v test etc..

Before stages 4 and 5 I make the other probe an input

Analyzing the results

As No water over the bottom probe is always reading very low I have a hard coded threshold.
If the bottom probe level is < the threshold I set the results flags appropriately = NoProbes
When the bottom probe goes back over than threshold I start a timer (as long as it is still over) after about 3-4 seconds I work out the top probe threshold and that is the current Bottom ADC- a step threshold val. This stays as the threshold until the water drops below the bottom probe again.

SOMETHING I FORGOT TO SAY
The water is cycled eg it fills up to the top probe then I empty it until it is below the bottom probe then up again etc etc. I'm measuring the time it takes to fill the vessel to ~10ms accuracy.






JonW

#30
Careful of opamp saturation. Or comparators.  A very unknown phenomenon that most don't understand or have never seen.
Open loop gain is generally very high, so any unbounded instantaneous changes Dv/dt can and will.cause saturation.  Ie deep compression (John D will like this°) due to the massive open loop gain. Recovery takes time and you need to factor this in to adc read time,l based on stats,  adding RC feedback in opamp closes loop for step responses.

As mentioned previously in non linear regions the device is unpredictable and response times are unknown. 
Take data amd analyse it.
Plot the stats and look for deviation from the norm.  Any split distribution will show itself.

TimB

#31
Hello JonW

This the revised schematic based off your recommendations. I'm not sure now about R6 the pull down. It will reduce the available voltage but I have found it necessary or all the readings are the same.

John Lawton pointed out the device needs a ground to make sure the ADC works correctly. If there is some capacitance in the system that needs to be removed I can ground the 2 probes (not the ADC input). But I note that tracking through a fine film of water is a potential issue so I need to reduce the available current some way. Just not sure the 1m resistor is the right system.

As always thanks so much for helping.

Tim
schematic 3.png

JonW

Tim add a provision for a series 10K on the input to the opamp, you can always link this out if necessary.

JonW

#33
If anyone is looking for high-end opamps at low cost then take a look at a company called 3PEAK.  You can buy them online at LCSC (or through JLCPCB). https://www.lcsc.com/products/Precision-OpAmps_597.html?keyword=operational%20amplifier.
For instance, if you are into audio, look a the TP2604 https://www.lcsc.com/product-detail/Precision-OpAmps_3PEAK-TP2604-SR_C126446.html.  This is a 10M GBP opamp with stellar linearity and low input currents for $0.30 in low volume!



TimB

HELP!!

Ok I designed the PCB and had it made. Populated it and now testing it.

It seems the signal from the sensor is going into a black hole. I can see it on my scope right up to the + pin of the opamp. Coming out of the opamp it flat lines and that feeds back into the - and stays the same.

I have check the schematic, the PCB layout and that there are no shorts on the board. Every thing looks fine. I changed the opamp out with another from a batch then purchased a new batch from a different supplier in case the first ones were duff. Still the same issue.

Has anybody got any ideas what I'm doing wrong?

Opamp Schematic.png


opamp pcb.png 

trastikata

TimB, can you disconnect R8 and measure the opamp again to exclude malfunctioning PIC input?

TimB

Quote from: trastikata on May 17, 2023, 08:06 PMTimB, can you disconnect R8 and measure the opamp again to exclude malfunctioning PIC input?

I did that as part of my fault finding yesterday. No change


John Lawton

#37
I'm not sure about your pcb design. Is the 0V (gnd) plane omitted for clarity?
Where is the Vss (0V) connection(s) to the op-amp etc?

[edit]
Ah, just spotted the gnd plane in deep red. Sorry about that.

trastikata

Did you test if the feedback resistor R7 is conducting? Just for the test, can you shunt it and measure again?

GDeSantis

TimB
What is the magnitude of the op-amp's output voltage?  Also, it would help if a potentiometer could be tack soldered into the circuit and the pot's wiper connected to the op-amp input.  The op-amp output should track the pot's wiper voltage.