Hand tools and fabrication machines
I got inspired from Ahmed Azouz project, because it is a great mix of mechanical engineering and programming. But I didn't want to just copy his work, I wanted to use a new functional approach.Approach
My approach was to write a solving algorithm to find a way trough each labyrinth and calculate the parameter for the 2 servo motors (X and Y-axis) to control the X/Y platforms in terms of moving the marble through the labyrinth.Setup
I choose a size of 12cmx12cm (each square 1cmx1cm) for the maze. Any other size would work as well and can be adjusted in the header of the code. Anyway 12x12 is big enough to show the principle of the algorithm and it's practicable, because you've to glue together each maze.Construction of the maze
I used a print template with 1cmx1cm rectangles. Then I draw a maze on it. There should be at least one solution/way from the start point (S) to the end point (E).
The next step is to glue cardboard to the hatched area (wall). The height should be between 0.5-1cm. Make sure the ball is able to pass all the way through, esp. the edges.
The main building material is cardboard. Over the time I made great experience with these 12mm 3 layer cardboard. It's easy to handle and robust. For this project I used an OLED I2C 128x64, because I never used one before and I was excited to use of of them. The use of the OLED requested some libraries. I choose the ones from Adafruit. They are easy to handle. Nevertheless the huge size requested a MEGA board. If you want to use a standard LCD w/o any animations an Arduino UNO will be fine. As an input device I used a standard 4x4 keypad which will also take the part to control the marble in the manual mode.
The next step was to build the movable platforms for x- and y-dimension. The standard stepper motor SG90 is totally fine for that use case. The 12mm cardboard keeps them in a stable position. Hot glue was used as well. The rotation axis of the motor should be exactly in the middle of the side wall resp. platform.
Be sure to make the holes for the motor exactly in the middle of the sidewall at least on the x-axis.
The Y-axis platform was mounted on the left side to the SG-90 pinion. On the right side I made a hole with appr. 6-7mm diameter to ensure a M5 screw fits through and can turn easily, but not too easily. Between the walls you should use some washers. The final step is the assembly of the X-axis platform. Now both platforms can be turn independently from each other.
The maze can be placed into the x-axis platform.
Some few data to the dimensions.
dimension in (cm) X Y Z
Base plate: 30 26 -
Side walls (on the bottom): - 18 20
Side walls (on the top): - 8 20
Y-axis-platform (outer d.): 15 16.5 6
X-axis-platform (outer d.): 13 13 4
The cardboard labyrinth is binary coded with zeros and ones (0 - wall; 1 - space). You can encode any labyrinth. For calculating the path from the staring point (S) to the end position (E) I used the left-hand-algorithm. This algorithm may not find the shortest way. In the next software version I will consider different algorithms. After the way is calculated the motor control parameters has to be determined. To keep it easy the angle to tilt each platform was chosen was defined with 10 degree in each direction. The other parameter was the time to keep the platform on -10/0/+10 degree. This time is depend on the previous movement of the marble. If the marble was already going in one specific direction the time for the next step in the same direction was shorter, because the marble was already accelerated to a specific speed.Perspective
The labyrinth should be recorded automatically with the Pixy2 camera. So far the labyrinth is described with binary code (0/1) in a matrix. Afterwards the path is calculated (is already implemented now) and the ball is controlled. A new approach would be to monitor the speed and position of the ball with the camera and to adjust the motor parameters if necessary like a simple version of machine learning. One target could be the fastest possible speed respectively the shortest time from start to end.