Standard ping-pong balls have 40mm diameter. Acrylic tubes come in all sizes, but there is a standard 45mm OD tube, with 2mm walls, which leaves 41mm ID (Inside Diameter). Just enough for a ball to travel inside. So we took the challenge of floating the ball at constant height, using a 12V computer fan and an adjustable power supply.
Easier said than done. Even with a fine adjustable power supply, the ball either stays down, or shoots all the way up the tube.
So we replaced the human eye with an ultrasonic distance sensor, and the human hand with a Raspberry Pi, added by an Industrial IO Card.
For the high level interface we used CODESYS, with the available drivers for the MegaIO-Industrial Card. To show the difference, we implemented both a manual and automated control in the CODESYS interface.
Here is the gizmo setup, including the CODESYS interface:
The long form of the experiment is here:
Or, if you prefer the abbreviated version:
You can control the initial overshot, the response time and the overall precision by playing with the PID loop parameters.
Drop of a line if you want the source code for the CODESYS PID, or the full schematic. In this implementation we used an external controller to convert the distance sensor output to 4-20mA, but we have the code to read it directly with the MegaIO-Industrial board.