Saturday, March 16, 2019

3D Cube Rolling Ball Maze on Carvey

A while ago I made a rolling ball maze on Carvey, a soft-CNC machine at my local maker space. For a bit of extra fun, I've extended this now into the third dimension and created a cube-based rolling ball maze. The maze has six sides that are all inter-connected and makes for a bit more of a challenging experience. The cube maze is pretty much the same concept as a bunch of cheap plastic cube mazes you can but on Amazon etc. but a little bit bigger. To generate the actual maze itself, I developed a random maze generator in python using a recursive backtracking algorithm. I extended the approach to build the maze across the surface of a cube by placing maze nodes in a regular grid across each of the six faces of a cube and placing a number of random edges between adjacent face nodes to create paths that traverse the whole grid surface. The scripts I made output the generated maze as an image showing an "unfolded" view of the cube, and also spit out SVG files for carving.


The maze is carved as six separate sections from 9mm MDF and six 2mm thick clear acrylic panels (to stop the ball falling out). The panels are then glued and screwed together by hand. I had a look into a couple of different options for the track size of the maze. I have a few 2mm steel ball-bearing balls, but found that these don't actually work well: they are so small that roll too quickly in the maze and it becomes very frustrating to move them around by tilting the maze. I ended up using a silver coloured decorative ball for cake decorating: turned out to have the right size (approx. 4mm diameter) and rolls quite nicely.


Putting it all together was a little bit finicky: seeing as Carvey can only cut in 2.5 dimensions (three axis carving) I had to design the pieces to be of varying sizes such that they all interlock together and allow for the tracks to join up. The little bits of wood at the bottom were glued in as a way to chock the two smallest panels up against the clear panelling so the whole thing stays together.


Design files for the maze I ended up using (as SVG files that can be used for Carvey/Easel) can be downloaded here:


Python scripts for generating new random mazes and associated design files available via Github: