I came across this blog, https://github.com/jvpernis/esp32-ps3  showing how to connect ps3 with esp32.

This is a great one as I am looking alternative for USB host shield. To save some IOs and space.

My plan is to change from:


to esp32 arduino uno.


Start with esp-idf and ESP32-DevKitC.

Following setup accordingly. the process is very smooth.

1. connect PS3 controller to PC. write the currently paired MAC address to PS3 controller using SixaxisPairTool.

can set it to any number, this is the mac address of ESP32.

I set it as 11:22:33:44:55:66


2. clone ps3 component to esp-idf.


3. grab a sample project to start with. I start with hello_world sample project.

4. configure project. i may use different version of esp-idf with jvpernis. some options do not appear in my configuration. however, i skip those and it still works. my config as below


5. compile and flash into esp32 devkit


6. pair with ps3 and check serial output from esp32. It works!!


This is just the start of the project. My aim is to do this with arduino IDE. That will come later.


/* Hello World Example

   This example code is in the Public Domain (or CC0 licensed, at your option.)

   Unless required by applicable law or agreed to in writing, this
   software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied.
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "ps3.h"

void controller_event_cb( ps3_t ps3, ps3_event_t event )
    // Event handling here...
    if ( event.button_down.cross )
        printf("The user started pressing the X button\r\n");

    if ( event.button_up.cross )
        printf("The user released the X button\r\n");

    if ( event.button_down.square )
        printf("The user started pressing the square button\r\n");

    if ( event.button_up.square )
        printf("The user released the square button\r\n");

    if ( event.button_down.triangle )
        printf("The user started pressing the triangle button\r\n");

    if ( event.button_up.triangle )
        printf("The user released the triangle button\r\n");

    if ( event.button_down.circle )
        printf("The user started pressing the circle button\r\n");

    if ( event.button_up.circle )
        printf("The user released the circle button\r\n");

    if ( event.button_down.up )
        printf("The user started pressing the up button\r\n");

    if ( event.button_up.up )
        printf("The user released the up button\r\n");

    if ( event.button_down.down )
        printf("The user started pressing the down button\r\n");

    if ( event.button_up.down )
        printf("The user released the down button\r\n");

    if ( event.button_down.left )
        printf("The user started pressing the left button\r\n");

    if ( event.button_up.left )
        printf("The user released the left button\r\n");

    if ( event.button_down.right )
        printf("The user started pressing the right button\r\n");

    if ( event.button_up.right )
        printf("The user released the right button\r\n");

    if ( event.button_down.l1 )
        printf("The user started pressing the l1 button\r\n");

    if ( event.button_up.l1 )
        printf("The user released the l1 button\r\n");

    if ( event.button_down.l2 )
        printf("The user started pressing the l2 button\r\n");

    if ( event.button_up.l2 )
        printf("The user released the l2 button\r\n");

    if ( event.button_down.r1 )
        printf("The user started pressing the r1 button\r\n");

    if ( event.button_up.r1 )
        printf("The user released the r1 button\r\n");

    if ( event.button_down.r2 )
        printf("The user started pressing the r2 button\r\n");

    if ( event.button_up.r2 )
        printf("The user released the r2 button\r\n");

void app_main()
    printf("Hello world!\n");

    uint8_t new_mac[8] = {0x11,0x22,0x33,0x44,0x55,0x66};

    while (!ps3IsConnected()){
        // Prevent the Task Watchdog from triggering
        vTaskDelay(10 / portTICK_PERIOD_MS);
    printf ("connected\r\n");
        vTaskDelay(1000 / portTICK_PERIOD_MS);



With Arduino

the steps is surprisingly simple.

just follow what from jvpernis here


things is done.

1. add package esp32 json into additional board manager


2. install esp32 board to arduino ide

3. download ps3 arduino library and add zip library



4. run sample code, it simply works! brilliant work from jvpernis!



source code:


#include <Ps3Controller.h>

void setup()

void loop()
  if (Ps3.isConnected()){
    if( Ps3.data.button.cross ){
      Serial.println("Pressing the cross button");
    if( Ps3.data.button.square ){
      Serial.println("Pressing the square button");
    if( Ps3.data.button.triangle ){
      Serial.println("Pressing the triangle button");
    if( Ps3.data.button.circle ){
      Serial.println("Pressing the circle button");