Tabletop Kinetic Sand Rebuild

February 11, 2023 3 min read

I spent three days or so recreating the original sand robot from scratch. I have access to a much larger 3D printer now, so I'm able to fully print everything in one piece, except the acrylic that the sand rests on.

Originally, the robot used a 2-DoF SCARA arm to maneuver the ball around, however I didn't like how much vertical space was used up by this mechanism.


The robot uses a central gear with 238 teeth to drive the rotation angle. It's driven with a stepper motor off to the side with a 500mm timing belt. They're spaced appropriately to keep adequate tension.

Side view

The linear axis rotates off of the central gear and is a basic rack and pinion type drive. The stepper motor in the center goes all the way through the central gear and has the pinion gear attached to the top.

Rack is kept in place w/ the two yellow pieces.


I was honestly really surprised at how well it was turning out so far!

While I was waiting for the main housing to finish printing, the remaining components came in the mail.

Everything came!


Since the robot has no "stop points," I couldn't use typical endstop sensors. I decided to use magnetic sensors mounted on the base, with magnets embedded in the printed pieces to determine the home position.

There's also a SD card to store pattern files, a pair of TMC2209s to drive the steppers, and a TSL2561 breakout board to sense ambient light.

And of course,  I'm using my favorite microcontroller to power this thing, the humble dual-core ESP32!

I ordered a large kit of different JST connectors so I would be able to easily connect everything up to the circuit board, which was also currently on the way from JLCPCB. It's a pretty bare-bones design, and I just used one of the spare boards that I had left from the Coffee Table project.

Kinetic Sand Coffee Table - Aiden Vigue
A 3D-printed SCARA robotic arm drives a magnet under a bed of sand for all eternity. It’s surprisingly relaxing to watch!

Even though I've used the same Trinamic drivers in other projects before, I ended up frying SIX of them simply because I forgot to plug in the motors... They're all shown on the top side of the robot here :p


I hate floats.

I was lucky enough to have most of the firmware written already from the coffee table project, however I had to design and implement a new abstraction layer for this robot's new mechanism design.

I'll skip the boring parts, but essentially, I needed to convert the Cartesian coordinates sent by the higher level classes into polar coordiates, and then use a series of conversions to find the amount of steps needed to move the gear. For the rho (linear) axis, it was a bit weirder. The movement of the rotary axis actually affected the position of the rho arm, so I had to compensate for this in my calculations, and compensate for it again when the robot recalculates it's Cartesian position based on the current step counters around 20-30 times a second.

The motion abstraction code is in the RobotSandTableRotary.cpp file in the repository.


It works!!