Microsoft Xbox 360 Controller Driver Raspbian Jessie

I was looking for a way of controlling my initio robot by remote and having purchased 3 xbox 360’s in the past (red ring of death :( replacements) I have got a few wireless controllers knocking about! I decided re-using one of these was the way forward.

May 11, 2015 - Bluetooth and Raspberry Pi are a natural combination, allowing your Pi to. To the instructions here, and plug in your Bluetooth adapter. Microsoft Xbox 360 Wireless Receiver Driver is licensed as freeware for PC or laptop with Windows 32 bit and 64 bit operating system without restrictions. It is in drivers hardware category and is available to all software users as a free download.


I grabbed a £5 xbox USB wireless receiver (you can get them on Amazon UKUS) and robbed the code from zephods lego pi car project (http://blog.zephod.com/post/37120089376/lego-xbox-raspberry-pi) but I found it to be really unstable, often resulting in a ‘segmentation’ fault within a few minutes – so I decided to write my own.
Zephod’s code used the screen output of xboxdrv (a linux xbox controller driver) to create events which could be interpreted from python. I decided on a different route and (after being shown the way by Dave Honess at Pycon) used pygame to interface with xboxdrv and the controller directly.Microsoft Xbox 360 Controller Driver Raspbian Jessie
I originally just hacked together some code to make my solution work but after asking twitter whether anyone else would find it useful I created a generic python module to allow anyone to incorporate an xbox controller into their projects.
The module works by interpreting the pygame events which xboxdrv creates when the xbox controller is used (button pressed, button released, analogue stick moved, trigger pressed, etc) and keeps track of the values of all the buttons, sticks and triggers on the controller.
These values can be read directly from the properties on the class (e.g xboxController.RTRIGGER) or the values can be passed to your program through the use of call backs i.e. when a button is pressed or a stick moved a function in your program is called and the details about what was changed and what the new value is are passed to it.
Installing and testing the module
If there is demand in the future I will wrap the module into a proper python package, but for the time being its just a separate python file (XboxController.py) which you can add to your python project.
Install xboxdrvMicrosoft xbox 360 controller driver raspbian jessie x
Grab the code from GitHub (github.com/martinohanlon/XboxController) and copy the XboxController.py file to your project:

Download Xbox 360 Controller Driver Windows 10


You need to run xboxdrv before you can use the module, run
You may get an error asking you to run xboxdrv with the option --detach-kernel-driver, if so run:
You can test the module by running the XboxController.py file
When you see the message on the screen saying the controller is running, press a button on your xbox controller.

Using the module
The module is pretty easy to use, but there are a few complex concepts to get your head around such as call backs and threading - first you need to import it into your code:

Download Xbox 360 Controller Driver


Then you can create an instance to the XboxController:
You can adjust the behaviour of the module by passing different parameters:
  • joystickNo : specify the number of the pygame joystick you want to use, usually 0
  • deadzone : the minimum value which is reported from the analogue sticks, a deadzone is good to reduce sensitivity
  • scale : the scale the analogue sticks will report to, so 1 will mean values are returned between -1 and 1, 0 is always the middle
  • invertYAxis : the Y axis is reported as -1 being up and 1 being down, which is just weird, so this will invert it
  • controllerCallBack : pass the name of a function and the xbox controller will call this function each time the controller changes (i.e. a button is pressed) returning the id of the control (what button, stick or trigger) and the current value
You can also add other call back functions so that when specific buttons, sticks or triggers are pressed or moved it will call a specific function, e.g. to add a function which is called when the start button is pressed / released you would used the code:
The XboxController runs in its own thread, so you need to tell the controller to start using
Control values can be read directly from the XboxController while it is running, by using the properties of the class e.g. to read the current value of the right trigger you would use:
The XboxController also needs to be stopped at the end of your program using
For more information about the module, see the code in the the XboxController.py file.
Hi,
I recently acquired a ts 653a and installed Linux Station. I'm trying to connect an Xbox 360 gamepad with the ubuntu version of Linux Station but I can't. I've tried all the usual ways of making this gamepad work on Linux, but:
- Xpad is not installed as a kernel module in Linux Station Ubuntu so I can't use the default driver
- I can't load the xpad version of steam os because modprobe xpad throws me the next error: could not insert 'xpad': opperation not permitted. I think it's because in Linux Station you can't touch the kernel modules.
Microsoft xbox 360 controller driver raspbian jessie mac- xboxdrv throws me an LIBUSB_ERROR_ACCESS without sudo, and with sudo throws me a LIBUSB_ERROR_IO.
I'm using a XBOX wireless adapter which is beeing recogniced by ubuntu because if I do a lsusb the device is there. The controller is not beeing recongnized by Linux Station because the 4 lights don't stop blinking. I tried this on a VM with Xboxdrv and it worked perfectly, the controller was recognized and assigned to one of the four positions in the controller.
Anyone has managed to connect the controller to Linux Station? Any ideas?