element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Interfacing PS3 with ESP32
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: skywalker1211
  • Date Created: 22 Oct 2019 9:49 AM Date Created
  • Views 11236 views
  • Likes 4 likes
  • Comments 0 comments
  • esp32
  • arduino tutorials
  • ps3_controller
Related
Recommended

Interfacing PS3 with ESP32

skywalker1211
skywalker1211
22 Oct 2019

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:

image

 

to esp32 arduino uno.

image

 

Start with esp-idf and ESP32-DevKitC.

image

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

imageimage

 

2. clone ps3 component to esp-idf.

image

 

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

imageimageimage

 

5. compile and flash into esp32 devkit

image

 

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

image

 

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");


    ps3SetEventCallback(controller_event_cb);
    uint8_t new_mac[8] = {0x11,0x22,0x33,0x44,0x55,0x66};
    ps3SetBluetoothMacAddress(new_mac);
    ps3Init();


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

 

 

With Arduino

the steps is surprisingly simple.

just follow what from jvpernis here

https://github.com/jvpernis/esp32-ps3/issues/3

things is done.

1. add package esp32 json into additional board manager

image

 

2. install esp32 board to arduino ide

image

3. download ps3 arduino library and add zip library

https://codeload.github.com/jvpernis/esp32-ps3/zip/develop

 

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

image

 

 

source code:

 

#include <Ps3Controller.h>


void setup()
{
    Serial.begin(115200);
    Ps3.begin("11:22:33:44:55:66");
    Serial.println("Ready.");
}


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");
    }
  }
}

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube