I placed the sonic distance sensor on the top of the tube to get the distance to the ball. If the ball is less than an inch, an LED turns on.
Check out the video: