Project #24 Mazing 2

I mentioned this briefly before but I tidied it up a lot in time for the maker faire and added a few features to it.

It's a CNC controlled marble in a maze, the X and the Y are belt driven rather than the more common tilt mechanism. The intent was to persuade people to type in a series of simple programming type commands to drive the ball around the maze from the start point to the end point. I'm pretty sure people didn't see it as programming which is probably a good thing as they were too busy having fun with it. I housed the electronics on top of the board so people could see the details, put in a compass and a scale and gaffa taped a hinge so that the whole thing could flip up and people could see the underneath. (svg here)
24 Projects/ 28 weeks

In essence it's a very simple XY control, but to add some programming aspect to it I set up the arduino to understand a very basic language sent over the serial port. 'N10,E10' would move the ball 10 units north, then 10 units east. I went with 10 units for 1 square because then you could also do movements smaller than 1 square. The distance requested was simply scaled by a factor for the number of steps required and then the code loops until the IO lines have been toggled the appropriate number of times.

For a project on such a short time scale you have to use what's at hand. The XY frame is from a 3020 laser cutter spares I had lying around after the laser cutter fire. The stepper motor drivers are big beefy Keling 4030s I had left over from my failed CNC milling machine and surely everyone must have an arduino or two kicking around by now. Magnets from the gauss gun kits and ball bearings from Donkey Kong. In fact the coding took significantly longer than the mechanical design and assembly.

Version 1 of the code featured a very simple parser of the incoming serial string, it only recognised N,S,E,W and only in capitals. After the first day of the maker faire I vowed to make some serious changes to the way it worked and an extra hour of coding on the Sunday morning made a world of difference. The final version of the code accepts upper or lower case, NE,SE,NW,SW for diagonal movements (although NE10, moves north 10 and east 10 which imo is simpler than calculating the hypotenuse and having to type NE14), and some limit checks which count the number of steps made in any direction and stop you from running it into walls. These step counts are also used to return the ball to the start at the end of every run meaning that you have to type a complete string of instructions to achieve the goal.

Even though it's nothing special I thought I'd share the source code too.
I figure this is the optimal route through the maze.

Popular posts from this blog

Wiring the Ruida Controller

Low Pressure Air Reservoir for improved cutting.

Leetro to Ruida Settings