how_to_connect_an_xbox_controller_to_a_raspberry_pi

Can You Use an Xbox Controller on Raspberry Pi? Here’s What Actually Works

If you click our links and make a purchase, we may earn an affiliate commission. Learn more

An Xbox controller seems like the perfect gamepad for Raspberry Pi retro gaming, but getting it working is not always as simple as plugging it in. I tested it with a Raspberry Pi to see what works, what needs extra setup, and which connection method is the easiest.

The Xbox controller can connect to the Raspberry Pi in various ways. The USB controller can connect directly via the USB ports. The wireless (Bluetooth) controller only connects via Bluetooth and also supports retro gaming systems like RetroPie, Lakka, Batocera, and RecalBox.

If you already have a retro gaming OS in mind, feel free to jump straight to that section using the table of contents below. Just make sure you go through the requirements first before skipping ahead.

By the way, if you’re looking for some great retro games, I’ve got a list of my 24 favorites for Retropie, Recalbox, or Lakka. It’s packed with screenshots, descriptions, and download links to make it easy for you. Grab the list for free here!

Requirements

Below are some things you’ll need for this project:

  • USB Keyboard: In most projects, I have always listed it as optional, but today you will definitely need it.
  • Supported Xbox controller: Not all Xbox controllers support Bluetooth connections.
    • Unsupported versions: These three rely on Microsoft’s proprietary Xbox Wireless protocol and require a USB wireless adapter to connect wirelessly to anything.
      • 1537
      • 1697
      • 1698
    • Supported versions: These three versions support Bluetooth connections.
      • 1708
      • 1797
      • 1914
  • USB cable: To configure your Xbox wireless controller on some retro gaming OSes, you will need to connect it physically to the Raspberry Pi using a USB cable first. Once that is done, you can unplug the cable and switch to Bluetooth.

    All supported Xbox wireless controllers have a USB port. The 1708 uses micro USB, while the 1797 and 1914 use USB-C, so use whichever cable matches your controller.
  • Update the Xbox Controller: To update the controller, either connect it to the Xbox One console or use the Xbox app on Windows PC (Xbox Accessories).
  • Gaming OS: If you are just getting started with retro gaming on the Raspberry Pi, this guide will give you very good insight about everything you need to know – Retro Gaming with Raspberry Pi: Everything to Start.

    I will first show you how to connect the Bluetooth Xbox controller to Raspberry Pi OS, and then we will look at how to connect it to various retro-gaming systems like Batocera, RetroPie, RecalBox, and Lakka.

Assuming you have all the requirements needed, let’s get started. Don’t worry about how to install these operating systems. I have already included the necessary links to give you a comprehensive installation guide.

Connect an Xbox Controller to Raspberry Pi OS

For this section, I assume you already have the official Raspberry Pi OS installed. If you haven’t, go through our comprehensive guide on installing or reinstalling the official Raspberry Pi OS.

I didn’t have a problem connecting the Xbox controller to the official Raspberry Pi OS. Everything went smoothly and easily. Just follow the steps below.

Pair the Xbox Controller

Take your controller and press the Xbox button to turn it on. You will notice it will blink slowly. Now, go to your Raspberry Pi, click the Bluetooth icon in the top-right corner, and select “Add device.” You should see a small window appear, similar to the image below:

For now, the Bluetooth wireless controller won’t appear because we haven’t enabled wireless mode on it yet. To achieve that, hold the wireless button just above the plug in the back, and you should see the Xbox controller appear in the Raspberry Pi Bluetooth menu.

Something not working as expected?
You can get answers from real experts in minutes.
Get help with your setup

Tip: In some cases, you might need to hold the button longer, or hold the Xbox button for just a few seconds, for the controller to appear in the Bluetooth devices list.

On the Raspberry Pi, click the Xbox wireless controller and click the “Pair” button. Once it’s successfully connected, you should now have a solid light on the Xbox controller.

If you have issues with Bluetooth on the Raspberry Pi, please review our comprehensive article on connecting Bluetooth on the Raspberry Pi. It covers both the GUI and command-line methods.

Testing and Configuring the Controller

After you have successfully connected the Xbox controller via Bluetooth, you need to confirm it’s working correctly.

I found a very interesting tool that you can use to do that. It is called jstest-gtk.

jstest-gtk is a GTK+-based joystick testing utility that helps you view connected joysticks, monitor button and axis inputs in real time, remap controls, and calibrate your controller for accurate response.

It is a pretty old tool because if you check the official jtest-gtk GitHub page, there are commits that date back up to 17 years ago. Luckily, it is still maintained, and I tested it on my Raspberry Pi OS, and it worked perfectly.

Installing this tool on your Raspberry Pi is easy since it’s already available in the official Raspberry Pi repositories. Just run the command below:

sudo apt install jstest-gtk

Tip: Command lines can be a pain to memorize. I put the essential Linux commands on a printable cheat sheet so you don't have to keep googling them. You can grab the PDF here if you want to save some time.

If that command runs successfully, then you will have installed the jstest-gtk utility. Now you have two options for running this application.

You can launch it from the menu -> system tools -> jstest-gtk as shown in the screenshot below. Or, you can open the terminal and type this command:
jstest-gtk

launch_jstest_gtk

A window will open listing detected joystick devices. Now, in your case, the connected Xbox controller should appear here. Typically, as /dev/input/js0. Select it and click Properties to open the test interface.

From here you can:

  • Test inputs: Press any button or move the analog sticks, and you will see the corresponding values change in real time, confirming the controller is communicating with the Pi.
  • Check axes: Each analog stick and trigger is represented as an axis with a value range, useful for spotting any drift issues.
  • Calibrate: jstest-gtk includes a basic calibration option if any axes appear off-center.

Tip: If your controller does not show up, it may not have paired successfully. Go back and repeat the Bluetooth pairing steps.

Now that we are done with the Raspberry Pi OS, let’s look at how to connect the Xbox controller to specific retro gaming systems. If you’re not sure about which one is best for you, read our article on the best retro gaming operating systems you can install on the Raspberry Pi.

Connect an Xbox Controller to Batocera

Batocera is actually my favorite retro-gaming distribution nowadays. I’m saying “nowadays” because I was previously a huge fan of RetroPie, but Batocera offers the broadest hardware support and fastest setup.

You don’t really need to make many configuration changes to get things up and running. When you connect an Xbox or PS4 controller, it is more like plug-and-play. You will understand what I mean once you reach the RetroPie section below.

If you need help with the installation, we already have a post that covers this in a step-by-step procedure: Batocera on Raspberry Pi: Installation and First Steps.

Connect the Xbox Wireless Controller to Batocera

After Batocera has successfully booted, you should see a desktop similar to the image below. From this point, follow the steps below to connect your Xbox wireless controller to Batocera.

The first thing you need to do is put the Xbox Controller in pairing mode: press and hold the Sync button for about three seconds until the Xbox logo starts blinking rapidly. The Sync button is the small button located at the top of the controller near the USB port. This indicates the controller is now discoverable.

Next, press the space bar on your keyboard to open the Main Menu. Use the arrow keys to select “Controller & Bluetooth Settings” as shown below. Press Enter.

You will see several options in the “Controller & Bluetooth Settings” screen. However, I want you to focus on the Bluetooth section only.

Use the arrow keys to select the “Enable Bluetooth” option and hit Enter. You will be presented with two options: pair your controller automatically or manually. Unless you have several other Bluetooth controllers nearby, go with Pair Bluetooth Pads Automatically.

Batocera is surprisingly good at detecting and identifying your Xbox controller on its own, so the automatic option works just fine in most cases.

If you have several controllers or Bluetooth devices nearby, select your controller manually and hit Enter. Your Xbox controller should appear in the list as shown in the image below. Select it and hit Enter to pair.

Once the pairing is complete, the Xbox logo on your controller will stop blinking and remain solid, confirming a successful connection.

Recommended next step
Master Raspberry Pi in 30 Days

If you want a clearer path than jumping from tutorial to tutorial, my book gives you a step-by-step roadmap to really understand your Raspberry Pi.

Check the book here

Testing and Configuring the Controller

Now this is the part I have really come to love with Batocera. You don’t actually need to remap your controller like you would on many other retro-gaming OS.

Batocera maintains a database of known controllers and uses it to automatically map them for you, so most common gamepads work out of the box with no user interaction needed.

Actually, for the most common gamepads like Xbox, PlayStation, Nintendo, and 8BitDo, the buttons are already mapped suitably the moment you connect.

However, in case you need to remap, open the Main Menu -> Controller & Bluetooth Settings -> Controller Mapping.

Note: If your controller does not appear during scanning or fails to pair, ensure its firmware is up to date. You can also try going back to Controller & Bluetooth Settings, selecting Forget Bluetooth Devices, rebooting Batocera, and attempting to pair again.

Connect an Xbox Controller to RetroPie

RetroPie is an open-source software library used to transform a single-board computer, like the Raspberry Pi, into a dedicated retro-gaming console.

It is actually one of the most popular emulation frontends for the Raspberry Pi, and for good reason. It’s powerful, highly customizable, and has a massive community behind it. If you haven’t installed RetroPie yet, have a look at this article, which gives you a step-by-step procedure on how to install RetroPie on your Raspberry Pi.

We also have a separate guide that walks you through the process of installing RetroPie on top of an existing OS – How To Install RetroPie On Ubuntu: A Step-by-step Guide.

Initial Configuration

After booting your Raspberry Pi with RetroPie installed, the first screen you will see is the controller configurations window. Now this is the part where I said you will need a keyboard or a USB Xbox controller.

Personally, I connected a keyboard.

If you have connected a USB gamepad, this image above will now read “1 GAMEPAD DETECTED” as shown in the screenshot below.

Now, hold any button on your keyboard or gamepad, and you will be taken to the input configuration screen. Whatever you will basically do here is map your keyboard or gamepad. Just put everything to your liking; however, there are keys I want you to take note of.

  • Navigation arrows: Here, I highly recommend using the “arrow keys” on your keyboard.
  • The Start button.
  • The “A” button.

Once done, the screen will automatically select the “OK” button at the bottom. Press the key you mapped to the “A Button” to save your configurations and exit this window.

Fix Bluetooth Compatibility on RetroPie

This is the step most guides skip, and it’s usually why people struggle with pairing. By default, RetroPie doesn’t play well with Xbox controllers over Bluetooth due to something called ERTM (Enhanced Re-Transmission Mode).

Now, let me assume you are already at this window below.

retropie

You need to disable ERTM first before proceeding:

  • Press F4 on the keyboard to open the terminal.
    This closes EmulationStation and drops you straight into the Linux command line.
  • Type the command below:sudo nano /opt/retropie/configs/all/autostart.sh
  • Add this line at the top, before everything else:sudo bash -c 'echo 1> /sys/module/bluetooth/parameters/disable_ertm'
  • Save and exit (Ctrl + X, Y, Enter).
  • Reboot your Raspberry Pi.

This fix runs every time the Raspberry Pi starts, so you won’t have to repeat it.

Pair the Xbox Bluetooth Controller

Now, let’s get to the fun part. Put your Xbox controller into pairing mode.

Press and hold the Sync button for about three seconds until the Xbox logo starts blinking rapidly. The Sync button is the small button located at the top of the controller near the USB port. This indicates the controller is now discoverable.

On the RetroPie desktop, press the key you marked as Button A to launch the main menu. You will see a screen similar to the image below.

Use the arrow keys to select Bluetooth, then Button A.

Now, something unique might happen here. If your system doesn’t have the necessary Bluetooth packages, it will first drop to the terminal, prompt you to enter the password, and then proceed to download the needed dependencies.

Once done, it will automatically open the screen below.

configure_bluetooth

Use the arrow keys to select “Pair and Connect to Bluetooth Device” and hit “Enter.” Your Xbox Wireless Controller should appear in the list. Select it, and when prompted with a Yes/No confirmation, select Yes.

configure_xbox_controller

If everything goes well, the Xbox logo will stop blinking and stay solid. Your controller is now paired.

Configure Input Using the USB Xbox Controller

After successfully connecting the Xbox Wireless controller, use the keyboard to navigate back to the RetroPie desktop screen. Once you are here, press the key you mapped as the “Start Key” on your keyboard. Don’t use the Xbox wireless controller yet.

This will open a different kind of menu than the one we used to configure Bluetooth. Use the arrow key to select “CONFIGURE INPUT” and hit “Button A” on your keyboard.

configure_input

In the configuration screen, you should now see “2 GAMEPADS DETECTED.” Now, from this point, pick your wireless Xbox controller and press and hold one button to open the button mapping screen. Now, map every button as you wish.

configure_gamepad

Here’s something I ran into myself. The first time you go through the button mapping wizard, some buttons may not register. If that happens, don’t panic. Just hold down any button to skip the undetected ones and complete the wizard. Then go back and repeat the configuration. The second round usually picks up everything correctly.

map_gamepad_buttons

Once you are done mapping, select the “OK” button below and hit “Button A” on your new gamepad (Xbox Wireless controller), and you can get started with playing games on your Raspberry Pi.

Note: If your controller keeps disconnecting or won’t pair at all, double-check that ERTM is properly disabled and that your controller firmware is up-to-date.

Connect an Xbox Controller to Recalbox

Recalbox is a free operating system that is dedicated to retro gaming. It comes with an intuitive user interface and some very interesting gimmicks and animations.

One thing I really love about Recalbox is its built-in support for 100+ consoles, handhelds, and computers. Therefore, you can play games from virtually every major gaming era. I am taking on the likes of Atari 2600 classics and NES titles all the way to PlayStation 1, Nintendo 64, and even arcade cabinets via MAME and FinalBurn Neo.

If you haven’t installed RecalBox yet or are facing any issues, please look at our Beginner’s Guide for RecalBox on Raspberry Pi.

Fix Bluetooth Compatibility on Recalbox

Just like you did with RetroPie, Recalbox also needs a small fix before it can pair with an Xbox controller over Bluetooth. The good news is you only do this once, and after that, it’s smooth sailing.

The actual culprit, as I showed you in the other systems (RetroPie and Lakka), is ERTM.
ERTM needs to be disabled in order to connect a wireless Xbox controller to RecalBox.

Unfortunately, you cannot do this from the graphical user interface. It doesn’t have a simple toggle button that you can use. Instead, you will need to get your hands dirty and execute a few commands from the terminal, as I will show you below.

Tip: If you search online, you’ll see suggestions like using F4 or ALT + F2 on your keyboard to switch to the terminal. Unfortunately, that didn’t work for me. Instead, I had to connect RecalBox to the internet and then access it via SSH.

Follow the steps below to connect RecalBox to a WiFi network:

  • Press ENTER on your keyboard to open the main menu.
  • Use the arrow keys to select “Network Settings.”
  • On the next screen, select your WiFi network, enter the password, and connect.
  • You can also see the IP address from this screen. Note it down since we will need it to create an SSH connection to RecalBox.
  • To connect to RecalBox via SSH, you will use the credentials below:
    username: root
    password: recalboxroot
  • Once logged in, run the command below to remount the filesystem with write permissions:
    mount -o remount,rw /
  • Next, use the command below to create the Bluetooth config file.
    nano /etc/modprobe.d/bluetooth.conf
  • In the new file that opens, type the following line to disable ERTM. You can just copy and paste it from here to avoid any errors:
    options bluetooth disable_ertm=Y
  • Save the file using CTRL + S and exit using CTRL + X.
  • Reboot RecalBox using the command below to apply the changes.
    reboot

Once your RecalBox is up, you can proceed to connect the Bluetooth controller.

Pair the Xbox Bluetooth Controller

The first thing you need to do is put your wireless Xbox controller into pairing mode.

Press and hold the Xbox logo button for about 3 seconds. Next, press and hold the Sync button (the small button next to the USB port) for 3 seconds until the Xbox logo starts flashing rapidly. Your controller is now in pairing mode.

Now go to your RecalBox. Press “Enter” to open the “Main Menu.” Use the arrow keys to select “Controller Settings.”

Press “A” on your keyboard to open the controller settings screen. You will see a wide range of options here. Use the arrow keys to select “Pair Bluetooth Controllers.”

Wait a few seconds for your Xbox controller to appear in the list. Once it does, select it using your keyboard and press A to pair. In my case, you can see that RecalBox detected most of the controllers around me.

If pairing is successful, you’ll see a confirmation message, and the Xbox logo on your controller will stop blinking. If it fails, turn off the controller, reboot Recalbox, and try again.

Configure the Controller

Just like Batocera and Lakka, Recalbox maintains a built-in controller database, so your Xbox controller should work seamlessly right after pairing. Personally, I didn’t need to do any button-mapping.

However, if you want to do some button mappings, it’s quite easy. Press the “Enter” key on your keyboard to open the Main Menu. Use the arrow keys to select “Controller Settings.” Next, press “A” to open controller settings.

If you have already connected your Xbox controller, you should see the “Configure Controller” menu. Press “A” to start mapping.

Recalbox uses SNES button naming for its configuration, so don’t let that throw you off. Just match each prompt to the corresponding button on your Xbox controller.

For the Hotkey button (the one used to trigger special commands inside emulators), I recommend assigning it to the Home button (the Xbox logo) on your controller. This lets you do things like save states and access the RetroArch menu mid-game.

Once configured, your Xbox controller is fully set up and will automatically reconnect every time you start Recalbox.


🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Still stuck after following this guide? Drop your question in the RaspberryTips Community — real Pi users answer fast. Post your question here.

Connect an Xbox Controller to Lakka

Lakka is a Linux distribution created for game emulation. It is based on LibreELEC (a tiny Linux distro mostly used for media center projects) and uses RetroArch for its graphical interface.

It’s fast, clean, and handles controllers really well, but pairing over Bluetooth does require a bit of terminal work.

Our comprehensive tutorial on installing and configuring Lakka on Raspberry Pi provides a step-by-step guide and includes some tips and tricks to get your system up and running successfully.

Configure Bluetooth on Lakka

Now, let me be clear: I am not talking about enabling Bluetooth and connecting to a Bluetooth device; you can actually do that easily from the settings. I am talking about disabling ERTM as we did for RetroPie and Recalbox above.

This step will involve executing commands, which can only be done via SSH. So the first step is to enable SSH.

Using your keyboard, use the arrow keys (left & right) to select the “Settings” icon. Then use the “up & down” arrow keys to select the “Services” option as shown below.

Press Enter to open the “Services” options. Use the “Arrow Keys” to select “SSH” and hit “Enter” to enable it. Before leaving this screen, ensure the radio button is enabled as shown below.

If you already know how to get the IP address of your Raspberry Pi, either from the router or any other method, you can go ahead to connect to SSH using the credentials:

  • Username: root
  • Password: root

If you don’t know the IP address, go back to the Lakka main menu and select the first menu. Use the “arrow keys” to select the “information” option, then select “Network Information.” You should see the assigned IP address as shown below.

After connecting to Lakka via SSH from your PC, issue the following commands:

  • Create a new Bluetooth config file:nano /etc/modprobe.d/bluetooth.conf
  • Add this single line to the file:options bluetooth disable_ertm=Y
  • configure_bluetoothSave the file using CTRL + S and close it using CTRL + X.
  • Now reboot the Raspberry Pi:
    reboot

Pair Xbox Controller

If you have done everything above, it’s time to connect the Xbox controller to Lakka.

Press and hold the Sync button for about three seconds until the Xbox logo starts blinking rapidly. The Sync button is the small button located at the top of the controller near the USB port. This indicates the controller is now discoverable.

I did have difficulty connecting to Xbox via Bluetooth from the settings interface. The method that worked for me was connecting from the terminal, as I will show you below.

First, connect to Lakka via SSH and run the command below to start the Bluetooth service:
bluetoothctl

Once inside the bluetoothctl prompt, run the following commands in order:
agent on
default-agent
power on
discoverable on
pairable on
scan on

enable_bluetooth

After a few seconds, your Xbox controller should appear in the scan results with a device address that looks something like 44:91:7C:A4:9B:5E. Once you see it, stop the scan by running the command below:
scan off

Now, pair and connect to the controller using the commands below:
pair 44:91:7C:A4:9B:5E
connect 44:91:7C:A4:9B:5E
trust 44:91:7C:A4:9B:5E

pair_controller

You should see a confirmation showing the device as connected and paired. If it doesn’t work on the first try, don’t be discouraged. Trying a second time usually does the trick.

Configure the Controller

Now this is why I love Lakka. Just like Batocera, you don’t need to manually map every button for each new controller. Lakka comes with built-in support for the most popular controllers — no button mapping wizard required.

After successfully connecting my Xbox wireless controller via Bluetooth, it started working immediately, and I was actually able to use it to navigate the Lakka interface.

That said, you might want to tweak the button layout to better suit your preference, or perhaps a button or two isn’t responding as expected. To achieve that, navigate to the “Settings” menu and scroll down to the “Input” option.

From here, you can remap any button on your controller to a different input. Simply select the button you want to change, press Enter, then press the physical button on your Xbox controller you want to assign to it.

Once you are happy with your layout, back out to the main menu, and your changes will be saved automatically.

Tip: If your controller shows as connected in bluetoothctl but still doesn’t respond in Lakka, try running the “connect” command before “pair.” Some Xbox controllers respond better to that order.

And that’s it! Whether you went with RetroPie, Recalbox, Lakka, or Batocera, you should now have your Xbox wireless controller fully connected and ready for some retro gaming action.

Each of these frontends has its own personality. RetroPie gives you the most control and customization, Recalbox and Lakka keep things clean and simple, and Batocera works beautifully right out of the box.

If you are not an Xbox person, we have got you covered, too. Check out our guide on how to connect a PS4 controller to RetroPie.

If you run into any issues along the way, drop a comment below, and I will be happy to help out.

Not getting the same result?

Even when you follow every step, small differences in OS version, hardware or config can change the outcome. Instead of wasting time guessing, get help from people who have already fixed the same kind of issue.

Ask your question now
🔒 No risk. Cancel anytime.
  • Get help on your exact issue
  • Access step-by-step videos for tricky setups
  • Browse the website without ads

Similar Posts

Leave a Reply

Community members only
Comments are reserved for RaspberryTips Community members. Join the community to ask questions, get help, and interact with other Raspberry Pi users.

Join the community  or  log in