Monday, March 25, 2013

PS2 Controller Emulation

I finally ran into some success at this point :).
On the teensy project page, I found the blog of someone who was using a PS2 controller along with a capture card to teach his computer to Autonomously play Guitar Hero using a Teensy2. He emulated the SPI protocol (used by the PS2 controller).

I ordered:
PS2 extension cables $4.34
PS2 -> 360 controller adapters $8.50
project enclosures (3"x2"x1") $3.50
teensy2 (i already had this but I'm including it here anyway) $19

Total: ~$35 before shipping

You will also need a mini USB cable. I used a regular one and just made a hole in the side of the project box for it.

I was able to successfuly control my xbxo with one minor change.
The program that makes the Teensy2 emulate a PS2 controller allows three different modes. Digital only (3 byte record), Digital buttons & analog joysticks (7 byte record), and all analog (19 byte record).

Apparently the adapter I used falsely indicates it accepts analog button presses, but then indicates the 12 bytes of analog button data as additional 7 byte reports. So i had to change the Teensy2 program to only send the 7 byte report, even if it was reported as supporting the analog buttons.

With that change it was working great.
There were three limitation of the PS2->360 adapter however:
It is a little bit finicky in terms of resetting. It will not properly sync up with the 360 if the PS2 controller/teensy is already connected to it. So that needs to be removed before it is connected to the 360, and then reconnected after the 360 controller has been recognized.
It can only be used with a vanilla wired 360 controller. It will not work guitars, steering wheels, etc at least as far as I tested. I am not sure how it would behave with an off brand controller (Gamestop, etc) as I didn't have any at that time.
You can only use 1 at a time. Something seems to be hard-coded in there. If you attach a 2nd adapter, it will take over the controller # of the 1st one, and the 1st one will no longer function.

No comments:

Post a Comment