A few years back, I created one of the first Arduboy clone tutorial here.
It was quite a popular one, Since then many great tutorials got published, This is a repost of my original tutorial with few additions for Hackster.io
There is an 8 bit, credit card-sized gaming platform called Arduboy, that makes open source games easy to learn, share and play.
You can enjoy 8-bit games made by others on this device, or you can make your own games. Since it is an open-source project and uses Arduino, I decided to make my own version of it.
My goal was to design a PCB that is easy to make using the toner transfer method. So I made the tracks and pads as large as possible. If you don't want to etch the PCB, you can make one on a breadboard or a Perfboard.Gather the Components
You will need:
- Arduino pro micro (NOT Pro Mini. Pro micro the one with ATmega32u4 chip)
- 7 Pin SPI OLED Display
- 4 Pin Momentary Push Button (12x12x7.3mm)
- Copper clad (If you are making PCB) or you can use Breadboard / Prefboard.
- Slide Switch
- 3v Button cell and holder
- Female Header Pins
- Piezo Electric buzzer plate
WARNING: You have to make sure that you have anATmega32u4 based pro micro and 7 pins old display, otherwise the project won't work.
After completing this project I realised that the 3v button cell can only power the game for less than a minute. Since I'm using a USB cable to power mine, I didst bother to recreate the PCB files. So consider using amuch more powerful battery if you want complete mobility.Hooking up the components and test the Circuit (Optional)
This is an optional step, as I have tested and verified the circuit.
I wanted to check if the circuit is correct before building the PCB, so I assembled the circuit on a Bread Board. And made a keypad on a prototyping PCB
It was working, so I designed a PCB.Making the PCB
You can etch a custom PCB using the toner transfer method or solder components to a perf board using the schematics.
I've tried to make this PCB as DIY friendly as possible. It has big traces and wide pads. That will make the etching process and soldering easier. If you have no experience with PCB etching before, follow these tutorials.
Solder the 6 Pushbuttons, slide switch and battery holder to PCB.
(If you are going to power the game using a USB cable then you don't need the battery.)
UPDATE: The cr2032 battery is not powerful enough for this project, realised after building it.
We are not directly soldering the Arduino and OLED display to the PCB, as we can use them for some other project in future. Solder the female header pins to the PCB first and attach the OLED display and Arduino to headers. This will increase the thickness of our arduboy but we can remove these parts if we want.
There is a jumper wire going to the speaker. It is denoted in red color in the PCB files. Use a piece of wire to make this connection.
To connect the piezoelectric buzzer, solder two wires to the buzzer plate and solder that wire to PCB. Attach the buzzer plate to PCB using double-sided tape.
Attach Arduino and OLED display to corresponding header pins.
If you are making this project on a breadboard, then all you need to do is just connect the components as specified in the schematics. Here I made a separate joystick using 6 buttons and attached them to the breadboard.
The Connections are:
Connect All buttons to GND of Arduino.
BUTTON_UP -> Pin A0 of Arduino
BUTTON_DOWN -> Pin A3 of Arduino
BUTTON_LEFT -> Pin A2 of Arduino
BUTTON_RIGHT -> Pin A1 of Arduino
BUTTON_A -> Pin 7 of Arduino
BUTTON_B -> Pin 8 of Arduino
Speaker -> Pin 5 of Arduino
OLED pin GND and CS -> GND pin of Arduino
OLED pin VCC -> VCC of Arduino
OLED pin SCK -> Digital pin 15 of Arduino
OLED pin SDA -> Digital pin 16 of Arduino
OLED pin RES -> Digital pin 6 of Arduino
OLED pin DC -> Digital pin 4 of Arduino
You have to download and install Arduino IDE in order to upload games.
You can download the Arduino IDE from the link.
To compile and upload the game to your arduboy you have to install some libraries.
I've listed some of the important ones below.
- https://github.com/TEAMarg/ATMlib (https://github.com/Team-ARG-Museum/ATMlib)
Click on Clone or Download button and click Download ZIP
Go to these links and click on clone or download and download zip. Open Arduino IDE and click on
Sketch > Include Library > add.ZIP library
and select the downloaded zip file. Repeat this for all the files.
Instead of downloading and installing.zip files, you can also install the libraries using the Arduino IDE Library Manager:
Sketch > Include Library > Manage Libraries
then enter the library name in the Filter your search field.Uploading Games
To check whether the hardware is working properly, go to :
File -> Example -> Arduboy -> ArduBreakout
and click upload. If everything is working correctly you can play breakout game on your arduboy.
Make sure that you have selected the board as either Arduino Leonardo or Arduino/Genuino Micro
Sometimes you may run into an error like :
fatal error: ArduboyPlaytune0.h: No such file or directory
exit status 1 Error compiling for board Arduino/Genuino Micro.
while uploading games.
To fix this error, search the missing library name on http://github.com/.
Download and install the library as we have done before.
You can find more games for your arduboy from these sites:
Getting PCB Manufactured from a fab house
The above PCB is perfect for making at home. But it's bit bulky, so I later designed a two-sided PCB and ordered it from JLCPCB.com.
The latest Iteration of the PCB can be found here