I’m a big fan of the Playstation video game consoles, so when I learned about the PS2X library by Bill Porter, I had to try it out. PS2X makes it easy to interface Arduino microcontrollers with Playstation 2 controllers. After wiring everything up and testing it with the sample program, I set out to find something more interesting to do with it. The result is a stepper motor that is controlled by the Sony controller. Here’s a video of it in action:
I used an Arduino Uno to run the program, with an Arduino motor shield to drive the motor. The motor itself is a ~6V bipolar stepper ripped out of an old Okidata line-feed printer. I used an official Sony DualShock 2 controller, connected via a cheap aftermarket extension cord that I cut so I could use it on the breadboard. You may notice the wire colors look wrong, this is because the extension cord colors are in the wrong places vs. the official wiring. An Adafruit 20×4 LCD display with the i2c/SPI backpack provides feedback on button pressure / joystick position and motor RPM.
If you’d like to try it out, and you can download the program here. The motor I used has 7.5 degree steps, so if yours is different, you’ll need to update the code accordingly. And if you don’t plan to use the LCD panel that I used, you’ll want to remove the code for that.
The only problem I’ve seen (as shown in the video) is that PS2X sometimes doesn’t support the analog controls and/or rumble motors when it should. I’ve seen this in both my program and the sample program that comes with the library and I can’t make any sense of it, especially since I’m using an official PS2 controller. It happens enough that I wouldn’t feel comfortable relying on those functions in a project where they would be necessary. Despite these issues, it was still a blast being able to connect a PS2 controller to the Arduino and see what can be done with it.