Files
ps2-arduino/README.md
T
2025-05-10 20:27:08 +02:00

28 lines
2.5 KiB
Markdown

# Arduino PS2 Controller Adapter
## What's This?
This is a sketch for an Arduino Pro Mini-based adapter that converts DualShock 2 controller signals into XInput! This way, you can use PS2 controllers on any PC without extra software.
I also designed a 3D-printable case for the adapter, which you can find [here](https://www.printables.com/model/1291488-arduino-ps2-xinput-adapter)!
## Required Hardware
The linked parts are only references; feel free to use any compatible hardware or to edit the sketch to suit your hardware. No affiliate links.
- [Arduino Pro Mini](https://www.amazon.de/dp/B0CSK6FWSK)
- Microswitch to reset the Arduino
- [PS2 controller extension cable](https://www.amazon.de/dp/B07WT6RH72) (you'll need to cut off the female end of this cable to solder its wires to the Arduino)
- [0.96in display](https://www.amazon.de/dp/B0CFFB62F4) (optional)
## Diagram
![A diagram showing how to connect a PS2 controller female connector and peripherals to an Arduino Pro Micro](pinout.webp)
## Note on Flashing
Flashing the XInput library makes the Arduino unresponsive to further flashing. In order to flash new sketches, you'll need to manually reset the board. You'll need to perform steps 4-6 on every flash as long as you have the Arduino configured for XInput. Find more information about this [in the readme of the Arduino XInput library](https://github.com/dmadison/ArduinoXInput_AVR?tab=readme-ov-file#upload-warning-and-instructions).
1. Wire a switch between GND and RST to act as a reset switch
2. Enable verbose output on upload in `Arduino IDE -> File -> Preferences`
3. Select the COM port of the board and the corresponding board type as provided by the XInput library. For me, this was `Arduino Leonardo w/ XInput`
4. Press "Upload"
5. Once the notification in the bottom right says "Uploading", press the reset switch twice in quick succession
6. On success, the output window should print out data, concluding with "avrdude done. thank you."
## Required Libraries
- [PS2X library](https://github.com/madsci1016/Arduino-PS2X) for interpreting the controller's signals
- [ArduinoXInput_AVR library](https://github.com/dmadison/ArduinoXInput_AVR) for sending XInput commands via an Arduino Pro Micro
- [Adafruit_SSD1306 library](https://github.com/adafruit/Adafruit_SSD1306) for display output
## Further Useful Links
- [PS2 controller wire diagram](http://www.billporter.info/2010/06/05/playstation-2-controller-arduino-library-v1-0/) by Bill Porter
- [Gamepad Tester](https://hardwaretester.com/gamepad) for testing the controller in a web browser