Introduction: Arduino Pocket Game Console + A-Maze - Maze Game
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 4x6 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.

Runner Up in the
Pocket-Sized Contest

Participated in the
Microcontroller Contest
18 Comments
3 years ago
Thank you! This game is fun, even on a tiny screen. I'd like to include it in a project that I'm doing with some kids but need to put it into a library file so we can call it from our main loop. Have you ever done this with these games? I'm getting a number of errors with the Adafruit SSd1306 related declarations.
4 years ago
1.6.6 (Windows 10), Board: "Arduino/Genuino Uno"
C:\Users\BMARTI~1\AppData\Local\Temp\arduino_42622094a2fed0d3a4ccbff5b308a1b6\sketch_mar04a.ino: In function 'void loop()':
sketch_mar04a:235: error: 'mainMenu' was not declared in this scope
mainMenu();
^
sketch_mar04a:240: error: 'walker' was not declared in this scope
walker();
^
sketch_mar04a:247: error: 'collector' was not declared in this scope
collector();
^
sketch_mar04a:254: error: 'escaper' was not declared in this scope
escaper();
^
sketch_mar04a:261: error: 'dark' was not declared in this scope
dark();
^
In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,
from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:88,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
from sketch\sketch_mar04a.ino.cpp:1:
C:\Users\BMARTI~1\AppData\Local\Temp\arduino_42622094a2fed0d3a4ccbff5b308a1b6\sketch_mar04a.ino: In function 'int readVcc()':
sketch_mar04a:339: error: 'MUX4' was not declared in this scope
ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
^
exit status 1
'mainMenu' was not declared in this scope
Invalid library found in C:\Users\bmartinez8231\Documents\Arduino\libraries\sketch_feb27b: C:\Users\bmartinez8231\Documents\Arduino\libraries\sketch_feb27b
Invalid library found in C:\Users\bmartinez8231\Documents\Arduino\libraries\sketch_feb27c: C:\Users\bmartinez8231\Documents\Arduino\libraries\sketch_feb27c
Invalid library found in C:\Users\bmartinez8231\Documents\Arduino\libraries\sketch_feb27b: C:\Users\bmartinez8231\Documents\Arduino\libraries\sketch_feb27b
Invalid library found in C:\Users\bmartinez8231\Documents\Arduino\libraries\sketch_feb27c: C:\Users\bmartinez8231\Documents\Arduino\libraries\sketch_feb27c
"Show verbose output during compilation"
enabled in File > Preferences.
4 years ago
Great work alojz. I like small consoles. I would like to build the miniaturized model with case. Is it possible to have the design of the PCB you used?
Best regards
Rafael
Reply 4 years ago
Hi, thank you!
I did not use a real pcb, but a prototype pcb. There are schematics included, just lay out components on the 4x6 prototype pcb and solve the wiring puzzle :D And i promise i will film the next time i build something like this :)
Reply 4 years ago
Thank you for your answer. One more question, if you don't mind. What type of coin batteries are you using?
Regards
Rafael
Reply 4 years ago
Hi,
For this i used CR2032
5 years ago on Step 6
can you send me a copy of the case, i have no 3d printer
Question 5 years ago on Step 2
I can't seem to find anything on an algorithm called "bo-taoshi", is there another name for it?
Answer 5 years ago
https://www.instructables.com/id/How-to-Make-a-MAZ...
ask this guy, he might know how it is translated to english... i just took his snippets of code as starting point for my game
5 years ago
Congratulations on your first Instructable my friend! Welcome on board!
This is a very cool project and very well engineered! You have done a great job in making this project tiny. Having built a similar project in the past, I know how hard it is to make things so small. Great stuff!
Reply 5 years ago
Thank you so much for warm welcome!
Yes it was really tricky, it took me few hours just to figure out the positions of elements on the board, how to wire everything etc. Most of button wiring goes under coin cell battery holders in 1mm space, meaning i tried to connect everything without wires crossing each other. Other things are wired below the screen. I plan to design a custom PCB, but that kills the fun :D
5 years ago
Great
5 years ago
it is called "cutting mat", kind of rubber material, helps keep your working table without scratches and clean :)
5 years ago
Nice tiny console! It does not look that difficult to make, I think I'll make one.
Reply 5 years ago
Thank you! please share your result when done :)
5 years ago
nice game pad .
5 years ago
What a fun maze! Congratulations on your first instructable!
Reply 5 years ago
Thank you!