How to Use an Xbox One Controller on the Raspberry Pi
Share
What you'll need
Interests
Posted in these interests:
The Raspberry Pi works with many controllers—Xbox controllers are no exception. From wireless Xbox 360 controllers to Bluetooth Xbox One controllers, if you’ve got an Xbox controller it will most likely work with a Raspberry Pi.
This guide focuses on how to set up an Xbox controller with Raspberry Pi OS. RetroPie is a little bit different—most of these steps will work, but be sure to check out our Ultimate RetroPie Controller Guide for details on setting up a controller with RetroPie.
The Ultimate RetroPie Controller Guide
Press A! Press A! No no no…not B!
How to Install Raspberry Pi OS on Your Raspberry Pi
Get the new official Raspberry Pi OS on your Pi.
1 – Install or update to the latest version of Raspberry Pi OS
Before we begin, be sure you’ve got the latest version of Raspberry Pi OS installed on your Pi. Visit our guide on how to update Raspberry Pi OS for details on this process.
How to Install Raspberry Pi OS on Your Raspberry Pi
Get the new official Raspberry Pi OS on your Pi.
2 – Install the xboxdrv driver
Xpad drivers are included with the latest version of Raspberry Pi OS—so this step is technically optional. We still recommend installing it in case you come across an application built around the old xboxdrv driver.
Run the following command to install it:
sudo apt-get install xboxdrv
3 – Connect a wireless Xbox controller
Wireless Xbox controllers use a USB wireless adapter. Connect the USB adapter to the Raspberry Pi. It should recognize and respond to the input as a normal USB controller.
4 – Connect an Xbox controller via USB cable
If you’re using a wired USB controller, plug the controller into a USB port on the Raspberry Pi. The Pi should detect the controller as a usable device.
5 – Connect a controller with Bluetooth
To connect an Xbox controller using Bluetooth, you’ll need a terminal window. Open one on Raspberry Pi OS or remote into the Pi using a terminal application of your choice.
1. Disable Enhanced Re-Transmission Mode (ERTM)
If ERTM is enabled, the controller won’t pair with the Pi. To disable the ERTM, run the following command:
echo 'options bluetooth disable_ertm=Y' | sudo tee -a /etc/modprobe.d/bluetooth.conf
Restart the Pi.
2. Start Bluetooth Tools
After the Pi reboots, start Bluetooth Tools with the following command:
sudo bluetoothctl
3. Search for the Xbox controller
Now we need to search for the Xbox controller. Don’t put the controller into pairing mode just yet. We have a few settings to adjust first. Enable agent with the following commands:
agent on
default-agent
Next, we’ll start scanning for available Bluetooth devices. Run this command to start scanning:
scan on
4. Connect to the Xbox controller
Put the Xbox controller into Pairing mode. It should appear in the list of devices with a unique MAC address and the words “wireless controller” at the end. Take note of the MAC address, we’ll need it to connect the controller. In the terminal window, enter the following command, replacing MAC_ADDRESS
with the Xbox controller MAC address.
connect MAC_ADDRESS
After connecting the controller, make sure it’s listed as a trusted device with this command—again replacing MAC_ADDRESS
with the one for the Xbox.
trust MAC_ADDRESS
Close the bluetoothctl application by typing quit
5. Test the connection
We’ll use the joystick toolset to make sure everything is working. Install it with this command:
sudo apt-get install joystick
When it finishes installing, run this command to start the test:
sudo jstest /dev/input/js0
You will see a screen of numbers. If everything is working properly, pressing buttons on the controller will cause them to change.
6 – Use an Xbox controller to replace mouse functions
Now that your controller is connected, you may want to use it in place of a mouse. Run the following command in a terminal window to enable this feature:
sudo xboxdrv --detach-kernel-driver --silent --mouse
If you need a specific mouse button, check the chart below for a corresponding button on the Xbox controller. It also includes a few keyboard functions.
Function | Xbox Controller Button |
---|---|
Move Cursor | Left Joystick |
Scroll Wheel | Right Joystick |
Left Click | A |
Right Click | B |
Middle Click | X |
Enter | Y |
Arrow Keys | D-Pad |
Page Up | LB |
Page Down | RB |
Forward | Start |
Back | Back |
7 – You’re all done!
Next, learn how to use your Xbox One controller on your PC.
How to Connect Your Xbox One Controller to PC
Use your Xbox One controller with your favorite PC games.