In this project I have been programming at the beginning an interface in GTK called GamMa. But the goal was to run that application on an RPI Zero 2W and for it to communicate with the dashboard via USB and serve as an interface with the player. During the development of the GamMa application I have been changing the development method and adapting the code as I found problems and learned more to program in C++.
I started the application using Geany as an IDE, which was the one I had used until then to develop in a RevPI, since it was very light and easy for me who had always programmed in C for microcontrollers. To make some progress on this topic I switched to Codeblocks, which is more designed to work in C++ and also runs correctly on an RPI4.
Then I learned how to use Visual Studio Code with the Remote SSH plugin, which allowed me to easily work from my PC without having to run a remote desktop on the RPI. Since then I have developed like this, and I have been adapting the code as I found problems.
The first problem was with the USB access libraries. I started with HIDAPI, but due to problems in compiling for ARM I switched to LibUSB. Once I had the dashboard communicating via USB with the GTK interface, I discarded this interface to focus on developing a physical interface with buttons and a 128×64 SPI OLED display. For this I used WiringPI but I also ended up discarding it due to problems when integrating the library to control the screen. I then used the bcm2835 library that allows access to the gpio, the I2C and the SPI.
The library to control the screen is ArduiPi_OLED, which is an Arduino ported library to make it work in RPI. I had to modify it to be able to include the SH1106 OLED controller in SPI mode and added some more functionalities such as word-end detection and corrected errors to be able to better integrate it into the project. This is my fork: Fork ArduiPi_OLED. It is possible that it will recover the GTK version if it evolves enough to require an application on x86 or on an RPI with an LCD, but for now I will develop it this way, with a physical screen and keyboard.
The game menus in the prototype currently look like this:
The game right now has a couple of phases, the one in which the player must position the pieces and the one that allows the player to decide the movement of their piece. The player’s starting position is always the same, but that of the target (asteroid) and enemies (aliens) is randomly generated. Here’s an example of random position generation:
In the player phase, the cells around the player light up indicating your range of movement:
These are the pieces that I have printed to try, they are not the final ones but they are an idea of what they would be like. They have a translucent base and a small magnet for the Hall sensors in the cells to detect them:
So once I had the prototype working with the connection to the OLED and the buttons, I designed a circuit that would integrate everything and also have the connection for the RPI Zero 2W that will host the GamMa application and communicate with the board via USB. This circuit is designed to be powered from the board itself, which is the one that has the 5V and 3.3V power supplies. It includes the SPI OLED screen, the connector for the RPI Zero, RGB LEDs to indicate the player’s status and the current game phase, and an auxiliary connector that will allow you to expand the functionalities by connecting an NFC reader or another interface for a second player. The circuit diagrams are these:
And the renders of the circuit are such as this:
The circuit design, schematic and bill of materials can be obtained from PCBWay, as well as order the pcb directly. This design is open, anyone can use it for whatever they want, but the GamMa application is not yet published until I get a minimum operation and see which license I choose.




