The Marble Maze Runner

Introduction: The Marble Maze Runner

This Instructable will try and help you learn how to make your own Marble tilt Maze

Step 1: The Materials

  • Arduino Uno
  • Wires x 8 (diffirent colors, see building.)
  • Bluetooth Serial Module
  • Servo Motor
  • Servo Motor Horns x 2 (You can 3D print these)
  • Bread Board
  • Screws and nuts (To hold the Servo Motor in place)
  • Hot glue Gun* (*Only if you are going to make a prototype first, or if you want to make the maze out of cardboard first)
  • Something light to make the whole thing out of (Cardboard can work, but it might break easily so you can use it as a prototype. We used aluminum for our final project, and it is cheap and light weight, perfect for the motors)

Safe places you can buy some of these things from:

Step 2: Code

*You need the Arduino application

*You will also need the App SensoDuino

Assuming you got the Arduino application as well as everything else needed in step one, you are going to connect your Ardunio to your computer and upload the code. (If you don't know how to do that you can click HERE to find out how.)

We used this code:

<p>#include <br></p><p>#define START_CMD_CHAR '>'
#define END_CMD_CHAR '\n'
#define DIV_CMD_CHAR ','</p><p>#define DEBUG 1 // Set to 0 if you don't want serial output of sensor data</p><p>// Create servo objects
Servo panServo;
Servo tiltServo;</p><p>// starting the motors in the center
int tiltVal = 90; 
int panVal =90; </p><p>// sensoduino values
String inText;
float value0, value1, value2;</p><p>void setup() {</p><p>  // Attach servo objects to Arduino pins
  tiltServo.attach(10);</p><p>  Serial.begin(9600); // The default speed of the HC-05  Bluetooth serial modules
  Serial.println("\nSensoDuino 0.18 by (2013).\n");
  Serial.println("Android Sensor Type No: ");
  Serial.println("1- ACCELEROMETER  (m/s^2 - X,Y,Z)");</p><p>  Serial.println("\n\nNOTE: IGNORE VALUES OF 99.99\n\n");
}</p><p>void loop()
  int inCommand = 0;
  int sensorType = 0;
  unsigned long logCount = 0L;</p><p>  char getChar = ' ';  //read serial</p><p>  // wait for incoming data
  if (Serial.available() < 1) return; // if serial empty, return to loop().</p><p>  // parse incoming command start flag
  getChar =;
  if (getChar != START_CMD_CHAR) return; // if no command start flag, return to loop().</p><p>  // parse incoming pin# and value 
  sensorType = Serial.parseInt(); // read sensor typr
  logCount = Serial.parseInt();  // read total logged sensor readings
  value0 = Serial.parseFloat();  // 1st sensor value
  value1 = Serial.parseFloat();  // 2rd sensor value if exists
  value2 = Serial.parseFloat();  // 3rd sensor value if exists</p><p>  // send sensoduino readings to serial monitor/terminal
  if (DEBUG) {
    Serial.print("Sensor type: ");
    Serial.print("Sensor log#: ");
    Serial.print("Val[0]: ");
    Serial.print("Val[1]: ");
    Serial.print("Val[2]: ");
  }</p><p>// Set sensor to Accelerometer
// sensorType 1 is the Accelerometer sensor</p><p>  if (sensorType !=1) return;   </p><p>  panVal = value0; // value0 = X sensor reading
  tiltVal = value1;  // value1 = Y sensor reading</p><p>  tiltVal = map(tiltVal, 10, -10, 0, 179);   // Map Accelerometer Y value to tilt servo angle. 
  delay(10);</p><p>  panVal = map(panVal, -10, 10, 0, 179);  // Map Accelerometer X value to pan servo angle.

Step 3: Connecting the Wires

Once you have that all down and good you are then able to start doing the slightly harder part of placing the wires together. You can either follow the photo or read on to understand how to connect it.

  1. To power the Arduino need to pug it into a computer through a USB port or have more than 9v of power for the servos we used.
  2. Run the 5v pin to each of your servos and the Bluetooth module.
  3. Ground to the servos along with the Bluetooth module.
  4. Connect the Bluetooth module RX pin to the TX pin on the Arduino, then connect the TX pin on the Bluetooth to the RX on the Arduino.
  5. Plug your signal wire (the yellow wire) from your servo into pins 9 and 10 on the Arduino.

*Note: It should look like the photos above (besides the electrical tape, we only had that to keep it in place.)

*Note: Each servo is different, look up the order that the wires correspond to. Try and keep the wires the same color to keep track and avoid confusion.

Such as for ours:

  • Red = Voltage/Power (VCC)
  • Black = Ground (GND)
  • White = Signal

Step 4: Building

You can make the whole thing as big and small as you want as long as the motors are able to move and the arduino is somewhat safe.

Step 5: Last Things

We got this instructable idea from: (you can also go there if we did not explain it well enough for you)

Be the First to Share


    • Battery Powered Contest

      Battery Powered Contest
    • Plywood Challenge

      Plywood Challenge
    • Plastic Contest

      Plastic Contest



    4 years ago

    Cool maze project, looks like a lot of fun. Nice work! :)