Determine Size of Glass

Trying to figure out the best way to determine the size of a glass that is placed on a FSR. The problem im having is the wide range of different glass sizes. I need to be able to get the size so that there isnt an accidently spillage of fluid. Any Ideas?


By size do you mean physical dimensions or volume capacity

FSR, Force Sensitive Resistor aka a scale

And by size i mainly would like volume but finding the dimensions i can get a good enough volume to determine whether or not to pour the liquid. I am going to be using one IR sensor to determine the location of the top of the glass. But just looking for ideas as to ways to get dimensions and/or volume

You have a mechanism (IR) to detect the top of the glass, could you also have one to detect the level of liquid and just ensure it stops before top of glass.

The liquids are being mixed so if I stop it early it wont be the same drink and not taste right. Need to know before the liquid is dispensed in order to ensure the drink can be dispensed

Probably not practical at all but i'm sure you could determine the volume of the glass using sound. By using a small speaker and microphone you should be able to capture a impulse response representative of the inside of the glass. Then using the appropriate algorithm determine it's volume/shape/..material even maybe. No idea if it could be done with an arduino or not but the whole reverb market is quite advanced you can create reverbs based on a selection of volume/dimension/material so i don't see why it couldn't work the other way especially as your dealing with a limited range of items, ie drinks holders.

Take 2 steps back and simply use one size of glass. Sometimes we are guilty of over-complicating the blindingly obvious. OK not the answer you want but it is one that works

If the glasses are a known type, you can predetermine the volume based on the height from your IR sensor. That would require a standard set of glasses being used (ie you couldn't just grab any old glass).

Ie - the shot glass has a 30ml capacity, and 30ml would be selected when the height is detected to be, say, 50mm high.

It's not calculating the volume of the vessel though.

Another "out there" method could be to fill the glass to overflowing with water, draw a vacuum with the glass in the vacuum chamber, and measure how much air is sucked out, then empty the glass and draw the vacuum again, which should give you the difference in volume.

On second thought, skip the vacuum. Use a sensor to detect when the glass overflows, work out how much water flowed before the glass overflowed (time and pressure/flow rate), tip it out and dispense the drink.

I don't know if this helps but I hope it did, in some way.


I assume the glasses would all be symmetrical about the vertical axis, the right way up and of similar wall thickness.

You could use a contact sensors to locate the inside or outside edge of the glass - half a dozen sensors arranged in pairs at different heights would give you enough information about the profile to estimate the volume. Internal sensing would be more accurate but might introduce hygiene issues.

Adeering: The liquids are being mixed so if I stop it early it wont be the same drink and not taste right. Need to know before the liquid is dispensed in order to ensure the drink can be dispensed

Can you mix proportionally instead of one liquid at a time so no matter how much you dispense, it's the correct ratio.

just a theory here :P what if u have light placed at the bottom of the dispenser lighting upwards through the glass to a sensor above the glass, that way you can use LDR's to calculate the width of the glass, then u could use an IR to read the height of the glass :)

take the two parameters and do width * height to find the volume! :D

take the two parameters and do width * height to find the volume!

Does not work for wine glasses.

Sounds like an incredibly difficult and complex task to be able to dispense a given amount of liquid into a container of unknown capacity, without overflow. Or is the objective to fill a unknown vessel to 100% of it's capacity without prior knowledge of it's total capacity? Which is just as incredibly complex. And what is the FSR doing? Allowing you to know how much liquid mass (by weight) has been dispensed over a given time? If so FSR are pretty non-linear for good mass weighing purposes, strain gauges or load cells are the desired sensor to use for that purpose.

I have seen used in chemical labs such a system used to detect and measure the actual liquid hight as a beaker was being slowly filled. It was called (if I recall correctly) a 'meniscus follower'. If was basically a sensitive optical detector that looked through the side of the glass beaker and could detect the difference looking through a clear glass if there was liquid or just air in the light beam, even if the liquid material was clear (magic I guess, something about reflective index maybe). The optical sensor was on a vertical servo feedback arrangement that would allow the sensor to move up along with the slowly moving height of the filling liquid. However even this application did not allow liquid to continue flowing until overflow, but rather stopped after a fixed amount of liquid had been distilled into the test vessel.

I think you need to rethink the objectives and either come up with some reasonable compromises on it's specifications/capabilities.


Sounds way overdone. As previously mentioned, use glasses of a standard size. Edison's engineers had a similar issue calculating the volume inside a light bulb. Edison just removed the end of the bulb, filled the bulb with water, and then pored the bulb water into a graduated cylinder to read the volume. Get a glass like you are foing to use and manually calibrate the level vs.volume of the glass.

It could be seen as over done but then you possibly need to supply disposable containers all of the same size. A drinks machine were you bring your own cup/glass. Dispensers in super markets perhaps to cut down on packaging.