Author Topic: How to measure the amount of liquid water in a thin tube (like a syringe)  (Read 3708 times)

0 Members and 1 Guest are viewing this topic.

Offline drcubesTopic starter

  • Newbie
  • Posts: 5
  • Country: us
I'm trying to accurately measure the amount of liquid sugar water in a narrow tube. To give some background I am a biologist studying energetics and biomechanics in hummingbirds. In the past we have measured the amount of nectar a hummingbird drinks by filming a clear tube such as a syringe body or pipette with a camera and later reviewing the footage of hummingbirds drinking and recording where the meniscus of the fluid is on the tube (the tubes need the gradation markings).
1004364-0
However, you might see how this is very time consuming as we get hundreds of "flower" visits per day and video analysis is a very tedious process. I am relatively proficient electrical engineer in that I have worked on many robotics projects and work (I was a mechanical engineer before switching to biology) but I am struggling to find good solutions to measuring the amount of liquid in the tubes. The goal is to accurately measure the amount of nectar (sugar water) drank per drinking session of a hummingbird to the nearest .01 milliliter but I'll take what I can get. A big plus would be if it would be a fast enough measurement that I could use the same sensing device as feedback for automatically refilling the tube with a peristaltic pump.
 
Some current and past tests and approaches I have made:
- IR led and IR transistor linear array along the length of the tube. The idea being that due to either the slightly different level of transparency of sugar water compared to air (and its snell index) that more IR light would pass through the air than the water and I would get a changing value as the nectar was drank (or filled back up). The results were lackluster as there was an extremely minimal change in reading the analog values of the transistors. I also tried a method where I shined IR light into the tube at different angles and had a single transistor at the back end (picture included) of the tube to measure the total IR light change, and although I got changing results the values were sinusoidal as the liquid was removed or added (not noise but actual values) and measurements were still not consistent enough.

IR Device
- Capacitive sensing: I wrapped a single layer of aluminum foil around the syringe body and soldered a wire to the aluminum. I then used the 2 pin capacitive touch sensor measurement method to measure the change in capacitance as the fluid level changes in the tube. This method has a lot of promise and I am still working with it but there are some major flaws. The values do change significantly enough to measure come changes but the baseline value jumps a lot. I realize I could keep re-zeroing the measurement through the day or so as the baseline changes but I worry about non-linear changes in the signal as well the difficulty of recalibrating where fluid level is in the tube compared to the measurement value. I have yet to try the built in 1 wire capacitive sensing method that some of my boards provide but I am working on this now.
1004366-1

Capacitive Device
- Linear CCD and line laser: I am waiting on my linear CCD (TCD1304DG CCD Linear Image Sensor) to arrive in the mail but I am attempting to shine the line laser through the clear tube with nectar (sugar water) in it and place the ccd on the opposite side so that I can measure the intensity of light going in to the other side. This is similar to some fancy devices already on the market that are currently way out of my research budget such as some of the Keyence laser edge sensor and through beam sensors. I have no results yet for this but I can update this post when those come in. Any suggestions on this method are welcome.
1004368-2

- Digital scale: I have done very little on this front so far but I have a beam-shaped load cell with strain gauges on it and a strain gauge amplifier. No tests with this but my primary concerns are that the gauge will not have high enough resolution to detect the amount of liquid change from a single feeding. ( < 1 gram change per feeding event)
 
In all I am looking for any suggestions for methods of measuring fluid in a narrow tube with accuracy, repeatability, and relatively quickly (although speed is the least important of the 3) and although my budget is not small I am not looking at big priced sensor products (soft cost cap of $200 just for sensor components).
I am using some standard microcontroller boards such as the Adafruit ItsyBitsy M0 and an assortment of ESP32 dev boards for now but open to suggestions.
 

Offline hendorog

  • Super Contributor
  • ***
  • Posts: 1635
  • Country: nz
Pressure sensor might work if the syringe is large enough diameter.

The other option I can think of is an ultrasonic level sensor.

Edit: Instead of a complex sensor to measure the amount consumed, perhaps you could use a single sensor of some sort to determine the fill point - and then calculate the volume dispensed from the pump cycles?



« Last Edit: June 18, 2020, 03:17:59 am by hendorog »
 

Online DaJMasta

  • Super Contributor
  • ***
  • Posts: 2393
  • Country: us
    • medpants.com
Since it's sugar water.... could you use a food safe dye and then do it optically?  You'd have to make sure dye was also safe for the birds, but I assume one of the commonly available ones would probably work well.


I'm wondering if you could get crafty with this.... maybe use a chiller and look at the liquid level height with a thermal camera (works fine with just evaporative cooling in a normal glass, but could be challenging with a small enclosed tube).


Maybe even by weight?  Hang the tube on a sensitive scale, fill it, wait for a drink, measure again for the difference, refill.  You'd probably need some very high integration times (or DSP filtering) to null out error from wind or whatnot, but it could be probably be made to work.  It helps in this case that they don't land to feed!  And if load cells aren't an option for sensitivity (nor force sensitive resistors or pressure sensors and a pneumatic suspension or something), you could also just for for a simple balance and a way to measure the deflection angle.  A good balance scale can be very sensitive and repeatable.


Maybe you can get your peristaltic pump to introduce periodic bubbles - say one every 10th of a mL - and then just monitor the flow of the bubbles (though I don't know if this would deter feeding at all).  You'd probably have to go out of your way to keep the feeding tube level as well, which could be problematic.
 

Offline phil from seattle

  • Super Contributor
  • ***
  • Posts: 1063
  • Country: us
how wide is the tube? perhaps you could use ultrasonics to measure the level though noise would be a big issue.

I know that in my feeder, there are bubbles as they draw down the nectar.  You could detect the bubbles.  Though it takes multiple feedings to generate one bubble.

Or, you could measure the pressure in the tube.  As they feed it will drop until it pulls some air into it.  There is probably a model that relates pressure drop to amount of nectar taken.

Still in all these, the changes are so small that you'll be fighting noise.
 

Offline wilfred

  • Super Contributor
  • ***
  • Posts: 1388
  • Country: au
How important is it to know with such precision how much each bird consumes each visit to the feed point?

Could you achieve your aims with a count of feed sessions and divide that into the total fluid consumed and work with the average. I am assuming a humming bird just takes what each flower has to offer until it is percieved easier to move to the next flower. ie the quantity consumed is a function of nectar available and not the nectar the bird requires. But then I'm not studying the feeding habits of Hummingbirds.

It might be easier to count feeds and just measure fluid consumed from the resevoir once per day. You'd have to find another way to ensure "nectar" is always available though. That may be a simpler problem.

Admittedly without complete understanding of your aims I am thinking of an approach where you deliver nectar via capilliary action to the feed point and control the resevoir level to control the flow to the feed point. Do you just have to present a droplet at the feed point? It might be easier to sense the formation of the droplet. Or maybe drop a bead into the resevoir to raise the fluid level the same amount as the drop the bird just consumed and hence force another droplet to form.

I'm just trying to turn the problem around to achieve what I think might be easier to solve and more reliable and cheaper. But I also don't know what you're ultimate aims are.
 

Offline drcubesTopic starter

  • Newbie
  • Posts: 5
  • Country: us
how wide is the tube? perhaps you could use ultrasonics to measure the level though noise would be a big issue.

I know that in my feeder, there are bubbles as they draw down the nectar.  You could detect the bubbles.  Though it takes multiple feedings to generate one bubble.

Or, you could measure the pressure in the tube.  As they feed it will drop until it pulls some air into it.  There is probably a model that relates pressure drop to amount of nectar taken.

Still in all these, the changes are so small that you'll be fighting noise.

The inner diameter of the tube is 4.36 mm in diameter so it is rather narrow. I have only used the HC-SR04 as far as ultrasonic sensors go so either I would have to have the bird directly drink from the reservoir by changing how the bird accesses the nectar.

As far as a pressure sensor goes, how would you locate the sensor itself?  Maybe similar to where I put the IR transistor for the 90 degree IR method.  However, would the fluid in the "feed" line that passes through the peristaltic pump affect the pressure of the system?  I'm not sure what to expect the pressure readings to be since the walls of the vessel are very narrow and the surface tension at the air/nectar boundary is likely significant.
 

Offline drcubesTopic starter

  • Newbie
  • Posts: 5
  • Country: us
Pressure sensor might work if the syringe is large enough diameter.

The other option I can think of is an ultrasonic level sensor.

Edit: Instead of a complex sensor to measure the amount consumed, perhaps you could use a single sensor of some sort to determine the fill point - and then calculate the volume dispensed from the pump cycles?

I like the idea of a single fill point sensor and I've been kicking that idea around a bit too. As long as I can get a very reliable sensor measurement change when the air/nectar interface reaches the sensor then I think that could work.  The simple peristaltic pump I've been working with right now does not have an encoder built in to it so I would have to either add one or rely upon my characterization of the pump. I should add that I do have a stepper motor based peristaltic pump coming in the mail which should make things a bit easier.



 

Offline drcubesTopic starter

  • Newbie
  • Posts: 5
  • Country: us
How important is it to know with such precision how much each bird consumes each visit to the feed point?

Could you achieve your aims with a count of feed sessions and divide that into the total fluid consumed and work with the average. I am assuming a humming bird just takes what each flower has to offer until it is percieved easier to move to the next flower. ie the quantity consumed is a function of nectar available and not the nectar the bird requires. But then I'm not studying the feeding habits of Hummingbirds.

It might be easier to count feeds and just measure fluid consumed from the resevoir once per day. You'd have to find another way to ensure "nectar" is always available though. That may be a simpler problem.

Admittedly without complete understanding of your aims I am thinking of an approach where you deliver nectar via capilliary action to the feed point and control the resevoir level to control the flow to the feed point. Do you just have to present a droplet at the feed point? It might be easier to sense the formation of the droplet. Or maybe drop a bead into the resevoir to raise the fluid level the same amount as the drop the bird just consumed and hence force another droplet to form.

I'm just trying to turn the problem around to achieve what I think might be easier to solve and more reliable and cheaper. But I also don't know what you're ultimate aims are.

I like the idea for getting the average nectar amount drank by averaging based on visits and total drank per day.  Although I eventually want to get accurate measurements for specific feeds (so I can understand feeding amount across the day) getting the average value per day could work except that I would need to at least know the average drank per day per individual.
 

Online Berni

  • Super Contributor
  • ***
  • Posts: 5050
  • Country: si
Is it possible to make the setup as small as possible put it on a weight scale?

Weighing things is the easiest way to accurately find the amount of stuff you have without needing special setups for handling things like fluids of a certain viscosity range, its even more handy for gas.

So if you can make your setup weigh < 100g then you could set the whole thing onto a precise milligram scale. To get readings from it you can either buy a expensive scale that comes with a computer interface port, or get a cheep scale and hack it in some way attaching your own electronics (Sometimes you can tap into the data lines to the precision ADC chip)
 

Online David Hess

  • Super Contributor
  • ***
  • Posts: 17429
  • Country: us
  • DavidH
- Capacitive sensing:

Capacitive sensing should work but you might need to guard the outside from stray electrostatic effects.

Quote
- Digital scale: I have done very little on this front so far but I have a beam-shaped load cell with strain gauges on it and a strain gauge amplifier. No tests with this but my primary concerns are that the gauge will not have high enough resolution to detect the amount of liquid change from a single feeding. ( < 1 gram change per feeding event)

Much less than 1 gram resolution is not a problem with load cells. In practice a resolution and accuracy of 1 part in 4000 (12 bits) is easy and 1 part in 40,000 (16 bits) is feasible.  The load cells used to measure things like diamonds will also detect the weight of a fingerprint.

Pressure sensor might work if the syringe is large enough diameter.

A differential pressure sensor suitable for an inch of water or less should work.  I checked the specifications on one and the accuracy over time and temperature is sufficient.
 

Offline Harm314

  • Newbie
  • Posts: 9
  • Country: nl
Given that you currently use video monitoring, I would suggest using automated analysis of the footage with computer vision, e.g. using OpenCV. This has the advantage that you already have a testset of data, and that verification of the automated measurement results is straightforward. The suggestion to add food colorant will likely help to make measuring the level easier.

Going forward, you could set up a camera in time lapse or event triggered (bird detected) mode, taking a snapshot before and after a bird visits the setup. I have used a raspberry pi with a camera for a vaguely similar goal (automated readout of a non-electronic counter). For your purpose, compression or averaging of the image along the width of the tube allows to minimize data without losing resolution.

With a camera solution the size of the setup will need to be large enough to minimize parallax effects, depending on the length of the tube, the camera, and the lens used. If you can use an enclosure around the whole measurement part, then optimizing the light source, optics, and camera together to give good contrast of the meniscus should be straightforward.
 

Offline phil from seattle

  • Super Contributor
  • ***
  • Posts: 1063
  • Country: us
The feeders I am familiar with are closed end, inverted tubes.  The opening at the bottom sits in a shallow pan with the rim maybe 1/4" higher then the bottom of the tube.  The tube is filled with nectar and inverted.  As the hummers lick the nectar, it lowers the level in the pan. As this happens the pressure in the tube decreases. At some point the level of the pan gets low enough, a bubble of air enters and a small amount of nectar escapes into the pan and the the cycle repeats.

So the idea is that the pressure of the air in the top of the tube drops as the birds feed and then rapidly increases when a "bubble" event happens.  I don't know if the differential is significant enough to measure easily but if possible it you would be able to track pressure drops as a function of feeding.  You would need to correlate the pressure drop to amount of nectar removed.  It is also probably a function of how much head space you have in the tube so calibration is tricky.
 

Offline nfmax

  • Super Contributor
  • ***
  • Posts: 1624
  • Country: gb
If you can make the tube out of metal, mounted with its axis vertical, then it should be possible to use the cylindrical air space above the meniscus as the frequency-determining element of a microwave oscillator. Even tiny changes in frequency, caused by lowering of the meniscus as sugar solution is withdrawn from the feeder, should be measurable with a decent microwave frequency counter. You can use a coax cable to feed the signal back from the feeder to the counter, inside your lab.

If you take this approach it may be worthwhile making the tube larger, which will reduce the resonant frequency somewhat so as to lower the cable losses and/or cost.
 

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 6126
  • Country: 00
[...]

- Digital scale: I have done very little on this front so far but I have a beam-shaped load cell with strain gauges on it and a strain gauge amplifier. No tests with this but my primary concerns are that the gauge will not have high enough resolution to detect the amount of liquid change from a single feeding. ( < 1 gram change per feeding event)

[...]
 

I would say this might be one of the more promising ideas.  I have a cheap Chinese scale in the lab that measures to 0.01g that I would definitely trust to 0.1g accuracy.  It is definitely a viable method of measuring sub - 1g quantities of H2O.

You could buy one of those and hack it, or re-use its parts to build your own...  it will likely be cheaper than trying to buy the parts separately!

E.g. https://www.amazon.com/MVZAWINO-Precision-Portable-Electronic-Stainless/dp/B07CL1HD8K/

 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11714
  • Country: my
  • reassessing directives...
cheap jeweller's scale can measure 0.01g, you can reuse the hardware into your ADC/digital FW to tune to your specific need or you can even further reduce the resolution to like 1mg using lever mechanism, how much resolution do you need? i have one of this jeweller's scale and the reading changes significantly with just slight of air blow or breath, so you have to put it inside a chamber or still air to get stable/repeatable reading.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 
The following users thanked this post: ogden

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Introduce some small intermediate reservoir with level sensor, then use miniature (peristaltic?) pump to fill it.
 
The following users thanked this post: sarahMCML

Offline jogri

  • Frequent Contributor
  • **
  • Posts: 405
  • Country: de
Use a low power laser to shine through the pipette with a photodiode on the other side. Water and air will let the light pass, but the meniscus will mess with the reflection->drop in intensity right when the laser is at the same level as the meniscus. Take a peristaltic pump with a servo motor (you can scavenge an old HPLC instruments, they have accurate peristaltic pumps) and then just measure how many rotations of the servo motor/pump it takes to fill the pipette up after each hummingbird. Then just calculate the amount of liquid from the degrees of rotation it took.

Edit: I tested the laser/meniscus approach with 8mm test tubes, works like a treat (so it should also work with your 4mm ones, even with a crappy laser diode).
« Last Edit: June 18, 2020, 05:01:16 pm by jogri »
 

Offline TheMG

  • Frequent Contributor
  • **
  • Posts: 867
  • Country: ca
Another alternative would be a TDR (time domain reflectometer) level sensor. I don't know if any of the commercially made units would be small or accurate enough for your use case but with some effort it would be possible to roll your own.
 

Offline drcubesTopic starter

  • Newbie
  • Posts: 5
  • Country: us
Use a low power laser to shine through the pipette with a photodiode on the other side. Water and air will let the light pass, but the meniscus will mess with the reflection->drop in intensity right when the laser is at the same level as the meniscus. Take a peristaltic pump with a servo motor (you can scavenge an old HPLC instruments, they have accurate peristaltic pumps) and then just measure how many rotations of the servo motor/pump it takes to fill the pipette up after each hummingbird. Then just calculate the amount of liquid from the degrees of rotation it took.

Edit: I tested the laser/meniscus approach with 8mm test tubes, works like a treat (so it should also work with your 4mm ones, even with a crappy laser diode).


That's good to hear that it worked for you!  Can I ask, what kind of photodiode did you use? And what power and wavelength of laser did you use?
 

Offline jogri

  • Frequent Contributor
  • **
  • Posts: 405
  • Country: de
That's good to hear that it worked for you!  Can I ask, what kind of photodiode did you use? And what power and wavelength of laser did you use?

Sorry to disappoint you, but it was just a quick-and-dirty proof of concept. I moved a test tube filled with water in front of a laser pointer... The laser is right at the meniscus in the picture, as you can see the intensity drops quite a bit at this point.

 

Offline ahbushnell

  • Frequent Contributor
  • **
  • Posts: 751
  • Country: us
Metalize the outside of the tube that is a dielectric.  Then measure the capacitance between the liquid and the metal. 

Andy
 

Offline ahbushnell

  • Frequent Contributor
  • **
  • Posts: 751
  • Country: us
Metalize the outside of the tube that is a dielectric.  Then measure the capacitance between the liquid and the metal. 

Andy

https://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=HPC052&DocType=DS&DocLang=English

They measure capacitance in this relative humidity sensor using an oscillator that changes with capacitance. 
 

Offline bson

  • Supporter
  • ****
  • Posts: 2497
  • Country: us
You could fill a small glass pipe with a column a water and drop a small float on top, then use a camera to record the position of the float.  If you set the camera to take an image every few minutes you have a record of its position over the day.  Extracting the position of the float from an image shouldn't be difficult.  Maybe calibrate for solution expansion with temperature.
« Last Edit: June 19, 2020, 02:04:40 am by bson »
 

Offline pickle9000

  • Super Contributor
  • ***
  • Posts: 2439
  • Country: ca
Use a peristaltic pump to maintain a level in the tube. The level sensor could be whatever you want. The pump would do the measurement. I'm not sure about how the birds would feel about the pump maintaining the level but the pump would need to be mounted far enough away to keep the noise down but it would allow the accuracy you are looking for.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11714
  • Country: my
  • reassessing directives...
or you can connect the tube to adjacent large tank reservoir (both open air system) tube's height is adjusted accordingly to get the level to the tip, and then it will take many humming birds to reduce the level slightly. needs no electrical parts.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf