An optical sensor for measuring the volume of an object, the object having a top and a side. The optical sensor comprises a source of light and a light sensor adapted to measure the amount of light reflected off the side and off the top of the object, wherein the measured amount of the light reflected off the side and the top of the object correlates to a height and a diameter of the object. At least one optical device is adapted to direct light reflected off the side of the object to the light sensor, and at least one optical device is adapted to direct light reflected off the top of the object to the light sensor.