Building a self balancing table

March 27, 2024 (1mo ago)

This article is still a work-in-progress, and you probably shouldn't be reading it yet. But well, if you found this, probably I messed up some setting somewhere and google picked this up - or maybe you just threw a /blog on the URL just for funsies. Or maybe I just sent this to you so you could check it out. Anyway, have fun. Just please don't break anything.


Introduction

Detection

First of all, we needed to find a way to properly detect the ball position, as we can't really control something that we have no information about. Usually projects used a touchscreen or something that could determine the ball position precisely directly, but we didn't have the budget needed for that, so I suggested using a camera, hanging above the table itself, that could detect the ball by analyzing color data.

We knew that colors wouldn't be an issue, as the ball we were using was a bright orange, which gave us more than enough contrast against the backdrop to work with.

Tooling

k×c=kπkd+2f(z)zk \times c = \frac{k \cdot \pi}{k_d} + 2\sqrt{f(z)} \partial z