Home > Arduino, TKJ Electronics, USB > Xbox 360 receiver added to the USB Host Library

Xbox 360 receiver added to the USB Host Library

You asked for it and here it is.
I finally got the time to implement support for Wireless Xbox 360 controllers to the USB Host Library. This is done via a Xbox 360 Wireless receiver that is normally intended for Windows computers.

The source code can be found at github: https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXRECV.cpp
There is an example as well: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Xbox/XBOXRECV/XBOXRECV.ino.

The receiver supports up to four controllers internally, so it was fairly easy to implement it.

Actually I havn’t tested the library with more than one controller, but if somebody out there could confirm if it’s working or not, with more than one controller, I would really appreciate it!
Thanks to Tim, multiple controllers is now confirmed to work!

If you need to use more than four controllers you will need to connect a second receiver via a USB hub which is also supported by the library.
Simply add the following to the start of your Arduino sketch:

USBHub  Hub1(&Usb);
USBHub  Hub2(&Usb);

Note that you might need to add more instances depending on how many chips there is inside your USB hub.

You will also need to create another instance of the XBOXRECV class like so:

USB Usb;
XBOXRECV Xbox1(&Usb);
XBOXRECV Xbox2(&Usb);

For more information regarding the protocol see the following pages: http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/WirelessUsbInfo and https://github.com/Grumbel/xboxdrv/blob/master/PROTOCOL.

Categories: Arduino, TKJ Electronics, USB Tags:
  1. Igor Figueiredo
    November 11th, 2015 at 22:33 | #1

    Hi Lauszus thanks for the help. but i wrote a code using millis function like you said and it didnĀ“t work well. i just need a code or function that tell to my sketch when the controller connection is lost to put low all output pins that i used. there is another way to do it or just using millis?

  2. November 12th, 2015 at 20:16 | #2

    @Igor Figueiredo
    You can simply use that function to figure out how long time it was since a input report was received. You could just use that to set all output pins to low if it gets above a certain threshold.

  3. Vishal Pusadkar
    February 4th, 2017 at 13:34 | #3

    I want to connect my Xbox 360 wired controller to the arduino how do i connect it

  4. Chris
    March 26th, 2017 at 07:14 | #5

    Hi. Thank you for your efforts on developing this library. I’m using it on a robot project to control servos. Works great for the standard servos, on an Arduino Uno.

    But I’m having some trouble doing a basic digitalWrite to set a pin to LOW…its for a small laser…just want to set it to LOW at first, then switch it on, digitalWrite(laserPin,HIGH) when the ‘B’ button on the Xbox360 controller is pressed.

    The laser & code works fine when I don’t use the XBOXRECV code….

    Any thoughts or suggestions? I’m also having trouble activating the RoboClaw motor controller that I’m using to drive some motors.

    Thanks again,


Comment pages
1 2 3 3791
  1. No trackbacks yet.