Single axis ball balancing platform
Slides by Abdullateef Akinola Ayobami
I designed a single-axis ball-balancing platform that uses an ultrasonic sensor to measure the ball's position, an Arduino Uno to process feedback, and a servo motor to adjust the platform's inclination using PID control. The specific control objective is to automatically maintain the ball at a desired setpoint along the platform by continuously detecting its position and correcting any deviation through changes in the platform's inclination. Through this project, I aim to understand the practical application of closed-loop control, PID algorithms, sensor integration, actuator interfacing, and how to achieve system stability, faster response time, and accurate positioning.
SINGLE-AXIS BALL-BALANCING PLATFORM
1. Project Overview
The Single-Axis Ball-Balancing Platform is a control engineering project that demonstrates the application of feedback control in maintaining the position of a moving object. I designed a platform that uses an ultrasonic sensor to monitor the position of a ball and a servo motor to adjust the platform's inclination accordingly.
The system is built around an Arduino Uno, which processes the sensor measurements and executes a PID-based control algorithm. By continuously monitoring the ball's position and adjusting the platform, the system is designed to keep the ball at a predetermined position.
The project combines mechanical design, electronics, embedded programming and control engineering to demonstrate how an automated system can regulate the behaviour of a dynamic physical system.
2. Problem Statement
Maintaining the position of an object on a movable surface presents a control challenge because even small changes in the surface's inclination can cause the object to move away from its intended position.
In a conventional system, maintaining the ball at a particular position would require continuous manual adjustment of the platform. This approach is inefficient and does not provide the precision required for automated control.
This project addresses the problem by introducing a feedback control mechanism that continuously measures the ball's position, calculates its deviation from a desired setpoint and adjusts the platform's inclination to correct the deviation.
3. Aim and Objectives
Aim
To design and implement a single-axis ball-balancing platform using PID-based feedback control to maintain a ball at a desired position.
Objectives
To design a mechanical platform capable of controlled inclination along a single axis.
To integrate an ultrasonic sensor for real-time ball position measurement.
To implement a feedback control algorithm using an Arduino Uno.
To interface a servo motor with the controller to regulate the platform's inclination.
To evaluate the system's stability, response time and positioning accuracy.
4. System Description and Operating Principle
The system operates using a closed-loop feedback control architecture.
The control process begins with a desired ball position, referred to as the setpoint. In this implementation, the setpoint is configured to 7 cm.
The ultrasonic sensor measures the ball's distance from the sensor and sends the measurement information to the Arduino Uno. The Arduino compares the measured distance with the desired setpoint to determine the position error.
The controller processes this error and generates a control signal that determines the required servo motor adjustment.
The servo motor then changes the platform's inclination through a connecting mechanism. This causes the ball to move towards the desired position.
The sensor continuously measures the ball's new position, allowing the controller to make further corrections.
This feedback process continues throughout operation, with the objective of maintaining the ball at the specified setpoint.
5. Hardware Components
The project consists of the following major components:
Arduino Uno: Serves as the central processing unit. It receives sensor measurements, executes the control algorithm and generates commands for the servo motor.
Ultrasonic Sensor: Measures the distance between the sensor and the ball. These measurements provide the feedback required by the controller.
Servo Motor: Acts as the system's actuator. It receives commands from the Arduino and adjusts the platform's inclination.
Balancing Platform: Provides the physical surface on which the ball moves.
Connecting Mechanism: Mechanically connects the servo motor to the platform and transfers the servo's rotational movement into platform inclination.
Power Supply: Provides the electrical power required by the electronic and mechanical components.
6. Mechanical Design
The mechanical design consists of a balancing platform and a connecting mechanism that allows the servo motor to control its inclination.
The connecting mechanism is particularly important because it transfers the movement generated by the servo motor to the platform.
The arrangement is designed to allow controlled movement along a single axis while providing sufficient support for the ball.
The mechanical structure and actuator arrangement work together to provide the physical movement required by the feedback control system.
7. Control System Design
The control system is based on feedback regulation using a PID control structure.
The controller continuously compares the desired ball position with the actual measured position.
The position error is expressed as:
e(t) = r(t) - y(t)
Where:
e(t) = Position error.
r(t) = Desired ball position.
y(t) = Measured ball position.
The PID control equation is:
u(t) = Kp e(t) + Ki ∫e(t)dt + Kd de(t)/dt
The controller consists of three principal components:
Proportional Control (P): Responds to the current position error. A larger error produces a greater proportional correction.
Integral Control (I): Accounts for accumulated error over time and can help eliminate persistent steady-state error.
Derivative Control (D): Responds to the rate of change of the error, helping to anticipate movement and reduce excessive corrections.
The combined control output determines the adjustment required from the servo motor.
In the current software implementation, the integral gain is set to zero, meaning the controller operates effectively as a PD controller.
8. Software Implementation
The control algorithm is implemented in C++ using the Arduino programming environment.
The program begins by configuring the ultrasonic sensor and servo motor pins. The servo is initially positioned at 90 degrees, representing the neutral platform position.
The controller operates with a repeated sampling cycle, allowing it to acquire sensor measurements and calculate the necessary corrections.
To improve measurement consistency, an exponential moving average filter is applied to the ultrasonic sensor readings. This reduces sudden fluctuations that could cause unnecessary servo movements.
The controller then calculates the difference between the filtered measurement and the 7 cm setpoint.
The proportional and derivative terms are used to determine the control output. The output is restricted to a maximum adjustment of five degrees in either direction from the neutral servo position.
The program also includes sensor error handling. Invalid measurements are detected, and after three consecutive invalid readings, the servo returns to its neutral position.
Finally, the program sends the raw sensor measurement, filtered measurement, position error, control output and servo angle to the serial monitor. This makes it possible to observe the controller's behaviour during operation.
9. Performance Evaluation
The system is intended to be evaluated using three major performance criteria.
Stability: Determines whether the system can maintain the ball around the desired position without continuous excessive oscillations.
Response Time: Measures how quickly the system responds to a displacement of the ball and attempts to restore it to the desired position.
Positioning Accuracy: Determines how closely the system can maintain the ball's actual position relative to the desired setpoint.
These criteria provide a basis for assessing the effectiveness of the feedback control algorithm and identifying areas for improvement.
10. Applications
The principles demonstrated in this project have applications in several engineering fields.
Robotics and Automated Systems: Feedback control is used to regulate movement, positioning and balance.
Precision Manufacturing: Automated systems use position feedback to achieve accurate object placement and movement.
Control Systems Education and Research: The platform provides a practical demonstration of PID control, sensor integration and actuator interfacing.
Active Vibration and Motion Control: Similar control principles are applied to systems that require continuous corrections in response to unwanted movement.
11. Learning Outcomes
Through this project, I aim to develop a practical understanding of how mechanical, electronic and software components can be integrated into a functional control system.
The project provides an opportunity to understand closed-loop control, PID algorithms, sensor feedback, actuator interfacing and the behaviour of dynamic systems.
It also demonstrates the relationship between theoretical control concepts and their practical implementation using embedded systems.
12. Conclusion
The Single-Axis Ball-Balancing Platform demonstrates the application of feedback control in regulating the position of a moving object.
By integrating an ultrasonic sensor, Arduino Uno, servo motor and a PID-based control algorithm, I designed a system that measures the ball's position and adjusts the platform's inclination to maintain a desired setpoint.
The project brings together mechanical design, embedded programming, electronics and control engineering. It provides a practical foundation for understanding automated positioning systems and evaluating their performance in terms of stability, response time and positioning accuracy.