Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Yes—you can use an Xbox controller to operate a Raspberry Pi robot, camera rig, servo, relay, or other project. Start with a wired USB connection for the least troubleshooting. For wireless control, pair a Bluetooth-capable Xbox One S-generation or Xbox Series X|S controller; many of these work best with the Linux xpadneo driver. Do not assume the Microsoft Xbox Wireless Adapter is plug-and-play on Raspberry Pi: it uses a proprietary protocol and may require a separate Linux driver.

The reliable architecture is controller → Linux input device → Python (Pygame or evdev) → project logic → GPIO, motor driver, servo controller, serial link, or network API. Never connect motors directly to Raspberry Pi GPIO.

Identify the controller before choosing a connection

“Xbox pad” covers several materially different devices:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Xbox 360: normally USB, or a compatible wireless receiver; do not assume Bluetooth.
  • Early Xbox One: some revisions do not include Bluetooth.
  • Xbox One S and later revisions: generally the relevant Bluetooth-capable generation.
  • Xbox Series X|S: uses Bluetooth Low Energy (BLE). It can work on Linux, but latency or choppy input is reported with some combinations of controller, adapter, kernel, firmware, and driver.
  • Xbox Adaptive Controller: supports USB, Bluetooth, and Xbox Wireless, but Microsoft’s published requirements emphasize Xbox and Windows. Treat Raspberry Pi use as an experimental Linux setup rather than first-party support.

Check the label, model number, connector, and whether the controller has a Bluetooth-pairing button before following Bluetooth instructions. A controller that works wirelessly with an Xbox may be using Xbox Wireless rather than Bluetooth.

#1 Best Overall
Sale
XBOX Wireless Gaming Controller | Shock Blue | Consoles, PCs, TVs, mobile, and more | Textured Grip | Wireless, Bluetooth, USB-C Connectivity
  • MODERNIZED DESIGN — Experience the modernized design of the XBOX Wireless Controller with sculpted surfaces and updated geometry that enhances comfort and control during long gaming sessions.
  • PRECISION PERFORMANCE — Stay on target with a hybrid D-pad and textured grips on triggers, bumpers, and back case for improved accuracy and handling.
  • SHARE BUTTON: Seamlessly capture and share content such as screenshots, recordings, and more with the new Share button.
  • VERSATILE CONNECTIVITY — Connect via USB-C for plug-and-play on console and PC, or quickly pair and switch between supported devices with XBOX Wireless and Bluetooth support.
  • BUILT-IN AUDIO SUPPORT — Plug in compatible headsets using the 3.5mm audio jack for direct voice chat and immersive in-game sound.

Choose USB, Bluetooth, or Xbox Wireless

Method Advantages Trade-offs Best use
USB data cable No pairing; stable; usually low latency; easiest diagnosis Cable limits movement; charge-only cables do not expose a gamepad First setup, bench testing, latency-sensitive machines
Pi’s Bluetooth Wireless and requires no extra adapter Model-sensitive pairing, driver, interference, and BLE behavior Robots, camera rigs, mobile projects
USB Bluetooth adapter Can improve adapter placement or compatibility Extra hardware and possible onboard-Bluetooth conflicts Pis with problematic or poorly placed Bluetooth
Xbox Wireless Adapter Uses Microsoft’s Xbox Wireless ecosystem Proprietary protocol; Linux drivers and availability are more complicated Advanced users with a specific adapter requirement

For a new project, USB is the fastest route to a known-good prototype. Move to Bluetooth once the Python and hardware logic works.

Hardware and software prerequisites

  • Raspberry Pi 3, 4, or 5 with onboard Bluetooth, or a compatible USB Bluetooth adapter. Raspberry Pi hardware documentation lists Bluetooth on major Pi 3/4/5 models; a Pi Zero 2 W can work, but every controller/driver combination is not equivalent.
  • Current Raspberry Pi OS packages, reliable Pi power, and internet access for installation.
  • A known data-capable USB cable for fallback testing.
  • A motor driver, HAT, servo controller, relay board, or other interface rated for the load. GPIO is a signal interface, not a motor power source. See the Raspberry Pi GPIO documentation.
  • A physical emergency stop or other way to disable moving hardware.

Connect and test over USB first

Plug the controller into the Pi with a data cable, then inspect Linux:

ls /dev/input/

You may see a joystick node such as /dev/input/js0, but numbering is not permanent. Other input devices can change it. Install a quick diagnostic:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt update
sudo apt install joystick
auto=$(ls /dev/input/js* 2>/dev/null | head -n 1); echo "$auto"
# Replace the path below with the device you actually found
jstest /dev/input/js0

Move each stick, press every button, and squeeze both triggers. If nothing changes, the cable may be charge-only or the controller may not expose USB input in its current mode.

Bluetooth pairing on Raspberry Pi OS

For Bluetooth-capable Xbox One S-generation and Series controllers, install the prerequisites and, where needed, xpadneo:

sudo apt update
sudo apt install dkms raspberrypi-kernel-headers git
git clone --branch v0.10.2 --depth 1 https://github.com/atar-axis/xpadneo.git
cd xpadneo
sudo ./install.sh
sudo reboot

v0.10.2 is a snapshot-based example. Check the project’s current release and instructions before installing because kernel-driver procedures can change.

After reboot, put the controller into pairing mode by holding its pairing button until the Xbox logo flashes rapidly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Xbox Wireless Gaming Controller | Deep Pink | Consoles, PCs, TVs, mobile, and more | Textured Grip | Wireless, Bluetooth, USB-C Connectivity
  • MODERNIZED DESIGN — Experience the modernized design of the XBOX Wireless Controller with sculpted surfaces and updated geometry that enhances comfort and control during long gaming sessions.
  • PRECISION PERFORMANCE — Stay on target with a hybrid D-pad and textured grips on triggers, bumpers, and back case for improved accuracy and handling.
  • SHARE BUTTON: Seamlessly capture and share content such as screenshots, recordings, and more with the new Share button.
  • VERSATILE CONNECTIVITY — Connect via USB-C for plug-and-play on console and PC, or quickly pair and switch between supported devices with XBOX Wireless and Bluetooth support.
  • BUILT-IN AUDIO SUPPORT — Plug in compatible headsets using the 3.5mm audio jack for direct voice chat and immersive in-game sound.
sudo bluetoothctl
power on
agent on
default-agent
scan on

When the controller appears, note its Bluetooth MAC address, stop scanning, and pair:

scan off
pair XX:XX:XX:XX:XX:XX
trust XX:XX:XX:XX:XX:XX
connect XX:XX:XX:XX:XX:XX
quit

The logo should stop flashing or remain steadily lit. Confirm both Bluetooth state and input-device creation:

bluetoothctl devices
bluetoothctl paired-devices
ls /dev/input/

Being listed by bluetoothctl proves pairing only. It does not prove that a kernel driver loaded, a joystick event node exists, or that Pygame can read every control.

Read the pad in Python with Pygame

Pygame is the most approachable option for interactive projects. Install it with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt install python3-pygame

Run this event inspector before writing motor or GPIO code:

import pygame

pygame.init()
pygame.joystick.init()

print(f"Controllers found: {pygame.joystick.get_count()}")
if pygame.joystick.get_count() == 0:
    raise SystemExit("No controller detected")

pad = pygame.joystick.Joystick(0)
pad.init()
print("Name:", pad.get_name())
print("Axes:", pad.get_numaxes())
print("Buttons:", pad.get_numbuttons())
print("Hats:", pad.get_numhats())

try:
    while True:
        for event in pygame.event.get():
            if event.type == pygame.JOYAXISMOTION:
                print("axis", event.axis, event.value)
            elif event.type == pygame.JOYBUTTONDOWN:
                print("button down", event.button)
            elif event.type == pygame.JOYBUTTONUP:
                print("button up", event.button)
            elif event.type == pygame.JOYHATMOTION:
                print("hat", event.hat, event.value)
            elif event.type == pygame.JOYDEVICEADDED:
                print("controller connected")
            elif event.type == pygame.JOYDEVICEREMOVED:
                print("controller disconnected")
finally:
    pygame.quit()

Record the numbers reported by your own controller. Button and axis indices can change with controller generation, USB versus Bluetooth, driver, SDL/Pygame version, and operating-system image. A common starting dictionary might be:

BUTTON_A = 0
BUTTON_B = 1
BUTTON_X = 2
BUTTON_Y = 3

Those are placeholders, not a guaranteed Xbox mapping.

Rank #3
Sale
Xbox Wireless Gaming Controller | Electric Volt | Consoles, PCs, TVs, mobile, and more | Textured Grip | Wireless, Bluetooth, USB-C Connectivity
  • MODERNIZED DESIGN — Experience the modernized design of the XBOX Wireless Controller with sculpted surfaces and updated geometry that enhances comfort and control during long gaming sessions.
  • PRECISION PERFORMANCE — Stay on target with a hybrid D-pad and textured grips on triggers, bumpers, and back case for improved accuracy and handling.
  • SHARE BUTTON: Seamlessly capture and share content such as screenshots, recordings, and more with the new Share button.
  • VERSATILE CONNECTIVITY — Connect via USB-C for plug-and-play on console and PC, or quickly pair and switch between supported devices with XBOX Wireless and Bluetooth support.
  • BUILT-IN AUDIO SUPPORT — Plug in compatible headsets using the 3.5mm audio jack for direct voice chat and immersive in-game sound.

When evdev is a better fit

evdev reads Linux input events directly and suits headless daemons or services that do not need a Pygame window. It is lower-level: you must handle device discovery, permissions, event codes, and reconnects yourself. Use Pygame for a first prototype and evdev when direct event control is worth the extra plumbing.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Example: button to an LED

GPIO Zero is included with Raspberry Pi OS and provides simple on(), off(), and toggle() methods:

import pygame
from gpiozero import LED

led = LED(17)  # BCM GPIO numbering; verify your wiring
pygame.init()
pygame.joystick.init()

if pygame.joystick.get_count() == 0:
    raise SystemExit("No controller detected")
pad = pygame.joystick.Joystick(0)
pad.init()

try:
    while True:
        for event in pygame.event.get():
            if event.type == pygame.JOYBUTTONDOWN and event.button == 0:
                led.toggle()  # Confirm button 0 with the diagnostic program
            elif event.type == pygame.JOYDEVICEREMOVED:
                led.off()
                print("Controller disconnected")
finally:
    led.off()
    pygame.quit()

Use the correct physical pin and numbering scheme, include a resistor for an LED, and never connect a load that exceeds GPIO electrical limits.

Map an analog stick to a robot

Typical driving uses left-stick vertical for forward/reverse and horizontal for steering. Filter the stick’s noisy center, clamp the result, and mix it into left and right motor commands:

def clamp(value, low=-1.0, high=1.0):
    return max(low, min(high, value))

def apply_deadzone(value, deadzone=0.12):
    if abs(value) < deadzone:
        return 0.0
    sign = 1 if value >= 0 else -1
    scaled = (abs(value) - deadzone) / (1.0 - deadzone)
    return sign * scaled

def tank_mix(forward, turn):
    return clamp(forward + turn), clamp(forward - turn)

Convert the returned values to the PWM and direction signals expected by your motor driver. Use a purpose-built driver or HAT—for example, a motor-control board such as Adafruit’s Raspberry Pi DC/stepper HAT—with a separate, suitably rated motor supply where appropriate. The Pi should provide control signals, not motor current.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Triggers require calibration

Triggers may appear as separate axes, and their ranges vary. Some report approximately -1.0 to 1.0; others report 0.0 to 1.0. A released trigger can even sit at -1.0. Observe your diagnostic output first, then adapt:

def normalize_trigger(value):
    # Correct only if your observed range is -1..1.
    normalized = (value + 1.0) / 2.0
    return max(0.0, min(1.0, normalized))

Make moving hardware fail safe

A controller disconnect must stop motion, not leave the last PWM command active. Add all of these:

Rank #4
Sale
Xbox Wireless Gaming Controller | Ice Breaker Special Edition | Consoles, PCs, TVs, mobile, and more | Textured Grip | Wireless, Bluetooth, USB-C Connectivity
  • BREAKER SERIES — Hold nothing back. Ice Breaker keeps it forever fresh with a mix of iced and frosted blues. Part of the collective debut of the Breaker special edition series.
  • BOLD STYLE, BUILT TO PERFORM — Define your swagger with a wild, head-turning design. Stay elegantly on target with textured triggers built for every moment.
  • RUBBERIZED GRIPS — Hold on to the action with rubberized grips on the back cases, designed for comfort and control during long gaming sessions.
  • UP TO 40 HOURS OF BATTERY LIFE — Get up to 40 hours of battery life so you can keep playing without stopping to recharge.
  • PLAY ACROSS EVERY SCREEN — Quickly pair with, play on, and switch between devices including console and PC. Stream games across mobile, gaming handhelds, Smart TVs, and supported VR headsets with XBOX Cloud Gaming.
  • Startup with motors disabled.
  • A short command timeout (for example, 250 ms).
  • A disconnect handler that commands a stop.
  • A physical emergency stop.
  • Neutral-stick confirmation before enabling motion.
  • Separate motor power and proper grounding, suppression, and driver current ratings.
import time
COMMAND_TIMEOUT = 0.25
last_controller_event = time.monotonic()

# Update last_controller_event whenever a valid controller event arrives.
if time.monotonic() - last_controller_event > COMMAND_TIMEOUT:
    motors.stop()

Also avoid blocking reads that prevent the timeout from being checked. Test the stop behavior with the robot raised off the ground before allowing wheels or mechanisms to move.

Run a project without a desktop

Develop interactively first, then run the application as a service. Use the actual account name on your installation; pi is not guaranteed:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[Unit]
Description=Xbox controller project
After=bluetooth.target

[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/xbox-project
ExecStart=/usr/bin/python3 /home/pi/xbox-project/main.py
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now xbox-project.service
sudo systemctl status xbox-project.service
journalctl -u xbox-project.service -f

Use absolute paths, make the service stop outputs on shutdown, and consider a stronger dependency or startup retry if Bluetooth is not ready when the service first launches.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting by symptom

It pairs but will not connect

Make sure it is not still connected to an Xbox, phone, or computer. Remove the stored device and repeat pairing:

sudo bluetoothctl
remove XX:XX:XX:XX:XX:XX
scan on

Then use pair, trust, and connect again. The xpadneo troubleshooting guide covers BlueZ behavior, reconnect loops, and model-specific settings.

It connects but no joystick node appears

Check ls /dev/input/, reboot after driver installation, and inspect recent kernel messages:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
dmesg | tail -n 50
sudo apt install evtest
sudo evtest

The controller may exist as an eventN device even when /dev/input/js0 is absent. Confirm the driver and test the event device directly.

Best Value
GameSir G7 Pro Wired Controller for Xbox Series X|S, Xbox One, Wireless Gamepad for PC&Android with TMR Sticks, Hall Effect Analog Triggers, 1000Hz Polling Rate, 3.5mm Audio Jack - Black
  • Tri-mode Connectivity: Wired for Xbox, 2.4G & Wired for PC, and Bluetooth for Android. The G7 Pro supports seamless connectivity across Xbox, PC, and Android. Effortlessly switch between modes using the convenient physical mode switch.
  • TMR Sticks: The G7 Pro features GameSir's Mag-Res TMR sticks, combining Hall Effect durability with traditional potentiometer performance. This advanced technology delivers stable polling rates for smooth, drift-free gaming with low power consumption.
  • Hall Effect Analog Triggers: The GameSir precision-tuned Hall Effect analog triggers provide unmatched smoothness and linear input for precise control. Featuring clicky Micro Switch trigger stops, gamers can easily switch based on their preferences.
  • 1000Hz Polling Rate on PC: Experience ultra-responsive gaming with a 1000Hz polling rate on PC, available through both wired and 2.4G wireless connections. This ensures instantaneous input registration, reducing lag and optimizing your performance for the most competitive gameplay.
  • GameSir Nexus App: The G7 Pro is compatible with the upgraded GameSir Nexus app, which brings a significant upgrade over the original. It introduces powerful new features such as gyro settings, stick curve adjustments, and button-to-mouse mapping, giving you deeper customization and more control than ever before.

Input is laggy or repeatedly disconnects

Investigate distance, interference, power supply quality, multiple Bluetooth devices, controller firmware, adapter BLE support, kernel/xpadneo versions, and power management. xpadneo specifically documents possible choppy or laggy BLE input on some Series controllers. A USB cable is the quickest way to separate wireless problems from application bugs.

Permission denied

Run the program under the intended session user first. If a service needs direct event access, use a narrowly scoped udev rule or an appropriate input-group arrangement after considering its security implications; do not start by granting broad permissions to every input device.

Buttons or axes are wrong

Re-run the event inspector and save a per-device mapping. Never rely on an unverified chart copied from another tutorial; mappings can differ between models, drivers, transports, and SDL versions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Motors continue after disconnect

Treat this as a safety defect. Add the timeout, disconnect stop, physical emergency stop, startup inhibit, and a test that removes the controller’s battery or cable while the robot is safely restrained.

Xbox Wireless Adapter, legacy drivers, and alternatives

The Xbox Wireless Adapter is not Bluetooth. It uses Microsoft’s proprietary Xbox Wireless protocol. Linux projects such as xone target that ecosystem; xow is an older project and should not be presented as a universal current answer. For most Raspberry Pi builds, a Bluetooth-capable controller or wired USB is simpler.

Older guides may recommend xboxdrv. That can remain relevant for particular legacy devices, but it is not a universal modern solution. Confirm the controller generation, kernel support, and driver requirements instead of installing it by habit.

Pi computer or Pico?

A Raspberry Pi computer is the better choice when you need Linux Python libraries, Bluetooth pairing, camera processing, networking, a web interface, logging, or multiple peripherals. A Pico 2/Pico 2 W is a low-cost, low-power microcontroller for deterministic control, but it is not a drop-in Raspberry Pi OS replacement: controller stacks, Bluetooth behavior, camera support, and software architecture differ substantially. See Raspberry Pi’s Pico 2 information and Pi 5 product information for the platform distinction.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Buying guidance

A current Bluetooth-capable Xbox Wireless Controller offers familiar controls and USB-C fallback, but it is relatively expensive for a dedicated robot and still needs batteries or a rechargeable accessory. Microsoft’s official listing describes Xbox, Windows, Bluetooth, and USB use—not a Raspberry Pi support guarantee. Verify the exact model before purchase; prices and color availability change.

For a project bundle, prioritize a reliable wired or Bluetooth-capable pad, a Pi board sized to the workload, a reputable power supply, correctly rated motor or servo hardware, wiring and enclosure, and an emergency-stop solution. A USB Bluetooth adapter is an optional troubleshooting tool, not a guarantee of lower latency.

The Bottom Line

Bottom line: Use USB to prove the controller and project logic, then switch to Bluetooth for convenience. Identify the exact Xbox model, verify Linux events instead of assuming mappings, use xpadneo where appropriate for Bluetooth Xbox controllers, and put a real disconnect timeout between the controller and any moving hardware.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.