Mechatronics Exercises

Workspace Navigation

Joystick controlled labyrinth

Marko Kosonen, Olli Knuuttila, Oskar Björkgren

Project goal: 

The goal of this project is to modify a traditional labyrinth marble game so that it can be
controlled with a joystick, instead of the turning wheels that are used in the base version of
the game. Motors will be used to turn the game base on its axis. 

One additional feature we would like to add as well is a calibration function where the board resets to starting position, which can be achieved with data from an accelerometer. 

The pre circus look of the project:

Side view without teeth belt

Side view with teeth belt attached, tape will be replaced with a 3D printed clamp

Arduino connections, set up so we can easily connect the stepper motors to this.

Under side view, here we can see how the two stepper motors are connected to the game board

The final state of the project:

The labyrinth is now controlled by the joystick and there is a calibration function, that levels the board using an accelometer.

The final look of the project with the breadboard inside the black box.

Closer picture of the box

Electrical Circuit

Picture of the circuitry connecting the project components. Including 2 Nema 17 stepper motors, 2 A4988 tepper motor drivers, Arduino Uno, ADXL335 accelerometer and connections for the power supply.

Demo videos


List of components used:

  • Arduino Uno R3
  • 2X Nema 17 stepper motors
  • 2X A4988 Stepper motor drivers
  • 24V 1.5A Power supply
  • ADXL335 Accelometer
  • Jumper cables
  • 2x pulleys
  • 5mm timing belt
  • Labyrinth game

The budget was 190€ that was sponsored by a group member.

The code used in the project:


Two additional Arduino libraries were used in the project code. The accelstepper library ( is an improvement to the default Arduino stepper functionality.

It is a powerful library for controlling stepper motors, and it provided a good framework for our project. Two stepper objects are initiated, and are then controlled by calling specific target and motion functions to achieve the desired movement.

The accelstepper library has options to control motors with acceleration using run(), or with constant speed using the runspeed() function.

The second additional library is called ezButton(, which was used to add an interrupt function to the code that balanced the labyrinth platform.

Additional code with accelstepper acceleration enabled. This was not used in the final version, since it had significantly more control lag. Even though it provided more smooth motion.


  • No labels
  File Modified
File Accelstepper_with_a_target_location_3rd_test.ino Apr 21, 2023 by Marko Kosonen
JPEG File arduinopic.jpeg Mar 14, 2023 by Oskar Björkgren
PNG File image2023-2-18_13-36-34.png Feb 18, 2023 by Oskar Björkgren
JPEG File IMG20230412170954.jpg Apr 12, 2023 by Olli Knuuttila
JPEG File IMG20230412171000.jpg Apr 12, 2023 by Olli Knuuttila
JPEG File Labyrinth Electrical Circuit.JPG Apr 21, 2023 by Marko Kosonen
JPEG File photo1678816493.jpeg Mar 14, 2023 by Oskar Björkgren
JPEG File photo1678816493 (2).jpeg Mar 14, 2023 by Oskar Björkgren
JPEG File photo1678816493 (3).jpeg Mar 14, 2023 by Oskar Björkgren
File Steppermotor_with_calibration_final_V1.ino Apr 12, 2023 by Olli Knuuttila
Multimedia File video5891246484887703867.mp4 Apr 21, 2023 by Oskar Björkgren
Multimedia File video5891246484887703869.mp4 Apr 21, 2023 by Oskar Björkgren