Arduino Lego Maze

by chadrucf in Living > LEGO & K'NEX

3121 Views, 24 Favorites, 0 Comments

Arduino Lego Maze

20170504_114307.jpg

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com). The project is a fully functional maze game made of Legos and powered by an Arduino Uno board. This project is based on the official Lego set number 21305. Although this version is heavily modified, and in fact built from scratch, You may use this set as a starting point. Instructions for building this set are available here: https://www.lego.com/en-us/service/buildinginstructions/search?ignorereferer=true#?search&text=21305

Design

20170504_113633.jpg

The design implements S.N.O.T. (studs not on top) techniques for lettering as well as the tilting maze trays. This provides extra detailing and a sleek finish to the project.

Joystick and Ball Enclosure

20170504_113616.jpg

There is a built-in joystick on the side of the maze that is tilted at an angle for convenience of table top operation. Also embedded into the Maze is an enclosure which houses the balls used in the maze for easy transport.

Electrical Component Access

20170504_114358.jpg

On the size of the maze, one of the panels in removable to allow easy access to two ports on the Arduino Uno. This allows a wall power outlet to be used to power the maze. Also, the USB cable can be easily used to alter and update the code used to control the Maze.

Maze Inserts

20170504_113926.jpg
20170504_113833.jpg

The Maze is designed to have modular inserts to allow for an infinite amount of replayability. In this particular model, there is a simple maze and a more intricate medieval maze. These can be customized into any style, theme, or difficulty level for all ages.

Mechanical Control Mechanism

20170504_113652.jpg

The control mechanism is based o the official Lego Ideas maze set #21305. However, it is a modified personal design that was made from scratch. It uses the same lever-arm and linkage system to control the trays, however servos are used to turn the Lego Technic parts. Each axis has it's own identical assembly to rotate the maze about the x and y axis independently.

3D Printing

20170504_122825.jpg

In order to assure the correct gear ratios, gears were printed to be compatible with the Lego system. Specifically, Autodesk Inventor files of part number 32270 and 10978 were used to interface with the 3D printers.

Electrical Control Mechanism

Breadboard Diagram.PNG

This diagram shows the breadboard setup for the electrical components of the maze. The servos and analog joystick are each attached to 5V and ground on the Arudino. Servo 1 is attached to digital input 1 on the Arduino and servo 2 is attached to digital input 2. The horizontal and vertical axis of the analog joystick are attached to analog input 1 and 2 on the Arduino.

Coding

Maze Code 1.PNG
Maze Code 2.PNG

This code shows the sketch used to control the maze. It details how the reading from the analog joystick is used to manipulate the position of each servo motor. The interface used to made this control possible is an Arduino Uno micro-controller. This servo motor then interacts with the mechanical Lego components to allow the player to play with the maze.