Using PS3 Controlle...
 
Notifications
Clear all

Using PS3 Controllers with ESP32 | Build Custom Remote Controls

91 Posts
11 Users
9 Likes
7,463 Views
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

@notace 

Not sure, as somewhere I saw a reference that PS4 controllers used a different version of the BlueTooth protocol than that used by PS3 controllers.

SteveG


   
ReplyQuote
(@notace)
Member
Joined: 5 years ago
Posts: 4
 

I found this library in GITHUB, which seems to have the same functionality.

https://github.com/aed3/PS4-esp32

 

Regards
Ron in Melbourne, Australia


   
ReplyQuote
AlanL
(@alanl)
Member
Joined: 3 years ago
Posts: 34
 

@john_b I gave up on clone controllers and purchased a used genuine Sony PS3 controller on Ebay. It onlly cost £14.85 including postage. Got it this morning, Sixaxistool got the mac, changed it to my ESP32 mac, run the demo script and every thing works OK.

Great result!


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

@alanl 

Glad you are finally having some success!

SteveG


   
ReplyQuote
jjs357
(@jjs357)
Member
Joined: 1 year ago
Posts: 30
 

I have built an ESP32 based controller for flying the Tello drone.

See: ESP32 Tello Drone Controller

I wonder if I can interface a PS3 or PS4 game controller to my controller via BlueTooth? I happen to have a genuine Sony PS4 controller on my workshop bench. But I am using an AdaFruit ESP32 Huzzah dev board to make thinks work and Bill uses some other ESP32 board variety in his workshop treatment. Anyone have experience to make Bill's demo work and if so what brand ESP32 and what PS3 or PS4 controller was used to make that happen?

Jim


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6969
 

@jjs357 Very rare for one esp32 to work and another doesn't, they are pretty much all alike with the odd one maybe having more flash or memory. The only tie I got tripped up was with an Arduino NANO clone that had to be set back to an old 168.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
jjs357
(@jjs357)
Member
Joined: 1 year ago
Posts: 30
 

@zander Thanks for the encouragement. Will try and use the ESP32 I have.


   
ReplyQuote
jjs357
(@jjs357)
Member
Joined: 1 year ago
Posts: 30
 

I am trying the code from the workshop out using my Adafruit ESP32 feather.

I can connect the PS3 controller. I am using the clone that Bill referenced in the workshop: got it from US Amazon.

The basic Demo program works. All of the PS3 controller buttons and joysticks work.

Bill suggests trying the Ps3Rumble demo to feel the vibrations in the controller body.

This did not work for me. There is no rumble sensation being emitted on the controller.

While I was typing up this note, I saw an error condition:

16:10:56.861 -> E (422714) PS3_L2CAP: [ps3_l2cap_send_hid] sending command: failed

Then I pushed the on button on the controller and then I did get rumble effects.

So something is different for me compared to Bill.

I will add info here as I discover it.


   
ReplyQuote
jjs357
(@jjs357)
Member
Joined: 1 year ago
Posts: 30
 

The PS3 demo program is supposed to light up the player lights according a binary pattern from 0 to 10. 

I did not see that happening the first time I tried the demo. The PS3 control outputs happen right away as soon as the controller connects to the ESP32 but no player counting. If I press and hold the "on" button then the player lights start to count to 10 BUT from that point on, the ESP32 Serial monitor is no longer reporting data from the PS3 controller. So it seems like data can come to the ESP32 from the PS3 controller OR  from the ESP32 to the PS3 controller, but not at the same time.

Still trying to understand the basics.


   
ReplyQuote
jjs357
(@jjs357)
Member
Joined: 1 year ago
Posts: 30
 

Apparently this is an open issue with some clone controllers:

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

Can't get both input and output to work at the same time


   
ReplyQuote
jjs357
(@jjs357)
Member
Joined: 1 year ago
Posts: 30
 

I just found another Arduino/ESP32 source for gamepads of many makes and models:

https://gitlab.com/ricardoquesada/bluepad32/-/blob/main/docs/plat_arduino.md

There is a short video here:

My PS3 clone and my genuine Sony PS4 are supported. The PS3 will not rumble with the library and but my PS4 controller will. The accelerometer in the PS3 does not report data but my PS4 has both gyro and accel data being reported. Single header file Bluepad32.h for the demo. I will try and adapt Bill's examples to use and be compatible with this library.


   
ReplyQuote
jjs357
(@jjs357)
Member
Joined: 1 year ago
Posts: 30
 

I have made an adaptation of Bill's LED test sketch.

It can be found at:

https://github.com/jsolderitsch/ESP32Controller/tree/main/PS4LedController

It looks more complicated because the scaffolding I adapted it from is the general test program from the Arduino Bluepad32 library example. The program allows up to 4 different gamepads/controllers to be reserved by the ESP32.

It works with my PS3 clone and my Sony PS4. It controls 3 LEDs connected to pins of the ESP32. I am using GPIOs 26, 25 and 21 because they are available on my Tello drone controller configuration.

The PS3 needs to have an explicit bluetooth pairing as explained in Bill's video. For PS4, you can turn on pairing from the controller itself. You may want to uncomment the code at line 73:

  // BP32.forgetBluetoothKeys();

to start fresh with your own game controller.

I may make a short YouTube video showing the steps and usage of the example.

Eventually I want to fly the Tello using a combination of my ESP32 configuration and a game controller like the PS4 playstation controller.


   
ReplyQuote
jjs357
(@jjs357)
Member
Joined: 1 year ago
Posts: 30
 

Still haven't made the video yet (one is still planned including where my Tello drone is being piloted using a PS4 controller) but I did add support for checking dpad values in this test. Right now, just processing the up button to light an LED as long as the up button on the dpad is being pressed. The source includes support for 6 different LEDs connected to my ESP32 circuit. You can connect a PS4 controller, then disconnect it, and then connect a PS3 without re-starting the demo program. The PS3 does have to be paired with the ESP32 bluetooth address manually. There is a tool with source code to do this in Ricardo Quesada's project. Ric is active on discord where you can ask questions and get quick responses. The other gamepad libraries are not being maintained any longer.


   
ReplyQuote
jjs357
(@jjs357)
Member
Joined: 1 year ago
Posts: 30
 

A rough cut video is available now:

GamePad Drone Flight with ESP32

There is some documentation on the Gamepads I have tried here:

https://github.com/jsolderitsch/ESP32Controller/blob/main/docs/controllers.md

The bluetooth ESP32 library used here is being actively supported rather than the library Bill uses in his PS 3 Tutorial. And you can use all sorts of Gamepads: Xbox, PS4, Switch, etc.


   
ReplyQuote
(@videogame95)
Member
Joined: 3 years ago
Posts: 55
 

Hi Bill I was trying to get the car running with the PS3 controller and ESP32 wroom to Bluetooth them.

I've tried SixaxisPairTool it's not showing up can  I use the pS4 controller instead? 

do I need a genuine PS3 controller? I know in your video you use a clone PS3.

I got mine from Amazon if you have a link to get your one please add it, as yours worked.

I have a PlayStation 3 and can get its Mac address.

My PC sees it as an Xbox controller it works wired. 

Any help please I've seen your video 

thanks from James 


   
ReplyQuote
Page 6 / 7