For my project i need to measure time required for a ball(small ball made of metal) to pass two points in a water cylinder. Please see the image below.
Is it possible to use IR sensor in those points (A & B point) to determine when the ball passes those points and calculate the time (in seconds). As the cylinder is made of plastic and there is water present will it be a problem for the sensor ? or there is any other way to do so.
In theory your thinking is right. But in practice the light of the IR transmitter may be bend around in an un-focused way due to the tube and liquid and generate a blurry response on the IR detector (not a sharp rise or cut-off). Finding the exact time of passage may be tricky if the response is flat.
That said, I do not know how well IR is transmitted through water and the plastic of the tube. Probably not a problem with these kind of dimensions though. Just a matter of rushing more current through the IR led.