Close

SOFTWARE & PROGRAMMING

A project log for MatAir - A Robotic Spherical Chessboard

A spherical chessboard where a robotic arm plays moves from an online game.

nasserNasser 05/10/2025 at 17:070 Comments

With the mechanical and electronic parts assembled, it was time to tackle the brain of the system—the programming. This is where everything comes together: motors, servos, sensors, and user interactions.

We started by defining the main behaviors the system needed to perform:

The whole program was written for an ESP32 board using the Arduino framework. Because we had networking code running in the background, it was essential that all motion routines were fully non-blocking.

We structured the code around multiple state machines to control:

We started by writing a simple program to test the controller. Using the two-button interface, we verified that we could successfully send signals to the actuators and confirm that everything was functioning correctly—both electrically and mechanically.

Once that was confirmed, we developed a second program that allowed us to control all actuators via serial commands from the computer. This program was crucial: it helped us identify and fine-tune the exact positions and angles each motor needed to reach every square on the chessboard and each slot in the capture zone.

Using the Nextion Editor, we built the graphical interface displayed on the touchscreen. The interface allowed us to:

Here are some screenshots of the custom interfaces we made: 

By the end of development, the full codebase for the motion control system totaled over 2000 lines of code. It includes:

Discussions