Servo-Actuated Ball Balancing Platform

hero-image

Rex Worley

Project Timeline

Aug 2025 - Dec-2025

OVERVIEW

This project demonstrates the design and implementation of a real-time closed-loop control system that autonomously balances a steel ball on a two-axis tilting platform. The system combines mechanical design, sensor integration, and control theory to create a responsive mechatronic system capable of dynamic stabilization. Technical Approach: The platform uses a 7-inch resistive touchscreen overlay as a continuous position sensor, providing millimeter-level resolution of the ball's X-Y coordinates. Two MG996R servo motors actuate the platform via custom linkage arms, enabling independent control of both horizontal axes. A Raspberry Pi 4 serves as the central controller, processing touchscreen data via a dedicated STP-RAP45U2U-S USB controller that handles analog-to-digital conversion and coordinate filtering. Control Implementation: The control architecture employs dual PID controllers—one per axis—operating at 100 Hz to minimize positional error and achieve stable balancing. The system was modeled as a two-degree-of-freedom dynamic surface, with the ball treated as a point mass and the servos as first-order actuators. Initial controller tuning was performed in MATLAB Simulink, and then refined through iterative physical testing to account for real-world dynamics such as friction and servo response characteristics. Software & Hardware Integration: The control loop was implemented in Python using the pigpio library for precise PWM servo control and the evdev library for touchscreen input processing. The software continuously reads the ball position, computes the normalized error relative to the platform center, updates the PID controllers with appropriate integral windup protection, and converts control outputs into servo pulse widths between 1000 and 2000 microseconds. The platform autonomously returns to neutral position when no touch input is detected, demonstrating robust disturbance rejection.

HighlightS

Technical Achievements:

  • Designed and implemented a real-time closed-loop control system operating at 100 Hz with dual-axis PID controllers
  • Integrated a resistive touchscreen as a continuous position sensor, achieving millimeter-level resolution
  • Developed custom Python control software with interrupt-driven input processing and precise PWM servo control
  • Successfully modeled a nonlinear dynamic system and validated it through MATLAB Simulink simulation before physical implementation

System Integration:

  • Built a complete mechatronic system combining mechanical design (custom 3D-printed platform and linkages), sensor integration (touchscreen + USB controller), and embedded control (Raspberry Pi)
  • Implemented robust disturbance rejection and automatic neutral positioning
  • Achieved stable autonomous balancing with minimal steady-state error

Problem-Solving:

  • Iteratively tuned PID parameters from simulation to real hardware, accounting for friction, servo dynamics, and system nonlinearities
  • Designed a custom interface between an analog touchscreen and a digital controller using dedicated ADC hardware
  • Created axis-independent control architecture to handle geometric asymmetries (172mm vs 129.5mm platform dimensions)

SKILLS

Control theory applicationEmbedded systems programmingSensor fusionMechanical CADSystem modelingHardware-software co-designMicrocontrollerPID Tuning

ADDITIONAL CONTENTS

Home
Questions?
hero-image

Rex Worley

I am a Mechatronics Engineering student at Texas A&M University with hands-on experience in industrial automation and embedded systems. I've engineered PLC control systems, designed IoT dashboards with real-time sensor integration, and programmed autonomous robotic systems. I'm passionate about applying robotics and control systems to solve real-world engineering challenges.

| lowinertia |
Engineering Portfolio in 15 minutes
Create Your Portfolio