A simple project for a Star Citizen fan

Project: A simple Star Citizen board
For: Kenoby
Features: 64 buttons
Board: Arduino Leonardo ATmega32u4
Interface: HID

A friend of mine wanted to add 50-60 buttons to his Star Citizen pit. I suggested a 8×8 or 9×9 button matrix in order to have both simple code and easy wiring (no additional components required). He has chosen the 8×8 matrix.
Pins have been divided in two groups starting from TX. Two pins are currently unused.

Hardware Upgrades
Two pins spared means that one can be used as a Master Switch to double the amount of logical buttons available. This is something I regularly do and it works as a Shift button on the keyboard or a Modifier often present in most joysticks. It means that each physical button sends two different joystick commands depending on the Master Switch. I implemented, the number of logical buttons will be 128.
Alternatively, both pins can be used as standard 2-way latched switches, increasing the amount of logical buttons to 68.
If the Master Switch is implemented the HID limit is reached but the second pin can still be used as POV. Game-wise it doesn’t make any difference.
Both these upgrades will require some coding.

The firmware is the same basic one I used for my Radio Box. I have simply increased the button matrix dimensions and adjusted the relative pins.
The Firmware is available for download in the Download page.

Firmware updates
The first firmware update requested is the possibility to send keystrokes directly to the PC. This due to the fact that some functions cannot be assigned in-game at the moment.


This slideshow requires JavaScript.

Update I: 26/05/2019

Recently we implemented a simple firmware modification to allow his Panel to send keystrokes. The reason is the impossibility to assign some functions to a button.
The workaround is very simple in order to allow Kenoby to expand the amount of controls by himself:


The new code checks if the button number of a button of the matrix matches one of the ones he wants to override. I choose to work with the button number because makes understanding the code much easier, which is great for any non-programmer. I choose the switch-case construct for the same reason (cascade-IFs are a bit more complicated to expand if you have never coded yet).
There are better and more efficient ways to code this workaround (for instance by skipping the whole construct if buttbx.key[i].kstate!=PRESSED) but since performance is the last of the issues, I cared only to write simple and plain code so Kenoby can expand it by himself.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: