David Lammering personal site

Ball-on-Plate Demonstrator

A motorized two-axis plate balances a real ball on a screen. A camera tracks the ball's position, and the ball interacts with arcade-style games for a playful visualization of control theory.

CAD render of the new demonstrator: an aluminum-profile frame carrying a tilting rectangular plate with a ball resting on it, electronics on the shelves below, and a camera on an arm above the plate.
My new design, October 2026. CAD finished, parts ordered.
Now
Bachelor's thesis: Major hardware redesign, since September 2026. Solo, with supervisor guidance
Before
Semester project: Controllers and demos, fall 2025. Team of 6
Context
Automatic Control Lab, D-ITET, ETH Zürich

What I do – Bachelor's Thesis

Thesis scope: the inner loop and the physical system.

I am doing a major redesign of the old system. Key changes include:

  • New screen format: 3:2 instead of 16:18
  • New, improved mechanics:
    • Belt instead of gear for the torque-heavy axis
    • Stronger gear system for the other axis (less wear force on mounting parts)
  • Software adapted and improved for the new format
CAD render from below of the new mechanics: the tilting plate inside an aluminum-profile frame, a motor driving a shaft across it, gears at the right, shock absorbers at the end stops, and a fan and electronics on the lower shelf.
The new mechanics, seen from below.
Side view of the plate tilted to one side, with the belt running along the plate from the motor to the far end. Numbered markers label the belt rollers along the bottom bar and the two belt mounting points on the plate. 1 1 2 2 3 3 4 5 5
1 outer rollers 2 tensioners (position adjustable) 3 snub rollers 4 belt drive 5 belt mounting points The belt drive on the torque-heavy axis.
Close-up of the gear stage: a small pinion on the motor driving a large gear fixed to the plate axis, with shock absorbers on both sides. Numbered markers label the small and the big gear. 1 2
1 small gear 2 big gear The gear stage on the second axis. A bigger gear and extra mounting points significantly reduce the wear forces on its mounting parts.

Key decisions

Mechanics

The old system seemed a little slow to respond. The outer loop controllers became unstable at quite low gains already, because the plate couldn't track the reference angles fast enough. I wanted to fix that, so I ran a few tests to find the issue.

First was a ramp test: I was curious whether IMU and encoder data coincide.

IMU and encoder data deviate significantly: an indicator of gear slip or similar inaccuracies.
IMU and encoder data deviate significantly on the y-axis: an indicator of gear slip or similar inaccuracies, possibly caused by excessive wear forces on parts.

On the x-axis, IMU and encoder coincide, but on the y-axis they do not. The strong deviation, especially at extreme angles, indicates gear slip or bending of mounting parts: the motor thinks it has reached the desired angle, while in reality it has not. We could have used the IMU data as feedback for the inner loop, or combined encoder and IMU data in a Kalman filter, but I wanted to fix the root cause of the problem: the mechanics.

Y-Axis: Belt

The most effective way to reduce torque was to use a belt architecture. My implementation yields an average gear ratio of roughly 30:1, and since the belt pulls the plate far away from the center of rotation, the torque on all parts is significantly reduced.

However, a belt also introduces new challenges:

Dealing with nonlinearity

The distance the belt travels is only approximately linear in the angle of the plate (first-order Taylor approximation of the sine). This brings two issues:

  • Measuring the angle from encoder values has to account for the nonlinearity at higher tilt angles.
  • Belt common-mode movement (e.g. excessive stretching due to an asymmetrical shift in the angle of attack on either side) has to be minimized.
Minimizing common-mode movement

Deriving the optimal placement of the outer rollers analytically turned out to be very difficult, so I used a simulation of the geometry to find the optimum by hand. The structure of the belt channel constrained the horizontal placement of the outer rollers, so there was only one parameter to tweak. The optimized placement yields a common-mode movement of less than 0.4 mm over all possible tilt angles, a significant improvement over the 5 mm of my first, naive placement.

Screenshot of the belt geometry simulation: on the left the plate's circle of rotation with the draggable outer roller and the belt paths to it; on the right a plot of common-mode belt movement over tilt angle, staying within about ±0.4 mm, with the resulting metrics and sliders for the roller position.
Belt geometry simulation: dragging the outer roller (red) and reading off the common-mode movement over all tilt angles (top right). Note that, surprisingly, the optimal roller placement is not on the neutral tangent line.
Considerations of extreme tilt angles for the belt design.
Finished belt design.

X-Axis: Gear

Since the x-axis has much less inertia (shorter side of the screen, and only the inner frame has to move), a gear system is sufficient. However, the old gear mechanism was not optimal either. This is what the IMU vs. encoder test revealed:

Ramp test on the x-axis: the plate angle measured by the motor encoder and by the IMU over 36 seconds. Both follow the setpoint ramp to plus and minus 11 degrees close to each other, but move in steps and lag behind the setpoint.
x-axis ramp test: encoder and IMU stay close to each other, but both lag behind the setpoint.

So the angle is measured correctly, but the plate is too slow to follow. Retuning the inner-loop PID did not help: every attempt to improve the reference tracking made it unstable. My hypothesis is that the root cause is again the mechanics: the gear ratio is too low, so the motor cannot accelerate the plate fast enough. The rebuilt hardware will test this.

I decided to raise the gear ratio by increasing the size of the big gear by roughly 60%. This changed the ratio outside the gearbox from 2:1 to 3.3:1. It also allowed me to mount the outer gear further away from the center of rotation, reducing wear on the screws.

New screen

The old system had a 16:18 screen, which looks nice, but near-square screens are very rare and expensive. I saw an opportunity to use a more common format. 16:9 would sacrifice too much precious space, so I chose 3:2.

This new format is ideal for 1D control games like Flappy Ball, and still allows for 2D games like Racing Track. I then modeled the new panel in CAD to adapt the whole system accordingly.

What's next

CAD is finished, and structural assembly and wiring are under way. Next up is setting up the Raspberry Pi and its GPIO channels. After that: tuning the inner loop, adapting the software and (possibly, as a stretch goal) a new camera system mounted on the plate frame.

Controllers, Games and Demos – Semester Project 2025

Semester project scope: the outer-loop controller and the games.

This was a team project of 6. I only show my own part here: the PID and LQR controllers, live tuning and the 3 games.

Racing Track on an old physical system: the controller keeps the real ball on the track. Random track generation is also demonstrated.
  • PID and LQR for the outer control loop.
  • Live-tuning: Both controllers are modifiable while the games run, so that users can see the effect of each parameter interactively.
  • Three games: a generated racing track, a Flappy Ball PID visualizer, rectangle tracking.

Racing Track

Racing Track is the best example to show students the art of control: it is incredibly difficult to stay on the track and score laps while steering the plate manually. However, as you could see, the automatic controller manages very well! You can see the PID in action in simulation.

An implementation I'm particularly proud of is the random track generation: Racing Track is a class consisting of 4 corner elements placed randomly on the map. After the corner elements are generated, connecting elements made of tanh functions are added.

Random track generation showcased.

Flappy Ball

The most counterintuitive part of PID is integral control. My supervisors had the idea of showcasing it in a 1D control situation, color-marking the area between the actual and the reference trajectory. I implemented this visualization in the Flappy Ball game.

Flappy Ball. The panel breaks the controller output down as the ball moves. The integral bar is shown at 10x normal size for visibility.