Retro gaming fan with an urge to connect your Xbox One controller to your Raspberry Pi? Thanks to the automatic configuration tools in RetroPie and Recalbox, it is possible to control games with an Xbox Controller.
But what about the actual connection? Is it possible? Might you need an adapter to connect an Xbox One controller to another computer? Here’s what you need to know.
Configuring Raspbian for an Xbox One Controller
If you’re planning to use an Xbox One controller with your Raspberry Pi, start by updating your operating system. In the terminal, use:
sudo apt update sudo apt upgrade
Wait while each of these completes, looking out for any prompts to confirm installation.
In most cases you shouldn’t need a driver for the Xbox One controller on Raspbian. Support for the controller is built-in to the operating system. However, older emulators and games don’t detect this. It’s also useful for connecting over Bluetooth (see below).
If you’re having trouble getting the Xbox One controller to work with certain games, install the driver with
sudo apt install xboxdrv
As ever, wait for the installation to complete before proceeding.
How to Connect an Xbox One Controller to a Raspberry Pi via USB
The beauty of USB is that you can simply plug and play.
While the convenience of the Xbox One controller is its wireless flexibility, if you’re desperate to use it, try USB. The Xbox One charging cable can be used for this, but if your system didn’t include one, you’ll need to buy your own. The 2.7-meter version is best for gaming on retro systems.
Don’t forget, you can also buy a cabled version of the Xbox One controller. This will plug straight in, and save time configuring Bluetooth.
How to Connect an Xbox One Controller to a Raspberry Pi via Bluetooth
If you’re planning to connect your Xbox One controller to a Raspberry Pi, it’s best to choose a later model. Older Raspberry Pi’s don’t have the speed of processing (or the Wi-Fi and Bluetooth capabilities) to handle wireless controllers. Use USB if you’re limited to older Pis.
With a Raspberry Pi or later, you have two options for wireless connectivity:
- Wireless adapter dongle
- On-board Bluetooth tool
One is considerably easier than the other.
Method 1: Using Microsoft’s Xbox Wireless Adapter
The simplest way to connect an Xbox One controller to a Raspberry Pi is to use the official Microsoft Xbox Wireless Adapter.
(Note that this controller is different to that used by the Xbox 360 wireless controller.)
With the wireless adapter connected to your Raspberry Pi, boot up and then wait for the device to light up. Hold the pairing button on the adapter and the Xbox One controller simultaneously and wait for the lights to sync. When they stop flashing, you’re ready to play!
Method 2: Pairing Directly via the Bluetooth Tool
Before proceeding, make sure you have installed the xboxdrv driver as explained earlier.
Syncing an Xbox One controller requires you to disable ERTM. This is the Enhanced Re-Transmission Mode, a key feature of Bluetooth. However, with it enabled, the devices cannot sync. Disable ERTM with:
echo 'options bluetooth disable_ertm=Y' | sudo tee -a /etc/modprobe.d/bluetooth.conf
Next, reboot the Raspberry Pi:
The restarted Raspberry Pi is now ready for Bluetooth connectivity. Start the Bluetooth tools with:
You should see the response “Agent registered” and a new prompt
[Bluetooth]#. At the prompt, enable the agent like so:
Then, set it as default:
The next step is to start scanning for discoverable Bluetooth devices. Use the “scan on” command to commence scanning:
Immediately you’ll see a list in the terminal of available devices. However, the Xbox One controller will not be among these items. Instead, you’ll need to make the controller discoverable. Switch it on, then hold the sync button on the front of the device, next to the microUSB port.
When the Xbox button light starts flashing, it is discoverable. You should see a string of numbers and a description appear in the terminal. Ours looked like this:
[NEW] Device 5C:BA:37:4D:1D:95 Xbox Wireless Controller
The six pairs of letters and numbers separated by colons are the Xbox One controller’s MAC address. This is used to connect the controller to the Raspberry Pi with the connect command:
(Your MAC address will be different.)
Connection will be confirmed in the command prompt with a row of lines followed by “Connection successful.”
To ensure easy connection in future, instruct the Raspberry Pi to trust the controller:
With that done, quit the Bluetooth tool with Ctrl + D.
Test Your Xbox One Controller
At this stage you’re done. To confirm the Xbox One controller is working correctly, install the joystick software:
sudo apt install joystick
With this installed, use the jstest tool to check your Xbox One controller’s inputs:
sudo jstest /dev/input/js0
A new window will open in the terminal, a list of buttons and axes. Each will display different values when pressed and moved. Moving around the buttons and thumbsticks on the Xbox One controller will prompt values to appear. As long as the responses are different and instantaneous, everything is set up and working correctly.
Start Gaming on Raspberry Pi With an Xbox One Controller
By now you should be all set to start gaming with an Xbox One controller on your Raspberry Pi. Whether you’re using RetroPie, Recalbox, or some other retro gaming suite for Raspberry Pi controller profiles should be available. This means that when you hook up your controller, not only can you navigate the retro gaming platform’s interface, you can play games too!
Remember, you have three ways to connect an Xbox One controller to your Raspberry Pi:
- Use a USB cable
- Sync via the Xbox Wireless Adapter
- Sync using the on-board Bluetooth tool (Raspberry Pi 3 or later)
Want some retro two-player action but only have one controller? Check out our roundup of the best controllers for RetroPie.