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).

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.

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.

- 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.