Custom Hardspace Controller pt 1: Hardware selection
I wanted to incorporate something into this project to provide proper six-axis controls for player movement as one of the main features. Unfortunately when I went looking for suitable controllers, initially I only found finished flight-stick controllers which had a few issues:
- Far too expensive at approx $150 AUD
- They already had integrated controller circuits, somewhat defeating the purpose of custom DIY hardware
- They already had USB connectors, unsuitable for integration into my project unless I use a more expensive controller with USB host support
They looked great for a finished product but didn't really suit what I wanted.
Eventually, I found a much cheaper option which was probably more suited to the industrial tactility that I wanted. There's a number of cheap 3-axis joysticks with a single button out there, called PTZ sticks. These are originally intended for use in video surveillance systems or other camera control systems - hence the name (PTZ = Pan, Tilt, Zoom).
They are much less ergonomic than the flight stick, but also only 10% of the price, and expose simple wiring for the axes and the button, much better for what I wanted to use them for.
(The price and quantity has changed since I purchased them, they were $20 AUD each including shipping at the time)
I then started to look at the game's UI and decide what information could be translated to displays or other output devices I could include on my controller. Here's the main bits of information available:
With those additional pieces of information identified, I needed to take a look at the key mappings for the game to consider what other buttons were required. this list includes:
- Grab Left Hand
- Grab Right Hand
- Push item away
- Brake
- Scanner
- Swap tool mode
- Swap tool head
- Deploy tether
Putting all of this together I had some kind of idea of what I was going to require, and rummaging through my parts boxes I settled on the following elements:
- 20x4 LCD for the currently targeted item properties
- 20x4 LCD for salvage status, pressure levels, location
- An existing multiplexed 3 10-element bar graph with button and toggle switches, for the vital stats
- A multiplexed seven-segment display for showing the amount of time in the shift
- A 128x160 TFT display for showing the subtitles including the icon of the speaker
- A panel containing assorted buttons and toggles for the remaining inputs
For the primary microcontroller, I went with STM32L073CZ for a few reasons:
- Cost - I already had 10 or so of them on hand, and new STM chips are incredibly expensive
- Board support - I already had a PCB fabbed to suit them
- Plenty of I/O and USB support
- Large amount of Flash and RAM - this particular model has 192K Flash and 20KB RAM, good for working with the TFT screen
Hardspace: Shipbreaker Controller Implementation
- Implementation breakdown pt 1: Hardware selection
Implementation breakdown pt 2: 20x4 LCD implementation
Implementation breakdown pt 3: PTZ joysticks
Implementation breakdown pt 4: Switches and buttons and bar graphs, oh my