Gyro Sensor Controlled Platform for Maze Puzzle

Introduction: Gyro Sensor Controlled Platform for Maze Puzzle

This instructable was created in fulfillment of the project requirement of the Make course at the University of South Florida ("

This simple project inspired by a self-balancing platform that takes feedback from the accelerometer sensor. Check it out if you didn't already.

The project uses the Arduino UNO - Easy to use a microcontroller that you can get from online shopping websites! In this instructable, I'll be showing how you can make your own programmable tilting platform - from the design process to sourcing parts, 3D printing files, assembly, and programming. Stick on and let's move forward!

Step 1: Components Required and 3D Printed Parts

The list of the components used for the project:

1.Arduino UNO Microcontroller.

2.Breadboard with jumper wires.

3.A box.

4.Circular platform


6.Links - 3 No's

7.A Base for mounting three servos.

8. Gyro/Accelerometer sensor. (MPU6050)

9.1sq mm wires (500cm) - 4 No's

10. 3mm dia steel balls.

Most of the parts used for the project are 3D printed and I have attached the stl. files ready for printing.

Assemble all the parts as shown in the figures. The maze is hot-glued to the circular platform to look as in the picture. The three servos should be hot glued on the 3D printed base that is mounted on the lid of the box. The box contains the Arduino UNO and Breadboard assembled as shown in the figure. The breadboard setup will be discussed in the next step.

After assembly, the final prototype should look as in the last picture.

Step 2: Breadboard Setup

After assembly, the Arduino, Accelerometer sensor, servos are connected as described in the following.

The positive and negative rails on the breadboard are connected to 5V and GND of Arduino respectively. The sensor is connected to the Arduino using the half meter wires which are to be soldered to the sensor such that the VCC and GND pins of the sensor to be connected to +ve and -ve rails on the breadboard respectively. The SCL and SDA pins of the sensor to be connected to the A5 and A4 analog pins of Arduino. The PWM pins of the three servos are connected to 2,3,4 pins of the Arduino respectively and the +ve and -ve pins of all the servos are connected to the +ve and -ve rails of the breadboard. with this, our connections are done.

Step 3: Code for the Project.

you can download the MPU6050 and Servo libraries from the internet and use it for the project. Compile and upload the following code to the Arduino and the project is ready. Tilt the sensor and you can see the maze tilting in the same direction! It takes some time to solve the puzzle as it is a little challenging but its fun to play with.




Servo Servo1;

Servo Servo2;

Servo Servo3;

MPU6050 sensor ;

int servoPos1=90;

int servoPos2=90;

int servoPos3=90;

int16_t ax, ay, az ;

int16_t gx, gy, gz ;

void setup ( )


Servo1.attach ( 2 );

Servo2.attach ( 3 );

Servo3.attach ( 4 );

Wire.begin ( );

Serial.begin (9600);


void loop ( )


sensor.getMotion6 (&ax, &ay, &az, &gx, &gy, &gz);

ax = map (ax, -17000, 17000, 0, 180) ;

ay = map (ay, -17000, 17000, 0, 180) ;

Serial.print ("ax=");

Serial.print (ax);

Serial.print (" ay=");

Serial.println (ay);

if (ax < 80 && ay < 80){



Servo3.write(servoPos3--); }

if (ax < 80 && ay > 120){



Servo3.write(servoPos3--); }

if (ax > 120 && ay > 0 ){



Servo3.write(servoPos3++); }

if (ax == 90 && ay == 90 ){






Be the First to Share


    • Organization Contest

      Organization Contest
    • Back to School: Student Design Challenge

      Back to School: Student Design Challenge
    • Tinkercad Student Design Contest

      Tinkercad Student Design Contest



    1 year ago

    Looks good, thank you for sharing! : )