Credits to the creator (Kevin Bates), the Arduboy is a very successful 8 bit game console. There were thousands of games written by the hobbyist who shared them freely on the community forum of Arduboy so more people can learn how to code.
The hardware design is also open source and allow makers like me to design their own version of hardware, and develop software utilities to enhance it's function. Credits to MR.Blinky who designed the Flash-Cart circuit, homemade package for Arduino IDE and the python utilities to manage the Flash cart which is capable of storing 500 games on a 16Mbyte serial flash memory for playing on the road without a computer.
Studying the discussions threads on the Arduboy's community forum, I learnt what I need to create several homemade Arduboys. For newcomers, this may not be easy. Hence I want to share what I learnt in a single end-to-end video and this written instructions. Hope this will help those looking for answers to build their own kit but do not know how to ask or did not get the right channel to ask those questions.
My version of the Arduboy is tiny only 1/4 of the size of the credit card (3.5cm x 5.0cm0) but a bit thick (2cm including the bottom cover), but has all the bells and whistles you need: 0.9" OLED, headphone jack, volume control, RGB LED.
and most importantly, the expansion port that allow you to swap your game console buttons with different ones by swapping the upper circuit board (the button hat).
You can then use silent buttons , joystick like buttons, or even analog controllers like a potentiometer.
You can also add humidity and temperature sensor to build a tiny weather station, or add super sonic sensors to build a distance meter.
It also has additional 16M bytes of serial flash memory for storing up to 500 Arduboy games or utility programs. By using the bootloader (Cathy3K) designed by MR.Blinky, you can call up any one of the 500 games on the road and self-flash that onto the ATmega32U4 chip (micro-controller of the Arduboy) in seconds to start playing, without connecting to your computer or phone.
Step 1: Get All the Parts
Most of the parts can be purchased online through amazon.com, aliexpress.com or taobao.com. Some of these could be harvested from unused Arduino boards.
It cost me less than USD 12 (excluding shipping) to buy all these from taobao.com and ship to Hong Kong.
Arduino Pro Micro
OLED 64x128 SSD1306 SPI 0.96"
Winbond W25Q128 16Mbyte memory chip
3.7V 280 MaH Lipo battery USB LiPO battery charger module (4.2V)
3.5mm headphone jack 10K mini VR (B103) for volume control
10K mini VR (B103) for potentiometer or rotary controller (optional)
mini Piezo speaker
3k, 3x 1K resistor
3-in-1 RGB LED Seven
5x5mm Silent Button
9x4mm slide switch for power switch
two 5x8cm double side perf board
one 5x8cm single side perf board
1x13 pin female header
1x13 pin male header
1x7 pin female header
1x7 pin male header 3.5x5cm Acrylic board for back cover
shipping cost to be included in your budget
Step 2: Make the Main Board
1. Create the frame for the mainboard.
a. Take the 8cm x 5cm perf boards. Cut it using a scissor (or a saw) to make a 3.5cm x 5cm smaller perf boards. That should still have 18 rows and 13 columns of pin holes. Cut out a 3.5cm x 5cm piece from an Acrylic board to be used as the back cover.
b. Solder a 13-pin female header to the last row at the bottom for the button hat and expansion. c. Solder a 7-pin female header to the first row at the top for the 7-pin OLED.
d. Solder a silent button for the reset button. e. Solder a sliding switch for the power switch. f. Solder a 3.5mm stereo headphone jack for head phone. g. Stick a 3-pin 10K mini-Variable resistor .
2. Make the 4.2V LIPO battery charger and 3.3V regulator circuit.
a. desolder the 5-pin 5V regulator on the Pro-Micro board, so that we can supply power from an external 3.3V regulator.
b. Trim the LIPO battery charger module so that it can fit onto the main board just next to the 3.4mm battery jack. You will need to make the cut at the point where the USB connector meets the rest of the circuit. If this is still too big, you may need to trim a bit further. In my case, I need to relocate and re-solder one of the resistor to allow me to trim further.
c. Trim off the tab at the top of the 3.3V regulator (AMS1117-3.3) to reduce space, and also to avoid short circuit. Then solder tpin 1 to the negative output and pin 3 the positive output of the LIPO battery charger module. Solder a 0.1uF capacitor between the Pin 1 and Pin 2 to decouple and reduce noise. Use a small SMD type capacitor to reduce space if possible.
d. Connect a 0.3mm laminated (insulated) wire from the RAW pin of the Pro micro board to the positive 5V input of the battery charger module. Connect a wire from the GND pin of the Pro micro board to the negative input of the battery charger module. Connect a wire from the middle pin (pin 2) of the 3.3V regulator. Connect the negative and positive terminals of the LIPO battery to the negative and positive output of the battery charger respectively.
d. Connect USB cable from your computer to the Pro-Micro Board. The RAW pin should supply the 5V from the USB cable to the LIPO battery charger module, that will be regulated to charge the LIPO battery. The charging LED should light up. The 3.3V regulator should convert the 4.2V output to 3.3V to power up the Pro-Micro Board. The LED on the Pro-Micro board should light up.
e. Start Arduino IDE , and click Tools -> Ports to check the port name to check if the Pro Micro’s USB port is recognised by your computer. On my MAC OSX, it shows “/dev/cu.usbmodem14201 (Arduino Leonardo)”. Click Tools-Boards and choose “Arduino Leonardo”. Then load the example sketch “Blink” . Then test upload to check if you can upload to the Pro Micro. If there is any problem, recheck the wiring and the soldering.
3. Make the serial flash daughter board. a. Cut out a smaller single side perf board with 7 pin holes x 4 pin holes to be used as the daughter board to house the flash memory chip and the extra breakout pins of D11,D12,D14. b. Divide the solder pads on the 2nd last row of the board into two halves. This will be used to mount the serial flash memory module which is a surface mounted device with a narrow distance between the pins, such that the middle two pins will stand on the two halves of the solder pad and will not short circuit. c. Solder the Winbond W25Q128 memory chip onto the perf board. Make sure no two pins are contacting.
4. Solder additional breakouts from the ATMega32U4 chip for pins D11,D12,D13. a. Using a fine solder tip, and a magnifying glass, solder three 0.5mm laminated (insulated) wire, onto the pins of the ATMega32U4 chip to breakout pins D11, D12, D13. Refer to the pin layout of ATMega32U4. This is the most difficult part of the project. I spent half an hour each time I need to solder this. You need to be super careful not to accidentally short circuits other pins of the micro-controller, while still make a solid joint that will last. Watch youtube videos to learn how to do such tiny soldering work, and how to rescue an accidental spill of solders using the desoldering threads. I would not recommend hot air gun/blower unless you are skilful enough. If the distance and power is not well controlled, it could easily ruin the solders of the ATMega32U4 chip or melt other components and damage the entire board to the point beyond recovery.
b. solder the other ends of the three wires onto the middle 3 solder pads at the last row of the serial flash daughter board.
5. Mount the serial flash daughter board onto the Pro Micro chip. a. Solder 0.5mm wires at the first row of pins at top of the Pro Micro board, i.e. TX and RAW.
b. Solder 0.5mm wires (e.g. those from the legs of the transistors) to the last four rows of pins at the back of the Pro Micro chip. i.e. D6,D7,D8,D9 and SCLK, MISO, MOSI and A10. The wire should protrude out from the top and down to the bottom so that we can use it to solder on the daughter board and connect that to the main board at the bottom. c. Solder the the serial flash daughter board to the Pro micro by connecting the last rows of pins of the Pro Micro to that of the daughter board.
6. Mount the LIPO Battery charger board onto the main board. a. Solder 0.5mm wires (e.g. those from the legs of the transistors) to the 4 corners of the LIPO Battery charger board (for -ve input, +ve input, -ve output, +ve output). Drill a hole at the spot where the middle pin of the 3V regulator resides. Solder a 0.3mm laminated wire to the middle pin (3.3V output).. b. Solder the 4 legs of the battery charger board onto the main board, right next to the 3.5mm headphone jack. To reduce space, the charger board should be pressed down to meet the main board.
7. Mount the Pro micro board at the bottom of the main board and solder all the pins from the last 4 rows and the first row of the Pro Micro to the main board. No need to solder the other pins, they will be connected by laminated wires as needed later on. This is to allow easier modification and if required replacement of the Pro Micro if it’s burnt.
8. Make the rest of the soldering.
Connect the pins of the Pro Micro board to the various components and headers. All soldering connection will be made at the bottom side of the double side perf board. After all soldering is done, test the connection.
9. Cover the bottom of the main board with the Acrylic board of the same size.
Step 3: Make the Button Hat
1. Create the frame for the button hat
a. Take the 8cm x 5cm perf boards. Cut it using a scissor (or a saw) to make a 3.5cm x 5cm smaller perf boards. That should still have 18 rows and 13 columns of pin holes. Cut out a window with 2.8 x 2.2 cm window that is big enough to let the glass of the OLED protrude out from the back. I used a diamond cutting wheel to do this. The tool is so sharp and strong that you may loose your fingers if you are not careful. You can place the cutting at the second row of pin holes from the top, and the 9th rows of pin holes from the bottom. and at the 2nd column of pin holes from each side.
b. Solder a 13-pin male header at the last row of the perf board.
c. Layout buttons on the perf board for D-PAD (directional buttons, up, down, left, right) and the A button, and B button. Then solder them on the front side of the perf board.
d. At the bottom side of the perf board, connect one side of all buttons to the ground pin (pin 2) of the male header.
e. Connect the second pin of each button to the corresponding pin on the male header for that button.
f. If you are building a button hat for a potentiometer rotary or dial controller, you will install a 3-pin 10K Variable Resistor instead of the D-PAD directional buttons. Check that the part number of the variable resistor starts with “B” (e.g. “B103” stands for Max. 10K), not “A”. “A” means the angle of the turn is proportional to the LOG of the resistance. B means the angle of the turn is proportional to the resistance. we need type B VRs for rotary game controller Connect one side of the potentiometer (the GND pin) to GND (pin 2 of the button hat header). Connect the other side of the potentiometer to VCC (pin 3 of the button hat header). Connect the middle pin of the potentiometer to the chosen Analog to digital pin of the Pro Micro board (one of A0, A1, A2, A3) depending on which pin the game is coded with. If the control is not smooth (jumps around), you can connect a 100pf capacitor between the GND pin and the middle pin of the potentiometer to decouple from noise on the circuit.
Step 4: Set Up Arduino IDE
If you are new to Arduino, browse to https://www.arduino.cc to download the Arduino IDE for the operating system you are using e.g.windows 10 or Mac OSX or Linux.
Then install it.
Step 5: Make the USBasp Cable
Unlike loading binary codes/games to any Arduino board, programming the bootloader cannot be done through the USB port.
To burn the custom bootloader (Cathy3K) to the Atmega32U4 chip, you need to get a USBasp programmer. However, our creation works at 3.3V, we need to further modify the USBasp programmer to function in 3.3V.
Refer to the following instructable project to modify your USBasp programmer to work at both 3.3V or 5V through jumper settings.
Then follow the pin layout and the video to make the USBasp to ArduBaby program cable. the original USBasp cable that comes with the USBasp has two connectors, each 10 pins. We will chop this cable in half, and connect a 6 pin male header to one end while keeping the other end that connects with the USBasp board at 10pin.
This other end will connect the GND, VCC, MOSI, MISO, SCK, Reset pins from the USBasp to the corresponding pins of the ATmega32U4 through the male header that connects to the first six pins of the female header on the Ardubaby.
To do the program or burn the bootloader to ATmega32U4, you will remove the button hat and plug in this 6-pin USBasp cable.
Make sure you mark which pin is pin one clearly on the header of the cable so that will will not make the wrong connection. When I design the pin layout for the Ardubaby button hat headers, I tried to arrange the pins such that even if you swapped pin 1 with pin 13, the -ve power supply will not accidentally meet with the +ve power supply to avoid damages. However, you never know, other things may happen that could still damage your kit if you connect at the incorrect direction.
I will burn a tiny hole to mark that on the header using the tip of the solder iron.
Step 6: Burn the Bootloader
MR.Blinky created the Arduboy-homemade-package for homemade Arduboy.
His package includes the board drivers and library of Arduboy that works with different versions of the original Arduboy as well as he homemade ones.
1. Browse to MR.Blinky’s GitHub folder for the homemade Arduboy. https://github.com/MrBlinky/Arduboy-homemade-package 2. Follow the instructions on the GitHub to configure your Arduino IDE with the homemade package. 3. First copy the url of the “Additional board manager” for Arduboy homemade package. https://raw.githubusercontent.com/MrBlinky/Arduboy-homemade-package/master/package_arduboy_homemade_index.json
4. Start Arduino IDE. Click Preferences from the Arduino top menu. Paste this text into the “Additional Boards Manager URLs” Note: If you already have other text on this field, insert this additional text at the beginning, then add a “,” and keep the other text intact. 5. Exit Arduino IDE and start the IDE again to take effect of the change above. 6. Click Tools -> Board: -> Board Manager. Enter homemade to search. Select to install the Arduboy homemade package by Mr.Blinky. Then click update to get the latest version. The package will be added to Arduino. 7. Now select Tools-> Board: “Home-made Arduboy. and select the following parameters for Homemade Arduboy” Based on : “SparkFun Pro Micro 5V - Standard wiring” Core: “Arduboy Optimized core” Bootloader: “Cathy3K” Programmer: USBasp 8. Turn off the Ardubaby and remove the button hat. 9. Set the jumper on the USBasp to 3.3V. Make sure you are using a modified USBasp that works entirely in 3.3V. 10. Connect the USBasp to the USB port of your computer. Connect the special USBasp to ArduBaby cable to USBasp, and the other end to the button hat header of the Ardubaby, line up pin 1 to pin 1. Only the first 6 pins of the Ardubaby is used for bootloader burning.
11. Your Ardubaby should be powered on now through the 3.3V power supplied by the USBasp. 12. Press the reset button of the ArduBaby once. 13. Clink the Tools->Boards->Burn Bootloader button on the Arduino IDE. 14. Check the message to see if the bootloader burn is successful. 15. If not, check the cable and make sure you connect the pins in the correct direction and line up pin 1 with pin 1. Sometimes, the Ardubaby will start playing a previous game if the boot menu times out. So, you need to click the Burn bootloader button quickly right after you press the reset button to put the Ardubaby at the waiting for flash mode. 16. If it's all good, the ArduBaby will reboot and you will see either the boot up menu, or the previous game you have loaded to the ArduBaby.
Step 7: Compile and Upload Single Games to Arduboy
Games for Arduboy can be downloaded from the following sources:
Arduboy community forum for games: https://community.arduboy.com/c/games
The GitHub search on "Arduboy games" https://github.com/topics/arduboy-game or just search "GitHub arduboy games" on google.
Game collections shared by others. e.g. Erwin's Arduboy collections
You can download the source code of the game that you car load to Arduino and upload to the Arduboy. See the video on how this is done.
or just the hex file (the compiled binary file but presented in Hex number print out to a text file instead of binary file).
For source code, just open the source code within Arduino IDE.
The source code e.g. picovaders.ino need to be stored in a folder of the same name e.g. picovaders
The required Arduboy2 libraries should be already installed in the previous step where we load the board manager for Arduboy homemade package.
Just connect the Arduboy to the USB port of your computer.
Switch it on, then click Upload button on the Arduino IDE to compile and upload the code to the Arduboy to play the game.
Step 8: Upload Single Hex Files
Hex file is a text file containing binary codes resulting form the compilation of your Arduino program (sketch), but represented in a text file format using two digit hexadecimal numbers 0-9,A-F.
You can get these hex file in different ways.
1. We can download hex files from the different sources we explained above:
https://community.arduboy.com/c/games Erwin's Arduboy Game Collections http://arduboy.ried.cl
Search for "Arduboy games" on GitHub.com or on google.com
Save these hex files into files with an extension of .hex.
2. Alternatively, you can make your own hex file.
In the Arduino IDE select Sketch > Export Compiled Binary. Your sketch will be compiled, then a copy of the compiled .hex file will be output to the directory of your sketch. Browse to the sketch folder or in the IDE select Sketch > Show Sketch Folder to see the hex file. If you installed MR.Blinky's homemade package two version of the .hex file will be created. For example, if you compile the picovaders.ino sketh, the following two .hex files will be created.
picovaders.ino-arduboy-promicro-ssd1306.hex picovaders.ino with_bootloader-arduboy-promicro-ssd1306.hex
We will use the first file: picovaders.ino-arduboy-promicro-ssd1306.hex
3. To upload hex file to Arduboy, you need to use an uploader. There are many on the internet. I like to use MR.Blinky's uploader as it's simple to use.
Browse to https://github.com/MrBlinky/Arduboy-Python-Utilities and follow the instructions there to install MR.Blinky's Arduboy Python utilities. If you do not have a python installed, you need to follow the instruction to install python and the required python modules first.
4. Connect the Arduboy to the USB port of your computer. Switch on the Arduboy.
5. Start the shell program in your operating system e.g. the terminal app in Mac OSX or the command prompt in windows to type the following commands to upload the hex file to the Arduboy. Taking our previous sketch picovaders.ino as an example.
python uploader.py picovaders.ino-arduboy-promicro-ssd1306.hex
6. Once the game is uploaded, the Arduboy will reset and start the game.
Step 9: Write Games to Serial Flash
1. To write the consolidated game file to serial flash, you need to use MR.Blinky's Arduboy Python Utilities again. You should have this already installed if you follow the previous step.
Otherwise, browse to https://github.com/MrBlinky/Arduboy-Python-Utilities and follow the instructions there to install MR.Blinky's Arduboy Python utilities. If you do not have a python installed, you need to follow the instruction to install python and the required python modules first.
2. Create the index file for the consolidated game image file to hold as many as 500 games.
We will use the Use the flashcart-builder.py script to build the a consolidated game image files for all the games you want to store into the serial flash of the Arduboy. A 16MB Serial flash can hold as many as 500 games. This script builds a binary flash image from an index file (.csv) and the following 2 files for each game: a. .hex files that is the text file containing the hexadecimal codes of the binary images of the compiled Arduboy games. Refer to the See the example-flashcart\flashcart-index.csv file for example syntax. This file is included in the package if you click Clone or Download. b. .png graphical image files to be displayed on the bootloader menu on Arduboy so you know which game you will be selecting. Some of the game repositories will have this graphical file together with their game source file or hex file. If you cannot find it, you can create your own by either running the game on the Arduboy emulator (https://felipemanga.github.io/ProjectABE/) and capture the screen. Or just type the name of the game on a power pint, then screen capture that. Then the graphics you captured/created down to 128x64 pixel using paint brush in windows, or preview in Mac OSX.
The youtube video also explains how to put things the right place of this .csv index file. One thing to note, the examples .csv file from MR.Blinky's GitHub is used in Windows PC, backslash "\" are used in the pathnames . If you are using a liunx system or MAC OSX you need to change it to "/".
To get a quick start, you can download my package of 63 games from https://github.com/cheungbx/ArduBaby 63games.zip
This package contains the hex files and png files of the 63 games I have chosen, plus the games.csv index file and the games-image.bin file that is built using the flashcard-builder.py script.
You can add more games into games.csv and build your own consolidated game binary image file to be written to the serial flash. You can put max 500 games on the 16M serial flash.
I'll explain how to make the .csv file using the games.csv that you can download form my GitHub.
Even though the .csv file can be opened using excel. DO NOT use excel to open the file. It'll corrupt the file. Please use a plain text editor only. You can use notepad in windows. I used the textEdit in MAC and click "Format"-> "Make Plain Text".
The first line of the .csv file is the header you can ignore. List;Discription;Title screen;Hex file
The second line point to the graphical image file (must be 128x64 pixel in png file format) for the boot loader manu screen. 0;Bootloader;arduboy_loader.png;;;
The games are configured starting from the third line. Games are organised into groups in the bootloader menu called categories. This line is the group title of the list of games for that group e.g. Action Game. It also points to the graphical image file for the group of games. The "1" at the beginning denotes group number 1. All games that follows this group will start with this number. 1;Action Games;category-screens\Action.png;;;
Then you add one line for each game within that group. Starting with group number 1, name of the game, and the path of the graphic file for a snapshot of the screen, and the path of the hex file. All separated by ";". Add one more ";" to skip the parameter for the save file. 1;1943;Arcade/Nineteen43.png;Arcade/Nineteen43.hex;; 1;2048;Arcade/2048.png;Arcade/2048.hex;;
After you finished the first group of games, you can add the second group of games and so on. e.g.
9;Demo & Test;demos/demotest.png;;; 9;Hot butter;demos/HotButter_AB.png;demos/HotButter_AB.hex;; 9;Flashcart test;demos/flashcart-test/flashcart-test-title.png;demos/flashcart-test/flashcart-test.hex;demos/flashcart-test/badapple-frames.bin;
The last line has a save file in the parameter which is a cartoon movie.
3. To build the consolidated game image file, type the command , where games.csv is your game index file.
python flashcart-builder.py games.csv
This will create a file named games-image.bin
4. Write the consolidated game image file to Arduboy.
We use MR.Blinky's flashcart-writer.py script to write the consolidated game image file to the serial flash memory of the Arduboy.
If you are using my sample games-image.bin file you can type this command.
python flashcart-writer.py games-image.bin
If you are using an SSD1309 OLED screen instead of the SSD1306 OLED on the standard build, you can patch the screen driver on the fly. To automatically apply the SSD1309 patch to the uploaded image, make a copy of flashcart-writer.py and rename it to flashcart-writer-1309.py. Then type
python flashcart-writer-1309.py games-image.bin
Step 10: Play Games From Serial Flash
To play games from serial flash, switch on the Arduboy.
If you already have a game loaded, the game will start automatically. Press the reset button on the top of the Ardubaby once to go to the bootloader menu.
The bootloader menu will be displayed. The RGB LED will light up in sequence.
If you see an icon that looks like a USB port displayed instead, that means your serial flash memory chip is not working. Pls check the wiring.
If you do not press any keys within 12 seconds, the game already stored in the ATMega32U4's internal flash memory will be run.
To go back from a game to the bootloader menu, just press the Reset button once.
You can press the left or right button to scroll through the different category (group) of games. Press the down or up button to scroll through the games within a category (group). Press the "B" button to copy the game from the serial flash memory onto the ATMega32U4's internal Flash memory. The game will start within a second.
Now you have a tiny game console that you can play on the road.
I challenge you to collect and load up your 16M Serial flash with 500 games. I haven't seen anyone who's done that yet to fill up the serial flash. If you can do that, do share that consolidated game file with us.