Skip to content

Interfacing Wireless PS2 Controller with Arduino


Hi, in this tutorial we’ll try to interface a PS2 wireless controller with Arduino UNO board, it is very interesting since all the controller’s buttons would be inputs for the Arduino board and not only that but also wireless, using 2.4GHz Radio Frequency communication protocol, which can be very useful to control robots, vehicles, servos…

PS2 wireless controller with receiver

I bought this controller with A servo dedicated board for 30 USD, you can get the controller/Receiver much cheaper, but don’t forget that these cheap devices have some problems (you can see it in the video), the sensitivity is not that good comparing it with the original controller, also you may experience some push button problems…

You can learn a lot about this controller visiting this website:


Considering from which side you are observing this is the order I followed, the pins #3 and #8 don’t have a connector at all, also we’re not using the pin #9.

PS2 wireless controller receiver wired with an Arduino UNO board


PS2 wireless controller receiver wired with an Arduino UNO board + LCD i2c screen

Wiring with the usual LCD i2c screen, I used with the code I made.



Here you can download the libraries required for the devices, The LCD i2c library is optional and only used if you are using one:


You can download the code using LCD here, or check below

Code 1: Example from the library

The first code you’ll find it in the library, it shows different functions you can use such as reading the analog stick values, detect if a button is pressed, released or being held…., also it detects which type of controller you are using or showing you an error if there is one.


Code 2: Test with LCD i2c screen

The second code just takes few functions and shows the value or the buttons that are being pressed on the screen, here I only associated printing on lcd screen for every function, but for you, you can control servos, dc motors, LEDs… overall it’s just an example for the tutorial.


Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

12 thoughts on “Interfacing Wireless PS2 Controller with Arduino Leave a comment

  1. brother, I want to do a counter using some axis of the stick to control servos later,
    the problem is that I want to use the value (controlps.Analog (PSS_LY), DEC); and use conditional “if” to increase or decrease said counter.
    when doing this, the “++ or –” operation does not respond, but the function does recognize the real-time position of the stick,
    can you support me to determine the fault ?.

    #include //

    PS2X controlps; // create PS2 Controller Class

    int contadorservo;//—–>counter variable

    void setup() {

    controlps.config_gamepad(13,11,10,12, false, false); // GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error

    void loop() {
    byte vibrate = 0;
    int lectura=(controlps.Analog(PSS_LY), DEC);
    controlps.read_gamepad(false, vibrate);

    if(lectura==0) {contadorservo=contadorservo++;} //condicional only for fast test

    Serial.print(contadorservo); //—–> print the data
    Serial.print(” “);
    Serial.println(controlps.Analog(PSS_LY), DEC);

    Best regards and grace for the support

  2. Hi I’ll take a look to this, do you want to control a servo using the stick? because I have done a project where I control dual axis camera tilt with a ps2x stick.

  3. Try this writing


    Try not to copy/paste this directly it may result in some errors like “stray ‘\342’ in program” and it won’t compile.

  4. brother could you make a post with the code with the project that you tell me, I would like to have a reference with a functional project, the example of arduino has several functions running and on the internet I only find projects using buttons and no stick

    thank you for your support my email is

  5. Controller found but not accepting commands
    DualShock Controller Found

    how to fix that?
    its connected but when i click any button there is no command

Leave a Reply

%d bloggers like this: