Ball and Plate
Doing Balance the Right Way
~ Caleb Paton


About
What is Ball and Plate?
Ball and plate is my senior project that incorporates building a robot to balance a ball on a surface without "dropping the ball."
Background Information
This project has been achieved by others and usually have a predetermined path that the ball will follow, like for example a figure 8 or rectangle, and may use a joystick to interact with their system.
My Problem
To differentiate my project from others I will implement the use of having the user draw an input path that they would like to see the ball follow.
My Solution
Adding a display which shows the user the path that they draw will make mine stand out from the rest of the projects that are similar. Like using a drawing app on your smartphone and drawing with your finger, you can then look at the screen and see what you drew.
The Goal
Project done by Youtuber "rracnala"
A project that is similar to what I am trying to achieve and hope to accomplish.
Importance
Some background information
Ball and plate incorporates and shows the importance of a control system. There is a micro-controller that gives commands to the motors and picks up the location of the ball from a sensor. This project demonstrates the use of Math, from basic arithmetic to algebra to calculus, Physics, electrical and electronic theories, micro-computer technologies, sensors and instrumentation's, and control systems.

Control System
A control system may be a device which manages or regulates the behavior of other devices to achieve desired results.
Two main types of controls: open loop and closed loop. Above is closed loop, also referred to as having feedback.

PID Controller
Above is an example of a block diagram of a PID controller
​
PID controllers are very common among systems looking for accurate results for many different process variables.​
​
Error seen above is the actual location, for example, subtracted from the desired location. This could be a set point of temperature or numerous other variables.
The error then is multiplied by gains and added together to correct for the error that was present.
P is proportional gain that is a tuned factor that results in a better output.
I is integral gain that tells the cumulative error over time.
D is derivative gain that tells the rate of change at which the error is occurring.
Diving Into My System
System diagram below
​How It Works
Upon turning on the system the user will be prompted with instructions on the screen.
After being prompted the user can then draw a path they wish the ball to follow and press start to move on to the next step or press reset to reset the screen and draw a new path.
Once a desired path is drawn and the user presses start, the system then waits for the ball to be placed upon the display.
The rest here is automatic. The system will display the path the ball followed in a different color as the path that was drawn.
Following The Diagram
The display is what projects an image and text to the user, which comes from the code that I've written to the arduino.
The arduino then powers the display driver which relays that info and powers the TFT Display. The user sees the prompt and follows instructions.
Drawing a path upon the touchscreen, which is the sensor here, is picked up by the display controller and that info is relayed back to the arduino.
Once the user has followed the instructions and places the ball upon the screen, the sensor picks up the location of the ball. The arduino then controls the two servos about the x and y axis to move the ball to follow the path that was drawn.

My System Continued..
The controller used in my system is a PD controller
Control block diagram below created with Simulink
About The Diagram
The diagram below represents my system and the output based on one of the servo motors. In this case (diagram below) this is the ​model for the X-Plane servo. The servo that moves the "plate" up or down in the x direction, which is arbitrarily assigned, but based on logical convention.
Starting with f(u) block and on to x_Ks triangle, this section models the behavior of the system due to physics and characteristics of the sensor and servo motor.
​
Coming down and back the other way we have two blocks (looking like staircase blocks) that models how the microcontroller handles this information.
​
The rest is all to do with the code written to the microcontroller. We can see labeled below the derivative part (bottom row) as well as the proportional part (top row).
​
X_Ref_count happens to be the coordinates stored in memory from when the user drew the path. Which will be compared to the X_count (current position of ball) and the error signal is determined by use of the circular block that the X_Ref_count goes into.

Components
Components used in my system and 3D parts below
3D Parts

