A story of Custom build cockpit for XBox

First some Disclaimers.

  1. I’m not native English speaker.
  2. It’s not tutorial, but i try to deliver as many hints i can.
  3. If you decide to replicate my idea, you do it on your own risk.
  4. I can drop this project anytime due lack of time, or lack of skill
  5. I’m not a writer or teacher, any suggestion about making it more clear will be welcome.
  6. I try to use as simple not-technical language as possible.

I’m playing flight simulator on xbox, and I’m disappointed by lack of support of ‘fancy’ peripherals…

That Discovery change everything…

I’m find a device, an micro-controller or uC for short. One named Rasspberry Pi pico which can witch minimal effort emulate keyboard. As we know FS on Xbox don’t have any problem which keyboard. There was two problems PID & VID. PID or Product ID and VID for Vendor ID. This two codes can’t be easy accrued. Thankful one company, Adafruit know for making stuff for meakers, make firmware for Rasspberry with build in keyboard emulation and PID & VID. That was beginning.

I’m trust every uC compatibile with circuitpython and native USB can be used, but Rasspberry was laying around handy, so i chose it.

Installation of circuitpython firmware is straightforward. Just download it (a stable one not beta) from Adafruit website (Here). Push and hold ‘bootsel’ buton on Raspberry Pi pico and while holding button connect it to computer. A USB dongle like drive should open. Drag and drop downloaded files into main folder. Reconnect Pi.
Next download necessary Libraries (I will be calling it later modules) from Adafruit website (Here) version must match your circuitpython firmware version. Uncompres and find ‘adafruit_hid’ folder inside ‘lib’ foder then copy it into ‘lib’ folder on your board. Last one save code posted below as ‘code.py’ on root folder of board.

For begining i wrote code:

#importing all important stuff to make THE RITUAL posible
import time
import board
import digitalio
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode

#defining THE class, a heart of device, ritual cannot be done without THIS!
class switch:
    def __init__(self, port, key1, key2): #This will setup our desired Button and bind it to uC!
        self.switch = digitalio.DigitalInOut(port) #Make a psychical Anchorn a INPUT!
        self.switch.switch_to_input(pull=digitalio.Pull.UP) #Make it HIGH!
        self.key1 = key1
        self.key2 = key2
        self.state = True #This will prevent us from unnecesary repeting
    def test_switch(self): #This will be testing state of Switch
        if self.switch.value != self.state:
            if self.switch.value == False: #This will execute if switch is ON!
                keyboard.press(self.key1)
                keyboard.release_all()
                time.sleep(400/1000)
                self.state = False
            else: #This will execute if switch is OFF!
                keyboard.press(self.key2)
                keyboard.release_all()
                time.sleep(400/1000)
                self.state = True

#Start of preparing THE RITUAL!

#Preparing a virtual keyboard, device used to comunicate with THE THING!
time.sleep(1)
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)

#Preparing a psihical switch, a anchorn in real world!
s1 = switch(board.GP2,Keycode.B,Keycode.C)

#Finally starting THE RITUAL!
while True:
    s1.test_switch()

For hardware, nothing except usb and short jumpwire will not be used today.
(I will add here photos shortly)

Test if everything is working connect board to computer, open notepad and short wire pins labeled (they are on underside of board) as ‘GND’ and GP2 (as long you don’t change anything inside code), every single short wiring shuld send b into notepad and unshorting should send c.

Back to code.

#importing all important stuff to make THE RITUAL posible
import time
import board
import digitalio
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode

This part load all necessary modules (aka prebuild parts). Ones starting with ‘from’ aren’t default one, but are provided by Adafruit and can be easily downloaded from adafruit website, more about leater.

class switch:
  def __init__(self, port, key1, key2): #This will setup our desired Button and bind it to uC!
        self.switch = digitalio.DigitalInOut(port) #Make a psychical Anchorn a INPUT!
        self.switch.switch_to_input(pull=digitalio.Pull.UP) #Make it HIGH!
        self.key1 = key1
        self.key2 = key2
        self.state = True #This will prevent us from unnecesary repeting
    def test_switch(self): #This will be testing state of Switch
        if self.switch.value != self.state:
            if self.switch.value == False: #This will execute if switch is ON!
                keyboard.press(self.key1)
                keyboard.release_all()
                time.sleep(400/1000)
                self.state = False
            else: #This will execute if switch is OFF!
                keyboard.press(self.key2)
                keyboard.release_all()
                time.sleep(400/1000)
                self.state = True

This part is sort of recipe for our program used for creating object with will define connection between physical switch and emulated keystroke.
def __init__(self, port, key1, key2): will pass port name we use, key for ON state, key for OFF state when we create new connection.
keyboard.press(self.key1) is used to push key on our virtual keyboard
keyboard.release_all() releas all pushed keys, its important, if not done pushed keys will interfere with other interactions
time.sleep(400/1000) adds a little delay to get rid of contact bouncing inside switch.

time.sleep(1)
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)

Is used to creat virtual keyboard, its part of Adafruit module, and must be left as it is.

s1 = switch(board.GP2,Keycode.B,Keycode.C)

This will creat object which bound phisical part to software.
s1 it’s name of this conection and MUST be unique to all used switches and buttons
board.GP2 is name of uC pin we use to connect switch or button, in this case Port number 2
Keycode.B is name of key B on keyboard, name is B but send b due of way in keyboard works.
Keycode.C is like Keycode.B B is used when switch is ON, C when is OFF
If you want more switches you must make this connection for every switches.

while True:
    s1.test_switch()

it’s so called infinite loop, yes you guessed it it works infinite. It’s on end because we first must prepare everything to work. If any part of program will be put past this point, loop will don’t know it. It’s how python works. If you add another switch for example named s2 you must change it to:

while True:
    s1.test_switch()
    s2.test_switch()
3 Likes

bravo, welldone, but there are fancy controls coming, lookup honeycomb !!

That true, it’s on my Buy list, but for now…

Except the Xbox compatible version of the Alpha hasn’t been released yet. The current version won’t work with Xbox.

We already know - “there are fancy controls coming” - you actually quoted that in your reply! :flushed:

Indeed. I shouldn’t be replying to posts before having drank my morning coffee. Not sure how I missed that.

Hopefully Honeycomb get their new wares out soon. At this rate, by the time they release it, most of their potential customers on Xbox will have moved on to other games.

Moved to #self-service:home-cockpit-builders

Well, if these X-Box Honeycomb devices are PC compatible, there will be a lot of “Little Used” cheap ones on Ebay soon !!

1 Like

Wishful thinking… the more “serious simmer” controllers which become available for Xbox, the more serious simmers will make the move.

1 Like

My cockpit is rudimentary, but I’m interested to expand it. :slightly_smiling_face:
Xbox is not just for ‘casual’ simmers.

1 Like

I completely forgot they did this. This just drives me more to speed up my building (I’m still at the drawing board :joy: ). With some proper generic keyboard bindings i would happily switch between PC and xbox :smiley:

Hi,

Currently I’m doing an Xbox-compatible cockpit as well. Since there are serious limitations for Xbox, I decided to make a panel with buttons and switches - so it will be visible as a regular keyboard. I decided to go with Arduino instead of Raspberry Pi, so it will be easier for me to send keystrokes and the hardware side will be very simple.

Good luck with your project!

1 Like

Will definitely keep an eye on this thread, especially because if you guys are able to do analog data ranges. I think there is also where the main challenge is.

My project won’t use analog data, but if I wanted to do this, I’d probably go this way. I guess it could be easily used for simulating aircraft controls based on levers (throttle, mixture, airbrake etc.)

A simple Arduino UNO can handle six analog inputs and there are lots of tutorials on how to connect potentiometers. I guess that making analog inputs it would be as difficult as making knobs (which means a little bit more difficult than making buttons and switches) - the biggest issue would be to find proper components.

Hmmm… not sure if i would use pots, wouldn’t rotaries be fine? You could use the analogs for digital input. I would even take a look into multiplexing which would give a lot more inputs. on a single arduino. Simplest would be the mux shield 2 i think.

That link would maybe work, i don’t know if the xbox accepts generic hid joysticks (0x04 / 0x05) :confused:

It’s sad but currently I don’t see any direct way for analog input.

But…

If you use HOTAS, and if Xbox pad show as separate input in game (I don’t have hotas right now, entire free part of salary go for premium deluxe :stuck_out_tongue: ) you can sacrifice one Xbox controller and directly hardwire into analog sticks and RT/LT this will give you 6 analog axies. At last in theory.

Another way is use of “Xbox adaptive controller as bridge between Xbox and “normal joystick”. As you can connect two generic analog joystick into XAC. Or witch is even easer you can wire analogous inputs directly to XAC without any problem. But I don’t have one so I can’t say if this will work with sim or how many imputs you will get.

Probably no, as Xbox accessories need special chip. But there is small chance.

The simplest thing, i think would be to sacrifice a normal controller to map rudder (bumbers), i think it’s just a “spring” loaded “pot”, not sure.
I have one which is almost EOL anyway, but would need to replace that one, otherwise i have an “discussion” at home :grimacing: .
Joystick is also doable for yoke or whatever (two axis). And if you would go cessna (for example), the other joystick could supply throttle and mixture.

But if you would have a xac, you can fiddle what you want on the usb ports and the analogue 3.5 jacks. If the usb’s are not just proxies? Which would mean you are still limited in what’s supported, unless they can map one to one on the analogue axis from “generic” joysticks.

I don’t think that’s only theory. If you have a multimeter you can measure the exact values.

Often these joysticks are lineair and dead center is half value

Idk for sure, I don’t own xac. But one point of this construction is ability to replace thumb stick with larger easier to use joystick. So far I know any generic joystick should work with xac.

I’m afraid i can’t help you there.

But if you go that route, you need to know for sure if generic joysticks are supported and how many at once for example for multi engine. Also you need to find out if all the jack connectors poles count. I can imagine buttons and bumbers are 2-pole and analogue sticks would be 3-pole.