Raspberry Pi PID Loop
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. Let’s see if a Raspberry Pi PID Controller can do the job.
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 setup, including the CODESYS interface:
or, in abbreviated version, here: