XBOX Controller Controller
What is this? It's a system that will allow basically anything that can talk
udp to control an Xbox.
Why would you want to do this? I have no idea. I have my reasons, maybe you have some too.
How this works: The XBOX buttons are physically pressed by arms (stiff wire) attached to servos that are controlled by a Basic Stamp 2. The BS2 is controlled by a gumstix over a serial port. The gumstix talks udp and accepts commands. So if you want to control an xbox, you basically have to talk a simple udp protocol to the gumstix.
For this I tried 2 controllers, a PSP and a Nintendo DS. The udp protocol is simple. Build a message with the status of your controller, and the system takes care of moving the physical fingers on the xbox controller. The protocol is as follows: '!!' for start of message, and '##' for end of message. The juice of the message is a 1 character button identifier, followed by a 1 byte state. 1 means the button is pressed and 0 means button is not pressed. Here is a sample message:
The message should be self explanatory. So the controller (in this case the psp or nds) polls inputs every so often and then dumps the state. I had it all working at every 100ms, but then something happened - not sure what - so I backed it down to every 250ms. The bottle neck is on the BS2, and to keep things consistant, I just kept all polling intervals the same.
The app on the gumstix consists of 2 threads. One listens for udp commands and the other babbles out the serial port at 38.4k. The serial thread wakes up every 250 ms and sends the status of all buttons to the BS2. The status is stored in global variables that are updated by the udp thread whenever the controller sends an update.
The serial protocol to the BS2 is simple. A 'A' signifies a start of message followed by 8 bytes of status for each of the buttons currently supported. The PIC decodes this message and tells the servos to respond accordingly.
Please try this at home!
Video of it in action
Basic Stamp 2 Source
PSP Controller Code
NDS Controller Code
Word Doc Describing this
Short PowerPoint Presentation
Interfacing to an XBox Controller
This page will outline using a PC to control an XBox. Currently I have software that will control the xbox by wiring into the controller itself. This project is slightly different as it will control the xbox controller without opening the controller.
The Hardware Design is as follows:
The Software Design is as follows:
The PC will be running Windows XP. The Xbox Controller Controller will be running linux installed on a Gumstix Board. The PC will communicate with the gumstix over a tcp/ip link using my own protocol. When signaled by the PC to press buttons on the controller, the Gumstix will trip a relay which will activate a solenoid which will then press the corresponding button on the XBox Controller.
The project will be completed by following the timeline below
- Implement TCP/IP Protocol between PC and Gumstix
- Gumstix to trigger relays
- Relays to trigger Solenoids
- Mount Solenoids on controller
I have preliminary comms going between my VB controller simulator and my linux server. The server will eventually be running on the GumStix. The code should port over nicely, but for now its just running on a linux box. You can download the simulator and the server source code if you want to. Keep in mind this is a work in progress!
I also got part of the microcontroller piece to work. Instead of using solenoids, I decided to use servos and controlling them with the Basic Stamp 2 is very easy. Heres some code to control 1 servo (I need 9)
Currently I have only 1 concern. I am having issues with the reliability of the WIFI link of the GumStix. For the wifi I am using a Compact Flash 802.11b adaptor, but it will only stay connected for a few seconds before I need to reinsert the card... Not really sure what is going on here. I might try another card and see if that helps anything...
The screenshot below shows coms running. The VB app polls the controller every 100 ms and then sends their state to the linux box. Currently the linux box receives the commands and just prints them to the screen. Fairly soon the linux box will decode the message, and format another message for the BS2 to receive which will drive the servos.