Automated Tilt-Maze Mechatronic Prototype


Timeline: May 2025
Contributors: Claire Mayder, Mila Filippova
Core Technologies: Arduino Elegoo 3R, SG90 Micro-Servos, C++ (in Arduino IDE), Foam Poster Board, Breadboard, and a whole lot of hot glue.

1. Project Overview

An electromechanical marble maze that utilizes dual-axis servo motors to dynamically tilt a physical playing surface, guiding a marble along a controlled path.

2. Mechanical Design & Material Analysis

Before building, we analyzed structural materials to optimize the balance between structural rigidity and servo load limitations.

We chose to make our maze base 7 in x 7 in, with a wall height of 1 in.

We also had to consider the thickness of the 2 materials we were considering: Cardboard or Foam Poster Board.

Cardboard has a thickness of 0.1 in
Foam Poster Board has a thickness of 0.185 in

Cardboard
π‚π¨π¦π©π¨π§πžπ§π­πƒπ’π¦πžπ§π¬π’π¨π§π¬Maze Base4.9 in3Maze External Walls(x4, Ring)32.4 in3Maze External Walls (x4, Base)3.08 in3Maze Internal Walls (x35 walls)3.15 in3Totals43.53 in3\color{white}{ \begin{array}{l|l} \textbf{Component} & \textbf{Dimensions} \\ \hline \text{Maze Base} & 4.9\text{ in}^3 \\ \hline \text{Maze External Walls(x4, Ring)} & 32.4\text{ in}^3 \\ \hline \text{Maze External Walls (x4, Base)} & 3.08\text{ in}^3 \\ \hline \text{Maze Internal Walls (x35 walls)} & 3.15\text{ in}^3 \\ \hline \text{Totals} & 43.53\text{ in}^3 \end{array} }
Density of Cardboard=0.0246 lb in3Total Weight=43.53 in3Γ—0.0246 lb in3Weight=1.073 lb\color{white}{ \begin{aligned} \text{Density of Cardboard} = 0.0246 \frac{\text{ lb}}{\text{ in}^3} \\ \text{Total Weight} = 43.53\text{ in}^3 \times 0.0246 \frac{\text{ lb}}{\text{ in}^3} \\ \text{Weight} = 1.073\text{ lb} \end{aligned} }
Foam Poster Board
π‚π¨π¦π©π¨π§πžπ§π­πƒπ’π¦πžπ§π¬π’π¨π§π¬Maze Base9.065 in3Maze External Walls(x4, Ring)59.94 in3Maze External Walls (x4, Base)6.1283 in3Maze Internal Walls (x35 walls)5.277 in3Totals80.4103 in3\color{white}{ \begin{array}{l|l} \textbf{Component} & \textbf{Dimensions} \\ \hline \text{Maze Base} & 9.065\text{ in}^3 \\ \hline \text{Maze External Walls(x4, Ring)} & 59.94\text{ in}^3 \\ \hline \text{Maze External Walls (x4, Base)} & 6.1283\text{ in}^3 \\ \hline \text{Maze Internal Walls (x35 walls)} & 5.277\text{ in}^3 \\ \hline \text{Totals} & 80.4103\text{ in}^3 \end{array} }
Density of Foam Poster Board=0.00282 lb in3Total Weight=43.53 in3Γ—0.00282 lb in3Weight=0.123 lb\color{white}{ \begin{aligned} \text{Density of Foam Poster Board} = 0.00282 \frac{\text{ lb}}{\text{ in}^3} \\ \text{Total Weight} = 43.53\text{ in}^3 \times 0.00282 \frac{\text{ lb}}{\text{ in}^3} \\ \text{Weight} = 0.123\text{ lb} \end{aligned} }

But looks can be deceiving; the foam poster board looks way too big, right?
Wrong. Our goal has nothing to do with volume; it has everything to do with mass.

From this, we can see that the foam poster board is the no-brainer. It is what we ended up choosing for cost reasons as well.

Ο„=rFsin⁑(ΞΈ)\color{white}{ \tau = r F \sin(\theta) }


Since the outer ring of our design is 8 in long, our axle will need to be a little longer so the maze can be supported on each side. We assumed 10 in for safety

F=force of gravity=mβ‹…g=0.123 lbΓ—386.22 in/s2=47.50506 lbβ‹…in s2\color{white}{F = \text{force of gravity} = m\cdot g = 0.123\text{ lb} \times 386.22\text{ in/s}^2 = 47.50506 \frac{\text{ lb}\cdot \text{in}}{\text{ s}^2} }
Ο„=rβ‹…Fβ‹…sin⁑(ΞΈ)=5 inΓ—47.50506 lbβ‹…in s2Γ—sin⁑(90∘)=237.5253 lbβ‹…in2 s2\color{white}{ \tau = r \cdot F \cdot \sin(\theta) = 5\text{ in} \times 47.50506\frac{\text{ lb}\cdot \text{in}}{\text{ s}^2}\times \sin(90^\circ) = 237.5253\frac{\text{ lb}\cdot \text{in}^2}{\text{ s}^2} }

We know from online specifications that the SG90 motor has a non-stall range of up to:

837.89 lbβ‹…in2 s2\color{white}{837.89\frac{\text{ lb}\cdot\text{in}^2}{\text{ s}^2}}

Which means we could have made this bigger and heavier (I will come back to this later!).

3. Electrical Engineering & Power Management

The Problem: SG90 micro-servos have a stall current that can spike up to 2.2A under friction or heavy centering loads. Standard laptop USB ports max out at 0.5A, which can cause immediate voltage drops and system brownouts if servos draw power directly from the board’s logic line.

The Solution: We isolated the power architecture

4. Code

Great, now we’ve fixed our design. But the servos still need commands from the Arduino, and the Arduino needs commands from our computer. Below is Mila’s Code in C++, made in Arduino IDE.

#include <Servo.h>
Servo servoX; // D9 – X-axis
Servo servoY; // D10 – Y-axis
const int centerX = 90;
const int centerY = 50;
int x = centerX;
int y = centerY;
const int smallRot = -40;
const int bigRot = -80;
int stepDelay = 20; // Delay between degree steps (ms)
// Smooth motion function for low angular velocity
void smoothMove(Servo& servo, int& currentAngle, int targetAngle, int customDelay = stepDelay) {
int step = (targetAngle > currentAngle) ? 1 : -1;
for (int pos = currentAngle; pos != targetAngle; pos += step) {
servo.write(pos);
delay(customDelay);
}
servo.write(targetAngle); // Ensure final position
currentAngle = targetAngle;
}
void resetPos(){
smoothMove(servoX, x, centerX, 40);
smoothMove(servoY, y, centerY, 40);
}
void setup() {
servoX.attach(9); //plugged into the arduino D9 pin
servoY.attach(10); // plugged into the arduino D10 pin
resetPos();
delay(2000);
smoothMove(servoY, y, y + smallRot);
delay(250);
smoothMove(servoX, x, x + bigRot);
smoothMove(servoY, y, y - (bigRot * 2));
delay(250);
smoothMove(servoY, y, y + bigRot + smallRot);
delay(250);
resetPos();
smoothMove(servoX, x, x - smallRot);
delay(500);
smoothMove(servoY, y, y - bigRot - smallRot);
delay(1000);
smoothMove(servoY, y, y + (bigRot * 2));
resetPos();
smoothMove(servoY, y, y - bigRot - smallRot);
delay(250);
smoothMove(servoX, x, x - smallRot); //RIGHT DIRECTION?
delay(500);
smoothMove(servoX, x, x + bigRot); //RIGHT DIRECTION?
delay(500);
smoothMove(servoY, y, y + (bigRot * 2));
smoothMove(servoX, x, x + bigRot);
delay(250);
smoothMove(servoY, y, y - bigRot);
delay(250);
smoothMove(servoX, x, x - bigRot);
smoothMove(servoY, y, y - (bigRot * 2));
resetPos();
while (true);
}

5. Working Videos!!!

Plans for the future?


Current ideas for making the maze modular and 3D print it are on the table, and am working on the design as of now.

Here is an early CAD model of the design:

It will likely be made of PLA, as that is what the 3D printers on campus have an abundance of.

PLA has a density of: 0.045 lb in3\color{white} { \text{PLA has a density of: } 0.045\frac{\text{ lb}}{\text{ in}^3} }

The largest 3D printer I have access to prints a max 12 in x 12 in x 12 in, and due to clearances of the inner element of the max tilting, the maze base would have to be 10 in x 10 in or smaller.

This makes the external walls 10 in x (1 in + chosen thickness) x 4 walls
The external maze walls as 8 in x (1 in + chosen thickness) x 4 walls
Then the internal walls that will be modular as (1 in – chosen thickness) x 1 in x 35 walls

It would also make r = 5 in


Reverse-engineering this and maxing out the range on the SG90 Servo Motors:

Let’s let t = the thickness of our design\color{white} {\text{Let’s let } t \text{ = the thickness of our design} }
V=(40+32+35)+(40+32βˆ’35)t\color{white} {V = (40 + 32 + 35) + (40 + 32 – 35)t }
V=107+37t\color{white} { V = 107 + 37t}
F=0.045Γ—(107+37t)Γ—386.22=17.38Γ—(107+37t)\color{white} { F = 0.045 \times (107 + 37t) \times 386.22 = 17.38 \times (107 + 37t) }
Ο„=FΓ—r=FΓ—5in=86.90Γ—(107+37t)≀837.89\color{white} { \tau = F \times r = F \times 5 in = 86.90 \times (107 + 37t) \le 837.89 }
107+37t≀9.642\color{white} { 107 + 37t \le 9.642 }
tβ‰€βˆ’2.632\color{white} { t \le -2.632 }

That isn’t going to work for us; therefore, the conversation about adding gear ratios to bridge this gap came up!
We can do our calculations again, and find:

t≀9.64Nβˆ’10737\color{white} { t \le \frac{9.64N-107}{37} }

Where N = our gear ratio.
Since I don’t need the walls to be more than 0.2 in in thickness, we can find our gear ratio as:

0.2≀9.64Nβˆ’10737\color{white} { 0.2 \le \frac{9.64N-107}{37} }
7.4≀9.64Nβˆ’107\color{white} { 7.4\le 9.64N-107 }
11.87≀N\color{white} { 11.87 \le N }


12:1 gear ratio would work, but to play it safe, a gear ratio more like 20:1 would be nice. But a 20:1 gear ratio isn’t easy to come by, so I will need to 3D print those gears as well, and plan to use composite gears to be able to miniaturize the design. This will also help account for any extra weight and design flaws.