PlayStation 2 Controller Arduino Library v1.0
The first fully working version (v1.0) is now available. I split this into a new blog post, as many things have changed.
The big change is you can now define what pins of the Arduino are used, no longer are you tied to pins 10-13.
Also, vibration (Rumble) and analog button pressure readings (how hard is a button being pressed) are now working.
The library has changed names. PSX -> PS2X to avoid confusion with other sets of code. Sorry for those that need to change a bunch of their programs.
I had to rewrite a lot of code that powers the library, there is not much left of the original code written by Shutter of Arduino forums. There were many bug fixes, now the controller should automatically be in analog mode, and the mode button should be locked. There’s also a catch to make sure not to much time has past since the last controller reading. If there was, it will configure the controller again, in case it timed out.
Download here:
Old Versions:
For those who missed the excitement the first time, here’s a wiring diagram(from the amazing CuriousInventor PS2 Interface Guide) and demonstration video:
Image Source: CuriousInventor
Here’s a video demonstrating the library.
Hi Bill,
I did change CLK line from pin 13 to 9 and it worked great. I had noticed the LED tied to PIN 13 was constantly going HIGH/LOW so this resolved that issue. It is still not constantly detecting the controller so I can only assume I may need to try a different resistor. On another note, I am trying to program a VB.NET app to read the data from the arduino through the virtual com. I am using Firmata.dll as the intermediary to create the connection but I’m not sure how to read the data. I was wondering if you have a reference or familiarity with this? Thanks
Here’s something interesting I noticed – the controller won’t be detected if analog mode is already on. Caused a lot of head-scratching!
Hmm, I thought I considered all states in the initial check, but I’ll have to go back and see if I implemented it right. If there is a bug, I’ll fix it in the next release. Thanks for the report!
Nice. I tested the code (v1.3) and it returns an error level2 “controller found but can’t communicate”. I then removed the error check and it works nicely. So this lib could work on psx as well.
Grehe, i’m having a hard time understanding you. Are you telling me that you were trying my lib with a PS1 controller, but the error check is wrong? OR did this happen with a PS2 controller?
Bill,
I changed a few minor things (button definitions, ‘analog’ mode check) in your code and I’d like to recontribute my changes. Is there an e-mail address where I can send my zip file?
Sure. bill@[this website's address] will do. (I avoid putting the whole address to keep spam bots from sniffing it)
I have already fixed the analog mode check, but i’ll take a look at what you have.
Updated to 1.4. Fixed controller not detected if in analog or pressures mode now.
Thanks to Eric for contributions.
Updated to 1.41. Some simple bug fixes and added keywords.txt file.