top of page

Ball-Ballancing Platform

Abstract

The idea is to build a platform that has two degrees of freedom (meaning independent rotation around x and y axis) that can balance a metal when it is given a velocity by an external force. To achieve this goal, we implemented a PID controller, and the x and y coordinates of the ball is retrieved in real time through resistive touch screen panel.

Introduction

The components used in this project include:

  • Arduino Uno

  • 1 inch metal ball

  • Servo Motors * 3

  • 5 – wire resistive touch screen panel

  • Wood sticks

Design Process

First of all, to make the platform able to rotate on x and y axis, the easiest way is to use two servos that are connected together to manipulate the platform, as shown below. However, the platform we use is very heavy, and regular inexpensive servo motors won’t be able to turn without breaking. Therefore, we resort to our second choice, which is hanging the platform from a wooden structure with one corner fixed and three others controlled by servo motors.

This brings a lot of trouble. The biggest problem with this mechanism is that the platform will not be able to turn very sharply to a large angle, because then it would cause a big distortion in the strings, and there is also not enough room below it. The second problem is that the angles for the three servo motors are related instead of independent. We will describe the solutions to these problems later.

For the control part, the PID controller is the most popular and common choice. It consists of three parts: Proportional, Integral, and Derivative. Let 𝑒(𝑡) be the error between the current position and target position of the ball at time t. Then the output of the PID controller is

where 𝑘p, 𝑘i, 𝑘d are the parameters that need to be tuned by the user. Each part serves a different purpose, and together they can effectively reduce the error as time goes on. Tuning the parameters can be challenging, and it usually requires many times of trial and error.

The 5-wire resistive touch screen panel works elegantly. 4 out of the 5 wires go to corners of the touch panel, and the one left is for ADC analog reading. When we want to read its x and y coordinate from the panel, we can simply give 5 V on one side of x axis and 0 V on the other side of it. The same works with y axis.

There is an interesting hardware defect with the resistive touch screen panel that we ran into during the debugging stage. We noticed that the x and y coordinates of the ball “jump” randomly every once in a while, so we recorded the data and plotted it on MATLAB, and it looked like the picture below.

 

 

 

The data on the diagonal is purely error because we have been rolling the ball in circle the whole time. To get rid of it, we program it in such a way that it ignores any x-y coordinate that suddenly moves away greatly from its last position and appears on the diagonal. This worked really well and eliminated error completely.

After this hardware bug was found, the only difficult part left was to figure out how to turn the three servo motors so that each string that is attached to it will take 1⁄4 of the total weight and turn the panel to the angle we want. It turns out that servo 1 only needs to know the x axis angle, and servo 2 only needs to know the y axis angle, but servo 3 needs to know both. In fact, the distance travelled by the string attached to servo 3 is the sum of that of servo 1 and 2. From out measurement, the touch screen panel has a length of 32.36 inches, and a width of 24.38 inches; the arm of the servo has a length of 1.5 inches. Let the angle on x axis and y axis be angleX and angleY, respectively. Then their angles can be calculated using the functions in the appendix.

Conclusion

Overall this project was successful, and we have learned a lot from it. We now know how to implement and tune a PID controller, which is really useful, and we also learned how to use 5-wire resistive touch panel. Mostly importantly, we further enhanced our skill of self-learning. With this skill, we will be able to figure out anything we are interested in and start working with it. There is a great pleasure in that.

bottom of page