Playstation 2 Controller

Playstation 2 Controller

This example will show how to use the Playstation 2 Controller (PS2) with the Raspberry Pi.  We use the Arduberry to adapt the shield to the Raspberry Pi.

Hardware Required:

  1. Raspberry Pi
  2. Arduberry
  3. Dexter Industries Playstation 2 Controller Shield for Arduino
  4. A Playstation 2 controller or a similar clone (Please Check thewiki for the compatible clones)

 

 

Step 1

Stack the PS2 controller connector to the PS2 shield and slide the shield on to the Arduberry. Slide the Arduberry on to the Raspberry Pi and power it on.

Dexter Industries Arduino and Raspberry Pi and PS2 Controller Shield

Step 2

Clone the library from the Github Repository to /usr/share/Arduino/libraries.

cd /usr/share/arduino/libraries
sudo git clone https://github.com/DexterInd/Arduino-PS2X.git

Rename the library from  ArduinoPS2X to Arduino_PS2X

sudo mv Arduino-PS2X/ Arduino_PS2X/

clone

Step 3

Open Arduino, and open the example PS2X_Example from the Arduino_PS2X folder. Change the programmer to Raspberry Pi GPIO and upload the sketch to the Arduberry(use Ctrl+Shift+U).

upload4

exampleStep 4

The data that is coming from the PS2 shield is coming at 57600 baud, so we need to configure minicom. FollowAccess the Serial port using minicom guide to change the baud rate to 57600.

serial_settingsStep 5

Make sure that the controller is connected to the Arduino shield and switched on. Press reset on the Arduberry to start receiving the data.

ps2_data

The PS2 Controller is now ready to be used in any project that you like.

Dexter Industries Arduino and Raspberry Pi and PS2 Controller Shield

Have a question?  Post it on the forums and we’ll help you out.