I'm looking to build a sensor which will detect the level of liquid in a tube.

It does not have to be precisely accurate, just detect whether the level is approximately above a certain height.


The liquid level can be seen in the red oval


I thought about monitoring this with a webcam and using opencv to detect the liquid level. but this seemed a bit overkill. Especially if I have to have a dedicated PC to process the images.

Surely there's a simpler solution.

Perhaps a component I can attach to a raspberry PI or arduino board ...

I'm not very familiar with laser sensors so I don't know what is suitable.

As long as it's reliable ...


I should add that the tube contains toluene which is flammable, and it is vacuum sealed. So we can't just drill into it. Some kind of optical/laser sensor might be OK, as long as it can recognise a clear liquid.

  • $\begingroup$ What kind of liquid are you talking about, water or can it be something else? $\endgroup$
    – fibonatic
    May 14 '15 at 11:33
  • $\begingroup$ @fibonatic The liquid is toluene. Note that this is flamable. $\endgroup$
    – sav
    May 14 '15 at 23:08
  • $\begingroup$ I should also add that the tube is vacuum sealed. $\endgroup$
    – sav
    May 14 '15 at 23:22
  • $\begingroup$ I've just been informed that the tubes contain toluene and shelite. $\endgroup$
    – sav
    May 19 '15 at 2:38
  • $\begingroup$ maybe refractive index ? fiso.com/admin/useruploads/files/fri.pdf $\endgroup$
    – sav
    May 19 '15 at 2:38

If you look in the industry, they usually use capacitive proximity sensors.

This sensors can be adjusted easily to sense behind the glass. In addition I can tell you, that this measurement is highly reliable. Usually they start around 70$, but you find also some cheaper DIY-solutions.

Another possibility is the use floating styrofoam with a magnet on top of the liquid. Just place a reed-relay at the side of your tube and you got the position.

The disadvantages of the listed solutions are that they provide only digital measurements. You get only information like this: The liquid is higher or lower than X cm.

For analog measurements refer to LPs' solution or work with the weight of your device and calculate then the height of your liquid.

EDIT: concerning the edit of the questions, You should really consider the capacitive proximity sensors, which are usually used for such applications, because you do not need to modify the tube at all.


Here's a few ideas:

  • Insert two bare wires as probes and measure the resistance between them. The resistance should drop dramatically once the liquid touches both sensors.

  • Insert a sonar into one end that points directly into the tube. This method should give you a simple measurement of how far the surface of the fluid is from the sensor. I'm not sure how well a sonar works inside a tube as there will be echoes and such to consider, but some experimentation might lead to good results.

  • Seal the tube at one end with a cork and put a barometer on the inside. The rising level of fluid will compress the air and register different "altitudes" on the barometer.

  • Maybe its possible to use an IR beam through the tube if you can apply a dye to the fluid.

  • $\begingroup$ Using visible light might require dye in the fluid; IR probably wouldn't $\endgroup$ May 14 '15 at 22:48
  • $\begingroup$ @jwpat, that's a good point, in fact glass is opaque to IR as well, so depending on what the tube is made of, that approach might not work at all. $\endgroup$
    – Octopus
    May 14 '15 at 23:20
  • $\begingroup$ I should also add that the tube is vacuum sealed, so we don't want to just go drilling into it. $\endgroup$
    – sav
    May 14 '15 at 23:21
  • $\begingroup$ @Octopus, as noted in a physicsforums.com thread some window glass has low IR transmittance but several kinds of glass have high transmittance. Eg, lots of SiO₂ optical fiber is driven by IR or near-IR. For UV, see wikipedia Ultraviolet Blockers and absorbers article $\endgroup$ May 15 '15 at 5:29

You have to look at pressure sensor usually used in washing machines market.

Usually are components or amplifier where you can connect your tube directly, and it will give you an output proportional to the pressure.

First googled LINK

All sensor catalogue LINK

  • $\begingroup$ Are there any pressure sensors that will work from outside the glass? We don't want to drill into the case because it needs to remain pressure sealed. $\endgroup$
    – sav
    May 14 '15 at 23:47
  • $\begingroup$ Did yoi tried to find out laser densitometer? You can use density to calculate pressure variations. $\endgroup$
    – LPs
    May 16 '15 at 16:10
  • $\begingroup$ I got the impression that the densitometer needed to be in contact with the tube. Am I mistaken about this? Can the densitometer measure the fluid from outside the glass? $\endgroup$
    – sav
    May 17 '15 at 6:41
  • $\begingroup$ I read your edit now. As fra as I know, laser densitometer has to be in contact with the pipe. Do you have temperature of liquid? You could derivate density from temperature and then derivate pressure from density, but I don't really know how much approximated can be. $\endgroup$
    – LPs
    May 18 '15 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.