Home > Projects > Game – Entertainment Projects > Arduino Pocket Game Console + A-Maze – Maze Game

Arduino Pocket Game Console + A-Maze – Maze Game

Summary of Arduino Pocket Game Console + A-Maze – Maze Game


This article details the creation of a portable Arduino-based maze game console capable of generating unique mazes per level. The project features an SSD1306 OLED display, multiple push buttons for navigation and menu control, and a piezo speaker for audio feedback. It utilizes the Bo-Taoshi algorithm to generate infinite mazes within the constraints of limited RAM. The guide covers breadboard prototyping, wiring schematics, source code implementation, and 3D-printable case design for miniaturization.

Parts used in the Arduino Maze Game Console:

  • Arduino pro mini / Arduino Uno / Atmega328P chip
  • 28 pin DIP socket (optional)
  • SSD1306 OLED display
  • Piezo speaker
  • Push buttons - 7 pieces
  • Coin cell battery holders
  • Toggle switch
  • Wires
  • Prototype pcb (60x40mm)

Welcome to my first instructable!

The project I want to share with you today is Arduino maze game, which became a pocket console as capable as Arduboy and similar Arduino based consoles. It can be flashed with my (or your) future games thanks to exposed ICSP header.

I had an idea few months ago to build a maze game on Arduino, but without hard-coded set of mazes. It should be able to generate a new maze for each level you are playing, so you never see the same maze again 🙂

Coding this was a bit of a challenge, since Arduino is limited in RAM memory, and then I found few examples how this can be done with simple Bo-Taoshi algorithm.

Code I used as a starting point i took by SANUKI UDON and his project HOW TO MAKE A MAZE GENERATOR USING ATTINY13A

Step 1: Breadboard Prototyping

My starting point was with a small breadboard with only 4 buttons connected to move through maze, but later when i decided it should be a game console i added a few more buttons. On larger breadboard you can see 2 more buttons, and later i added a third one to be used as start/pause/menu button

Step 2: Parts Needed

  • Arduino pro mini / Arduino Uno / Atmega328P chip
  • 28 pin DIP socket (optional)
  • SSD1306 OLED display
  • Piezo speaker
  • Push buttons – 7 pieces
  • Coin cell battery holders
  • Toggle switch
  • Wires
  • Prototype pcb (60x40mm)

Step 3: Breadboard Wiring / Schematic

Connecting components as shown in diagram above.

Buttons:

  • UP button: Arduino pin 7
  • DOWN button: Arduino pin 6
  • LEFT button: Arduino pin 9
  • RIGHT button: Arduino pin 8
  • A button: Arduino pin 5
  • B button: Arduino pin 4
  • START button: Arduino pin 2

SSD1306 OLED screen:

  • SCL: Arduino pin A5
  • SDA: Arduino pin A4
  • VCC: Arduino VCC
  • GND: Arduino GND

Buzzer:

  • Buzzer positive: Arduino pin 3
  • Buzzer ground: Arduino GND

Step 4: Source Code

A-Maze game source code can be found here: https://github.com/alojzjakob/A-Maze

Open in Arduino IDE and upload to your board or use ISP programmer to program your chip.

I recommend using USBTIny ISP, never had problems with it 🙂 but you can also use ordinary Arduino to program your chip.

In my case I did not use external crystal, so my Atmega328p chip works on internal oscillator which is 8MhZ.

For more info visit this link: https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard.

Step 5: See It in Action

Step 6: Case and Miniaturisation

If you want to make this project permanent, with a nice looking case, here is the simple 3D printable case I designed: https://www.thingiverse.com/thing:2851100

In the pictures above you can see how all components are laid out on the 4×6 prototype PCB.

Most button wiring goes under the battery holders, try to make it as plain as possible, so battery holders can have relatively flush fit above the board with wires inbetween.

I also recommend do other wiring under the screen, since Atmega chip legs are soldered and exposed under the screen. When you are done soldering, put some insulation tape under the screen to prevent shorts etc.

ICSP header is optional, and if you decide not to expose it, it will make your assembly much easier, 6 connections less to take care of, but program the chip first before you solder it, or use 28 pin DIP socket so you can easily remove the chip for programming.

Source: Arduino Pocket Game Console + A-Maze – Maze Game

Quick Solutions to Questions related to Arduino Maze Game Console:

  • How can the maze game generate new levels?
    The game uses the Bo-Taoshi algorithm to generate a new maze for each level so you never see the same maze again.
  • What is the best way to program the chip without using an external crystal?
    You can set the Atmega328p chip to work on its internal oscillator which runs at 8MhZ.
  • Can I flash future games onto this console?
    Yes, the console has an exposed ICSP header that allows it to be flashed with your own or other future games.
  • Which Arduino pins are used for the directional buttons?
    The UP button connects to pin 7, DOWN to pin 6, LEFT to pin 9, and RIGHT to pin 8.
  • How do I connect the SSD1306 OLED screen?
    SCL connects to pin A5, SDA to pin A4, VCC to VCC, and GND to GND.
  • What should I do if I decide not to expose the ICSP header?
    If you do not expose the header, you must program the chip first before soldering it or use a 28 pin DIP socket for easy removal.
  • Is there a recommended tool for programming the chip?
    The author recommends using a USBTIny ISP programmer as they have never had problems with it.
  • Where should the button wiring be placed on the PCB?
    Most button wiring goes under the battery holders to allow them to fit relatively flush above the board.
  • Why is insulation tape recommended under the screen?
    Insulation tape is recommended to prevent shorts since the Atmega chip legs are soldered and exposed under the screen.
  • What algorithm was found to solve the RAM memory challenge?
    The author found the simple Bo-Taoshi algorithm to handle maze generation despite Arduino's limited RAM memory.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top