Millimeter range water level sensor - Page 1
Forum section: electronics / general

author: ikkaru
author_rank: Contributor
timestamp: June 04, 2024, 04:07:28 am
content: Hello Guys, I wonder if I should post this in the "Projects" or here.I'm brainstorming ideas for a millimetre range water level sensor. The water is in a plastic tube of 3mm ID (I can re-engineer it to a different shape, but the water column cross-section area needs to stay fixed). The level fluctuations are within 5mm. My target resolution is 0.2mm and the target data rate is 50Hz.Any clues on the technology I could focus on? Resistance of two submerged electrodes? Parasitic capacitance difference of a submerged inductor?I want to obtain the data using a microcontroller later on.Thanks a lot in advance.

author: IanB
author_rank: Super Contributor
timestamp: June 04, 2024, 04:49:51 am
content: I'm going to imagine that surface tension, capillary action and wetting of surfaces could be complicating factors here. Maybe an ultrasonic depth gauge, or resonant frequency of the tube (either the air cavity or tube as a whole)?

author: jbb
author_rank: Super Contributor
timestamp: June 04, 2024, 07:52:02 am
content: Is the tube permanently fixed, infrequently swapped or (for example) a disposable sample tube?What came to my mind is capacitive sensing with sense electrodes on theoutsideof the tube. What’s the material and wall thickness expected to be?Oh yes… if sample tube is transparent then maybe an optical method is possible…

author: Kleinstein
author_rank: Super Contributor
timestamp: June 04, 2024, 08:05:21 am
content: Using the conductivity with an electrode only works if the conductivity of the water is well defined - this is tricky with pure water as tiny changes in the PH can have a large effect.Not so clean water may lead to a biofilm, that could effect electric and also capacitive measurements.The surface tension can be a real issue. Because of the extra surface I would avoid an extra electrode.Ultrasonic looks promissing. Simple optic from the outside should also work, but could be effected even more by the surface tension / surface shape.

author: Poroit
author_rank: Frequent Contributor
timestamp: June 04, 2024, 09:19:55 am
content: Have a look at these.https://aplisens.com/sg-25smart.html

author: Berni
author_rank: Super Contributor
timestamp: June 04, 2024, 09:44:12 am
content: This depends a lot on what kind of water it is. Is is tap water? dirty pond water? salt water? pure deionised water?Electrical characteristics of water can change a lot so even capacitive sensors might not work reliably unless the water will always be at least a bit conductive and does not have too much dirt.The most reliably way is to use a pressure sensor. Place it in a way that the water surface creates a hydrostatic pressure, then knowing the density you can calculate the pressure into height of a water column. If you can't get your sensors reading point bellow the surface, then you can dip a thin tube down into the liquid and use a small air compressor to push air out the bottom, this causes the air pressure inside the tube to always be the same as the hydrostatic pressure at the bottom of the tube, as a bonus this never clogs up, making it reliable in dirty environments (hence why industry likes to use this method)

author: nfmax
author_rank: Super Contributor
timestamp: June 04, 2024, 10:07:09 am
content: Regarding the bubble tube approach (though this may not have enough resolution for you), a good friend implemented such a sensor by repurposing a blood pressure monitor: the tube inflating the cuff was connected instead to the dip tube, and read the pressure display at the bubble point. Advantages are you get a ready made unit at a very good price, but it is manually controlled, and displays pressure in mmHg. Also, not all units work this way.

author: Sensorcat
author_rank: Regular Contributor
timestamp: June 04, 2024, 10:40:48 pm
content: Any items in the tube will cause trouble, either due to the issues pointed out by IanB, or the biofilm/dirt/salt complex pointed out by Kleinstein and Berni. Not to mention corrosion or a possible contamination of the water in the tube by sensor components.Using an ultrasonic sensor with these application dimensions is extremely (and unnecessary) hard. Reason: When using one sensor for transmit and receive, there is a decay phase after termination of the transmitted pulse. During much of this decay, there is too much energy stored in the piezo to effectively receive. If the distance is only millimeters, the sensor will not be ready to receive when the echo appears. Separating transmit and receive will have two new challenges instead: Having both units acoustically coupled to the small tube, while having them acoustically decoupled from each other, such that the transmitter does not again saturate the receiver. Increasing the distance between water surface and sensor does not solve the problem, because then the resolution must be met at a much longer air path, and the speed of sound depends on temperature and moisture.Most types of industrial sensors will be far too large, like the one linked by Poroit.Target resolution translates to 20µbar water pressure, which makes anything based on pressure another challenge.Hence I would opt for a two-channel capacitive solution (see attached image): Outside the tube, as already pointed out by jbb, arefourelectrodes, formingtwocapacitors, such that one of them is in a region always covered by water. This capacitor, Cref, is used to measure the properties of the electrode/tube/water/tube/electrode sandwich, together with any cross sensitivities it might have (temperature, expansion, relative permittivity, ...). The level capacitor, CL, covers the range of water level. CL/Cref will be a linear function of the water level, regardless of water properties and other quantities, as long as they are present at Cref.

author: DTJ
author_rank: Super Contributor
timestamp: June 05, 2024, 05:52:06 am
content: What level range do you want to measure over? A few mm? A few cm?Ultrasonic, radar and capacitive and pressure based systems won't give you that resolution - well none of the ones I have experience with will.Bubbler systems won't either as they are limited by the bubble size.A float based water level encoder will give you that resolution but not using a tube.Would an optical approach be possible?

author: KT88
author_rank: Frequent Contributor
timestamp: June 05, 2024, 12:13:11 pm
content: a load cell could work if you are interested in the mass.

author: r6502
author_rank: Regular Contributor
timestamp: June 06, 2024, 11:34:03 am
content: Hello ikkaru,you may look at the following paper that handles touch sensor applications from Microchip:https://ww1.microchip.com/downloads/en/Appnotes/Capacitive-Touch-Sensor-Design-Guide-DS00002934-B.pdfTere is a presentation out, from Microchip, that handles about fluid level detection but I could not find it at the moment. But at a presentation they gave to us, they showed exactly, what you need, and they used the touch sensor technology, that is implemented in many chip's they are selling.if you just want to detect one level, you may use ultrasonic bubble detectors for this as an example:https://www.sonotec.eu/en/products/non-invasive-fluid-monitoring/#c2659Guido

author: AlienRelics
author_rank: Unknown
timestamp: June 06, 2024, 03:38:54 pm
content: I'd try this with metal taped to the outside of the tube to measure capacitance. As long as you don't try to do something like expect the same calibration between fresh and salt water, it can be very sensitive and accurate.https://hackaday.io/project/183506-remote-continuous-liquid-level-sensor-555-timerI was successfully measuring to 0.1pF resolution in the '80s. And with a little effort, it is simple to get to tens of fF (femtofarad, 10^-15 range) resolution. You need to pay special attention to temperature stability of the parts. The below circuit is good to 10fF resolution using TLC555 timers and careful part selection. A modern circuit with crystal control should be able to do even better.I could not tell you if that is sufficient to measure 0.2mm difference in a 3mm diameter tube. It might be better if it were a square tube. Or perhaps not. I wish I were feeling better, I'd go grab my capacitance meter and some tube and try it out.As far as 0.2mm changes, you may find that there will be an issue with a sort of stiction of the meniscus during changes in level. It is going to depend a lot on the composition of the 3mm tube.https://hackaday.io/project/183405-dual-tlc555-capacitance-meter-01pf-resolution

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 05:09:37 am
content: Quote from: IanB on June 04, 2024, 04:49:51 amI agree that the capillary action would play a significant role. But I'm rather interested in the fluid level change than the absolute level. Thanks for the ideas. Ultrasonic sensing I believe is a bit difficult to embed in a smaller form. I want to expand the sensor to a 2D array later. Do you think these two ideas might be a bit difficult to interface electronically for a sensor array?

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 05:15:37 am
content: Quote from: jbb on June 04, 2024, 07:52:02 amI'm going to use a transparent material to either 3D-print material, or use an acrylic tube. I would even consider a complex shape if the sensor causes the water column to change the cross-section (to maintain a uniform cross-section).I also am seriously considering capacitive sensing. I am free to determine the material and wall thickness.An optical method would also work, given that I can multiply a 2D array of tubes in a confined space. The distance between two sensors is around 2cm. If I can go with capacitive, I think designing a PCB would make the multiplication easier.

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 05:19:34 am
content: Quote from: Kleinstein on June 04, 2024, 08:05:21 amAgree with your ideas. Dipping more things disturbing the open surface can cause many complications. Thanks for the ideas.

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 05:22:52 am
content: Quote from: Poroit on June 04, 2024, 09:19:55 amThanks for the reply. The sensor is too large for my application.

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 05:33:21 am
content: Quote from: Berni on June 04, 2024, 09:44:12 amThanks for the response. I can determine what the water type is. I was thinking pure de-ionized water. But I can add a constituent if required.Thanks for your flags on the capacitive sensing. And the pressure sensing with the dipping tube is quite eye-opening. However, I'm not sure if the method is applicable as my tube is very small, and since I'm interested in changes of sub-millimeter level changes.I have looked into smaller fibre optic pressure sensors (https://millar.com/Research/Pressure-Catheters/), that works for one sensor. But very troublesome (Expensive, and messy) when I need to convert this one sensor to a 2D array of sensors.

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 05:35:17 am
content: Quote from: nfmax on June 04, 2024, 10:07:09 amThanks for the reply. I'm sure this solution would be very cost effective. However, is challenging for the resolutions/sensitivities I'm looking at.

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 05:39:56 am
content: Quote from: Sensorcat on June 04, 2024, 10:40:48 pmThanks for your informative and insightful answer. I totally agree with all your comments. And having a reference sensor to account for the temperature and other changes is a luxury. I will look into the implementation/interfacing of this kind of a sensor.

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 05:44:45 am
content: Quote from: DTJ on June 05, 2024, 05:52:06 amThanks for your answer. The level changes are within 5mm. I think an optical approach is possible. For example, I can add a black dye to the water and have a transmitting and receiving sensor array on the opposing sides of the tube.

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 05:46:57 am
content: Quote from: KT88 on June 05, 2024, 12:13:11 pmThanks for your answer. I agree that it would be easy to find a load cell that is this sensitive. But I'm not sure if I can implement that in this application.

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 06:38:21 am
content: Quote from: r6502 on June 06, 2024, 11:34:03 amWow, I was wondering how to realize this capacitive sensing principle. Thanks a lot for your insights. I am looking at the electronics to realize the idea. Also found this article from TI (https://www.ti.com/lit/ug/tidu736a/tidu736a.pdf?ts=1717739531323&ref_url=https%253A%252F%252Fwww.google.com%252F) while I continued my search through your pointers.

author: ikkaru
author_rank: Contributor
timestamp: June 07, 2024, 07:03:22 am
content: Quote from: AlienRelics on June 06, 2024, 03:38:54 pmOkay, this is great. This is very useful. I will definitely dig this deep. Do you think that a bench-top LCR meter will help me in quantifying the sensor parameter change? I'll study this circuit and get back with more questions for sure! Thanks a lot

author: Poroit
author_rank: Frequent Contributor
timestamp: June 07, 2024, 08:50:29 am
content: Re the loadcell suggestion.What do you expect the overall weight of the tube and water would be?You may be able to hang the tube on a Tension Loadcell.https://www.burster.com/en/sensors/load-cells/tension-and-compression-load-cells

author: iJoseph2
author_rank: Regular Contributor
timestamp: June 07, 2024, 09:23:25 am
content: I might be a bit late to provide suggestions ..BMW make an engine oil level sensor (bmw part number 12617508003 which you can look up on realoem.com - make sure you use an ad blocker with this site) .. which (how i understand it) has two wires in the sensor .. one to measure the current temperature of the oil and another that heats up the oil to 10 degrees higher than current. Then it measures the rate at which the oil cools and from this knows the level. I believe there is an IC inside the sensor controlling this.I've no idea how accurate this is or can be made.

author: ledtester
author_rank: Super Contributor
timestamp: June 08, 2024, 12:51:32 am
content: Quote from: Sensorcat on June 04, 2024, 10:40:48 pmOn the Youtube channel Robert's Smorgasbord:https://www.youtube.com/@robertssmorgasbordthere is a 10-part set of videos detailing his journey in creating a capacitive liquid sensor.The tenth one:Capacitive Liquid Level Sensing (10): Errata, Miscellaneous, The End - Robert's Smorgasbordhttps://youtu.be/TdAnryA6h-Mprovides a good summary of all the lessons he learned.

author: MasterT
author_rank: Frequent Contributor
timestamp: June 08, 2024, 01:40:37 am
content: If uCPU in consideration has camera interface I'd suggest direct optical reading, same way as human bean.Advantages are : non contact, no wiring, easy to re-scale

author: Sensorcat
author_rank: Regular Contributor
timestamp: June 08, 2024, 08:50:03 pm
content: Quote from: ledtester on June 08, 2024, 12:51:32 amNow I understand why so many posts claim that the resolution of capacitive sensing is insufficient for the OP application. If you use such an inferior time-domain fiddling-with-charging-curves approach to signal processing, together with the questionable recommendation not to use coax, then it will not do. By using coax shield as a guardhttps://en.wikipedia.org/wiki/Driven_guard, cable capacitance will disappear, and by using singal processing integrating over an integer muliple of PLCs, it's in fact easy to make what the OP wants.Sadly, the good sources are harder and harder to find, because everybody who thinks he has learned something, feels the urge to immediately publish inferior results.

author: AlienRelics
author_rank: Unknown
timestamp: June 08, 2024, 09:32:47 pm
content: QuoteSure, dependent on the resolution of the LCR meter.I have used my old dual 555 cap meter with a more modern meter that reads down to 10uV resolution to measure down to 10fF (femtofarad) aka 0.01pF resolution. I'm sure if I put my mind to it, I could do better now.

author: AlienRelics
author_rank: Unknown
timestamp: June 08, 2024, 09:38:17 pm
content: Quote from: Sensorcat on June 08, 2024, 08:50:03 pmOr put the electronics right at the sensor and then you are only sending a digital signal back.

author: dietert1
author_rank: Super Contributor
timestamp: June 09, 2024, 11:15:04 am
content: It may be one transistor for a colpitts oscillator at 10 MHz or so - something easy to measure. The capacitor electrodes could be ring shaped. And a shield around the tube including sensor.If one could add a colored additive, a photoelectric sensor made of a LED and a photodiode could be an alternative. There are 1x10 mm photodiodes or one can use a line CCD sensor.What is the measurement range?Regards, DieterEdit: I think nowadays one can use a MCU with video to solve such problems. Look for "april tags" with "OpenMV Cam M7".

author: Doctorandus_P
author_rank: Super Contributor
timestamp: June 12, 2024, 01:05:21 am
content: Like "MasterT", I think that a webcam may well be a viable option. Maybe combine it with a line laser to illuminate the water column, and combine it with refraction of the light in the water column.

author: DTJ
author_rank: Super Contributor
timestamp: June 12, 2024, 01:48:27 pm
content: Quote from: ikkaru on June 07, 2024, 05:44:45 amA dye may not be needed. You just need a detectable difference in transmission absorption at the wavelength of your light source.Might have to see what he IR absorption of different plastic tubes is V water or whatever your fluid is.You could also use wavelengths other than IR.

author: tooki
author_rank: Super Contributor
timestamp: June 14, 2024, 12:48:06 pm
content: Quote from: Sensorcat on June 08, 2024, 08:50:03 pmFWIW, there is a really cool measurement IC from Smartec called the Universal Transducer Interface (and yes, they do abbreviate it to “UTI” 😂), and its approach to capacitance measurement (using a charge amplifier and two coaxial cables per DUT so it can do a four-pole measurement) lets it ignore cable capacitance grossly in excess of the capacitance being measured. I used six of them to build a capacitive level meter for a physics experiment, using two channels to measure the rough level (2x ~1.5m long sensors, one stacked atop the other to measure around 3m), and then four channels to accurately level a sensor platform just above the surface of the liquid (liquid xenon in this case) within about a millimeter (4x 30mm sensors). The theoretical resolution is actually about 0.02mm on the short sensors, about 1mm on the long ones, excluding effects of the probe designs and ripples in the surface of the liquid. The long sensors have a full-scale capacitance of about 250pF, the short ones about 30pF IIRC, and the UTI lets those be read with repeatable 0.02pF resolution using averaging — and does that through 5m of coaxial cable (RG-196, ~96pF/m, so close to 500pF cable capacitance). The results correlate extremely well to the large bench LCR meter used for comparison. (I tested a few dozen different capacitors.)This is using the UTI’s 300pF mode. If the DUTs were smaller, one could use the 12pF or 2pF modes, which the datasheet says lets it reach down to attofarad resolution, even with hundreds of pF of cable capacitance.https://smartec-sensors.eu/cms/pages/products/uti-interface.phpSmartec’s public documentation only glosses over how its capacitance measurement works, but the research papers from the guy who created it go into much more detail. I can dig them up if someone is interested, I have them saved.While I haven’t used it for this, the “universal” in its name is because it can also measure resistance.The biggest downside to the UTI is that it’s extremely hard to find. None of the big distributors carry it, so you have to check with the smaller distributors Smartec partners with. It’s around $10-15 apiece, depending on IC package. (That reminds me, I want to order some at some point to have around.)It also uses a weird output format (period-modulated square waves, but in sequences you have to read out in order, to get the null capacitance, reference cap capacitance, and DUT capacitance) that you basically have to measure. I used a PIC with an advanced 24-bit counter to do it, but more talented programmers than me could read it with pretty much any MCU.

author: Vtile
author_rank: Super Contributor
timestamp: June 17, 2024, 07:39:53 pm
content: Edit. Ok, I misread the topic as it is actually height or fill level of water container, not a level sensor (eg. Water bubble level). My bad.Why not just use accelerometer, they are plentifull on market Murata (VTi) was/is used a lot in the cars, cheaper ones can be found on gameconsole controllers and other house hold devices.The reference is 1g force towards earth (ok ok it is fluctuating if you ask from physicist and especially geophycisist).