Volumetric measurement of liquid in transparent container - Page 1
Forum section: electronics / projects

author: speechsupply
author_rank: Contributor
timestamp: June 22, 2018, 10:46:30 am
content: I'm working on a way to measure the amount of water in a container.The container is transparent, has no lid, and is made of glass or plastic. It holds 3 liters = 101 oz and stands on a tabletop mostly.But, due to various challenges, I would prefer to measure the volume from beneath. ( To avoid dipping a MPXx2051 or float into the water)Using a strain gauge is def. a viable option but I would prefer to have a sealed enclosure with no external moving parts.Requirements for accuracy and precision are quite low. If I have to present actually numbers, I would say that a resolution of around 100 ml. with a +- 10 ml accuracy would suffice.Possible solutions are:** Updated **A. Use a Sharp GP2Y0A41 or similar and hopefully manage to detect the water level. Will try this within the next couple of weeks.B. Capactive sensing on the outside of the container. This solutions violates the desire to only monitor from beneath, but could be a preferable solution to weight cells. // Thanks to: forrestc, and larsdenmark for the suggestion.C. Container resonance? Is this viable, also in plastic containers?D. ideas?Let me hear what you think

author: EmmanuelFaure
author_rank: Regular Contributor
timestamp: June 22, 2018, 11:28:46 am
content: What are your requirements in term of accuracy and cost?

author: jpanhalt
author_rank: Super Contributor
timestamp: June 22, 2018, 11:44:29 am
content: Several years ago a participant on another forum tried to measure the surface distance to water with that device. She had trouble getting good reflection without adding something to the water. Maybe your experience will be different.I did a very crude experiment with a TOF laser distance measuring device and bounced off the bottom of the container. Since the speed of light is considerably different in air versus water, given a fixed distance above the bottom, I could estimate the depth of water.

author: larsdenmark
author_rank: Regular Contributor
timestamp: June 22, 2018, 12:44:25 pm
content: Knowing the required accuracy and response time would help a lot to direct the idea generation. Is the container connected to anything while the measurement takes place?Weighing the container would be the obvious thing to do.You could also shine a laser on the surface of the liquid at an angle and detect where the beam hits a detector on the bottom.Try to measure the capacitance between two electrodes that are connected to the side of the container and see if you can correlate that to the water level.You could use the resonance of the container (that will depend on the level of water), but you'll probably need some special (crystal) glass to get a good resonance. Also if the resonance is within the audible spectrum then this will be rather annoying to listen to.

author: DTJ
author_rank: Super Contributor
timestamp: June 22, 2018, 01:21:18 pm
content: Maybe looks as the products made by Onno Sokki who make some accurate fuel flow instruments and see how they do it.At least some of them use a strain gauge.https://www.onosokki.co.jp/English/english.htm

author: JS
author_rank: Frequent Contributor
timestamp: June 22, 2018, 05:08:51 pm
content: You don't nees moving parts, you don't need to measure the weight of the tank, just the preassure at the bottom, a pressure sensor connected to the bottom is enough, if you can poke a hole in the bottom great, if not a hose comming to the top with some gizmo to keep it full with air or water, if filled with watter or a hole on the bottom the sensor must be at the bottom level or you will get an offset wich you could correct for later, but the hose should have a soft diaphragm on the opening so it's allways filled with the same thing. Or sumerge the sensor, depending on reliability would be easier to pot the sensor and let it lived sunmerged.JS

author: DTJ
author_rank: Super Contributor
timestamp: June 24, 2018, 10:31:08 am
content: If you could read from above the sharp distance sensor could read the distance to a float on the surface.

author: speechsupply
author_rank: Contributor
timestamp: June 25, 2018, 08:17:24 am
content: Quote from: EmmanuelFaure on June 22, 2018, 11:28:46 amRequirements for accuracy and precision are quite low. If I have to present actually numbers, I would say that a resolution of around 100 ml. with a +- 10 ml accuracy would suffice.Quote from: jpanhalt on June 22, 2018, 11:44:29 amI was hoping to "reverse" your setup, shining from the bottom up, relying on the water-to-air density difference.. Not sure it will work. Waiting for partsQuote from: larsdenmark on June 22, 2018, 12:44:25 pmYes! that could be a viable way - this sensor looks quite interesting:http://www.ti.com/lit/ug/tidu736a/tidu736a.pdfOnly problem is, that I'll be moving up the side of the container.Quote from: larsdenmark on June 22, 2018, 12:44:25 pmLike a wine glass - changing its pitch with the amount of volume. Perhaps ahttps://www.sparkfun.com/products/10917surface transducer and a piezo pick-up could be used?Quote from: JS on June 22, 2018, 05:08:51 pmThat is a way, most definitely. Unfortunately I would have to submerge or break through the container which is not an option ATM.

author: forrestc
author_rank: Unknown
timestamp: June 25, 2018, 08:32:10 am
content: Quote from: speechsupply on June 22, 2018, 10:46:30 amI don't see anyone who has suggested this (sorry if I missed it):The best way to accomplish what you are looking for is with a capacitive sensor. It can be applied to the outside of the container and will reliably detect the height of the fluid inside the container. There are numerous appnotes out there about how to do this. I know in particular microchip had one.Searching, I found:https://www.hackster.io/team-protocentral/non-contact-capacitive-liquid-level-sensing-using-fdc1004-9333c7which is a good description of one process. Microchip AN1375 describes another very briefly in section 6.The summary of all of these methods is to arrange some wire/traces such that the level of the liquid changes the capacitance between the traces. Measuring the capacitance between the wires will then give you the height of the liquid.

author: speechsupply
author_rank: Contributor
timestamp: June 25, 2018, 09:57:59 am
content: Quote from: forrestc on June 25, 2018, 08:32:10 amI did link to the TI application note in an earlier post, but I hadn't found that from hackster.io. Really great resource, thanks! I'll make sure to update the original post

author: JS
author_rank: Frequent Contributor
timestamp: June 26, 2018, 04:13:41 am
content: Usually specs are the other way around, so you have a few less significant digits of uncertainty. That being precision being smaller than accuaracy.JS

author: jaredwolff
author_rank: Newbie
timestamp: June 26, 2018, 04:21:59 am
content: I've used capacitive in the past. Spaced out the pads per units of volume so I knew, approximately, how many mL were removed. Capacitive though becomes a pain when any other elements are involved (like your hands!) (This was, by the way, using a flexible PCB not something completely at the bottom of the cup)I'd also suggest (if it hasn't been already), especially if you're working from the bottom, using ultrasonic. If you have a homogeneous mixture (water or water like)ultrasonicworks like a charm.Jared

author: Berni
author_rank: Super Contributor
timestamp: June 26, 2018, 05:34:03 am
content: Since you are aiming for pretty low resolution of 100ml on a 3 liter container it would make sense to glue a flex PCB with capacitive pads on the side of the container. One could then use a MCU with plenty pins to measure the capacitance on 30 such pads and determine at what pad the capacitance suddenly jumps up. Additional sloped pads between the existing pads could be used to narrow i down the resolution further if needed.But usually the easy way of sensing level in a open tank is to simply screw a pressure sensor into the bottom (Provided you know the density of the liquid will always be the same)

author: tpowell1830
author_rank: Frequent Contributor
timestamp: June 26, 2018, 11:30:02 pm
content: Some clothes washing machines have an open tube that goes to the bottom of the washing tank so that when you rotate the load size switch to different positions, the machine can sense how much water is in the tank. I have not examined one of these circuits or setups very closely, but there would be varying air pressure in the tube as the water rises, so I am assuming it has a pressure sensor at the top of the tube. Makes sense...Hope this helps...

author: DTJ
author_rank: Super Contributor
timestamp: June 27, 2018, 03:19:03 am
content: Quote from: tpowell1830 on June 26, 2018, 11:30:02 pmI've seen industrial washing machines use this arrangement with an MPX style pressure sensor.

author: Berni
author_rank: Super Contributor
timestamp: June 27, 2018, 05:02:26 am
content: Quote from: tpowell1830 on June 26, 2018, 11:30:02 pmActually yeah i remember washing machines from the old days already using pressure to determine water level. It was just a round pancake shaped device with a small tube running from the bottom of it into the bottom of the drum. When the water level got to certain levels the pressure caused switches inside to close and that signaled the mechanical program controller to advance to the next step in the program.

author: max_torque
author_rank: Super Contributor
timestamp: June 27, 2018, 10:47:45 am
content: Why are you not just weighing the tank?? Simple, robust, sealed, repeatable. You have to be mad (or have a VERY good reason) to do any other method!

author: pwlps
author_rank: Frequent Contributor
timestamp: June 27, 2018, 02:53:57 pm
content: I have recently built a capacitance probe to measure the level of liquid nitrogen in a dewar. But I have tested it with water too and it works fine.I did not try the FDC1004 but I see two potential problems you should consider:1) The capacitance sensor described in the documentation of FDC1004 uses bulky electrodes an the calibration seems to be extremely sensitive to any stray fields or small changes in geometry. I wanted to have a simple probe that I can insert through a small hole in the dewar and also a portable system i.e. a probe that I can withdraw and insert again without loosing the calibration. Therefore I'm using a simple coaxial capacitor made of two concentric stainless tubes (6mm/3mm diameters), with the inner tube held with teflon spacers. The coaxial geometry makes the capacitor completely shielded from the outside environment (the outer tube is connected to the circuit ground). There are a few small holes in the outer tube so that the liquid level inside the capacitor can adjust quickly to the level in the dewar. The calibration is very easy: the change of capacitance is proportional to the liquid volume fraction and the dielectric constant of the liquid.2) Beware of simple capacitance meters which are sensitive to the resistive part of the impedance : if there is a leak in the capacitance then you would need a true LCR meter to extract the capacitive part (of course the constraints depend on the capacitance range, for my application it is of order of tens of pF). The commercial capacitive level meters I found for nitrogen are using simple circuits with either low frequency excitation or time-of-discharge measurement and are rather sensitive to leaks, they usually specify that the leak should not be bigger than 10 MOhms or so. This is not always possible to achieve in an environment where the electrodes can be polluted by moisture near the top of the dewar, some of commercial probes fail to measure anything if there are are water droplets making a leak of order of hundreds kOhms, this is why I designed my own circuit.The documentation of FDC1004 is not very clear about this point, as it only says:"The FDC1004 can be used to measure liquid level in non-conductive containers." (sec. 9.1.1)What about the liquid itself? A pure non-conducting liquid does not exist, water can be considered as conducting or non conducting dependiong on the resistance range you are concerned with.My circuit (I can send you the schematics if you are interested) is a capacitance half-bridge working at 2MHz and using a phase-sensitive detection to discard most of the resistive part, it is insensitive to leaks down to a few kOhms. The circuit is in a small box mechanically attached to the top of the coaxial capacitor to suppress any stray capacitances.Actually for water you might not need such precautions because its huge dielectric constant will give you much higher capacitances, so that simpler circuits might do the job (but I didn't do any numerical estimations).

author: speechsupply
author_rank: Contributor
timestamp: July 06, 2018, 11:57:19 am
content: Quote from: max_torque on June 27, 2018, 10:47:45 amYeah it's absolutely a solution. The reason why I want to avoid weighing is primarily due to the "mechanical" aspects of building a sealed enclosure with weight cells. Tried it before, not impossible, but once someone other than me starts throwing this stuff around...Quote from: DTJ on June 27, 2018, 03:19:03 amAbsolutely, but due to contamination I would prefer to avoid direct contact with liquids within the container.Quote from: pwlps on June 27, 2018, 02:53:57 pmHave you shared this build on any website? Would love to see some pictures of it

author: jpanhalt
author_rank: Super Contributor
timestamp: July 06, 2018, 02:39:03 pm
content: Quote from: speechsupply on July 06, 2018, 11:57:19 amSorry, but that doesn't make sense. The "container" is made of something. You can make your probe out of the same material. How will a probe made of the came material as the container add contamination that the container doesn't add?How did your experiments with the Sharp detector go?

author: speechsupply
author_rank: Contributor
timestamp: August 06, 2018, 08:41:35 pm
content: Quote from: jpanhalt on July 06, 2018, 02:39:03 pmSorry for the radio silence, vacation and various other projects got in the way.- In essence you're right. However, the liquid in the tank could be water, orange juice, gatorade, etc.. So everyday, it has to be cleaned after use.I'm thinking, let me know if you disagree, that having a float, tube or similar internal measuring device will be difficult to clean properly.The Sharp detector is actually looking promising. BUT only with water... cloudy substances like milk, juice, etc. is obviously different. I expected this, but seeing that water somewhat works, is actually quite nice.

author: Marco
author_rank: Super Contributor
timestamp: August 06, 2018, 09:46:41 pm
content: Quote from: speechsupply on July 06, 2018, 11:57:19 amYou can buy presoldered, potted strain gauges ... what kind of abuse are you expecting? Do they randomly hit stuff with a hammer? Throw fuming nitric acid onto it for a laugh?

author: larsdenmark
author_rank: Regular Contributor
timestamp: August 07, 2018, 02:24:57 pm
content: I think capacitive sensing wins:Non-contact capacitive liquid level sensing using FDC1004 (ProtoCentral)Ask an Expert - How can a capacitive sensor be used in a liquid application?Liquid-level sensing using the FDC1004 EVMUsing a pressure sensor is also possible:Prototype Board - Pressure Sensor as Liquid Level Meterbut it is invasive, which is not what you want.I think any acoustical or mechanical exploitation of resonanses or time of flight will be fairly complicated and expensive (unless you only need to know if the container is full or not). If the properties of the liquids differ a lot you probably need to make a lot of experimentation (or modelling) in order to make things work.

author: Marco
author_rank: Super Contributor
timestamp: August 07, 2018, 03:30:19 pm
content: I don't see how the capacitance sensor can be accurate for arbitrary liquids at low levels (not that weight measurement works for arbitrary liquids of course). The reference sensor needs to be fully covered to be able to compensate the signal from the level sensor AFAICS.

author: speechsupply
author_rank: Contributor
timestamp: February 11, 2019, 02:09:56 pm
content: I agree, it could change with the varying liquids. However, I have a pretty strict selection of liquids, that will go into the container. Mainly consumable (by humans) liquids.I have the FDC1004 EVM kit now, I'll share results as I go along.

author: splin
author_rank: Frequent Contributor
timestamp: February 13, 2019, 01:12:22 am
content: Shine a light/IR beam at an angle towards the surface and use a linear optical sensor to detect the angle of the reflected beam. A vertical baffle across the container base, just past the point where the beam enters the container, is needed to block reflections from the container base reaching the sensor. The beam would not need to be especially well focused/collimated as the sensor output can be heavily filtered to determine the mean, or centre (or edges) of the reflected beam position. Modulating the light beam at even a lowish frequency (but not 50/60Hz or harmonics!) would allow ambient light to be ignored.Increasing the distance between the container bottom and the sensor increases the resolution.I just tried this with an LED torch (flashlight) and a plastic container with between 1 and 5cms of water and it looks promising.Problems:1) Preventing ambient light saturating the sensor - vertical baffles either side of the sensor will prevent light entering sideways but bright overhead lighting could be a big problem especially if it is incandescent which has lots of energy acrosss the spectrum including IR - LED or fluorescent lighting would allow you to select a suitable emitter wavelength and use a corresponding filter over the sensor.2) There is much less choice of linear sensors than single photodiodes/transistors and may be more expensive and difficult to work with. An array of, say 16, individual sensors may be enough so long as the reflected beam is wide enough to illuminate several sensors, the relative output levels being used to determine the centre or edges of the beam. Alternatively, if you were to relax your 'no moving parts' requirement, then you could use a fixed single sensor and oscillate the beam angle. Using a moving coil should be very reliable and bearings can be avoided by using a spring material, plastic or metal, to mount a mirror or an LED emitter. Avoiding linear sensors would give you much more flexibility in the choice of sensor wrt sensitivity, dynamic range and wavelength (including UV).3) If the container is very tall relative to its width, the beam would have to be near vertical and the reflectance may be insuffcient.4) It might not work well at very low water levels as some (or the majority if the beam is too 'wide') of the reflected beam may hit the vertical baffle seperating the emitter and sensors. Just spotted the requirement that this has to work with cloudy liquids such as milk or orange juice. The latter is likely to be a big problem especially if it is the 'with bits' variety. It may just be possible though if the beam is powerful enough and well focused. Using multiple emitters at different wavelengths may be needed to cope with a wide range of coloured liquids.

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 13, 2019, 01:53:23 am
content: Since the liquid probably has to get in and out in some way, wouldn't measuring the flow (with a flow sensor), instead of estimating the overall volume at any given time, adequate for your intended accuracy?

author: Rerouter
author_rank: Super Contributor
timestamp: February 13, 2019, 02:15:02 am
content: Grab a suitably sized kitchen scale without a removable measuring plate. And adhere or mount it to it. Steal the strain gauge wires and run to your own device.

author: speechsupply
author_rank: Contributor
timestamp: February 14, 2019, 08:03:36 am
content: Quote from: SiliconWizard on February 13, 2019, 01:53:23 amIn theory that could work. But the container mouth / top has a wide openingen. Meaning, that liquids can be poured from many angles.