Use FREE-SHIPPING discount code for all US orders over $15



Raspberry Pi PID Loop: Float a Ball at Constant Height in a Tube

Posted by Mihai Beffa on

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.

We replaced the human eye with an ultrasonic distance sensor, and the human hand with a Raspberry Pi, added by an Industrial Automation Card. (this experiment is using the first version of the Industrial Automation Card)

Let’s see if a Raspberry Pi PID Controller can do the job.

Raspberry Pi PID Controller

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.

Raspberry Pi PID Controller

Here is the setup, including the CODESYS interface:

Raspberry Pi PID Controller

Watch the the experiment here:

 

 

or, in abbreviated version, here:

 

0 comments

Leave a comment

Please note, comments must be approved before they are published