As mentioned in a previous post, I’m interested in using a PS3 controller as the remote for future projects/robots. Having received all of the required hardware, I decided to make this video explaining the process of setting up the PS3 controller and Arduino for communication via Bluetooth. See below the video for details. UPDATE: The latest USB host library does not print out any debug information, so you won’t see any of the information that is printed out below “Bluetooth Library Started.” You should still be able to connect your PS3 controller and see it’s data output in the terminal.
Hardware (besides an Arduino):
A Sony-made, PS3 controller (Dualshock 3 or Sixaxis (I was unable to find a strictly Sixaxis controller)).
A USB host shield: Circuits@home and Sparkfun.
A Bluetooth dongle: UPDATE: Go here for the list of dongles confirmed working by the developers. The wiki page for using a PS3 controller will have a list of compatible dongles (although note that in the video I mention that one of the “supported” dongles doesn’t in fact work). Here are the two I have: The black one (working) and the green one (not working, although listed as compatible). These are also confirmed working (by the developers): Kingston and Zoom.
This dongle has also been confirmed working: http://www.amazon.com/gp/product/B007Q45EF4/ref=oh_aui_detailpage_o08_s00?ie=UTF8&psc=1
A user has confirmed that the Hytac HGB737 bluetooth dongle works as well.
The Software (besides the Arduino IDE):
UPDATE: Some people have had trouble with the newer versions of the USB host shield library. The new library does not print out the debug information you see in my video and the sketch will become too large to upload to an UNO if you turn the debugging on. If you would like to use the exact same version I use in my video (and am still using), you can get it here. You can get the latest version of the USB host shield library below.
You will need to download the entire USB host shield library from GitHub. This is a direct download link, but if you’d like to take a look around the repository go here.
Install the library as you would any other (if you haven’t done this before see this page), and open the “PS3BT” example as I show in the video (File –> Examples –> (Whatever you named the library) –> Bluetooth –> PS3BT). Remember that the Arduino doesn’t allow for dots (.) or dashes (-) in the library folder name, so when you download the library (which for some reason does have dots and dashes in its folder name) you will have to rename for the Arduino IDE to recognize it.
If there is something I forgot to include here, or if you have a question about something in the video, please ask.
I know this an old article, but I need some answers please. I got my PS3 controller connected, but its very unstable, because i cant code for instance if i want a LED to brighten with R2 or a joystick. How do i control motors, servos, LEDs via bluetooth?
Hi guys I’m using this dongle (http://www.ebay.com/itm/200468994562?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649#ht_2636wt_1189)´.
When I try to connect the Ps3 controller with my Arduino Uno the connection always failed.
Canyou help me?😀
Hi Barrett,
I really like your posts and videos about using a PlayStation controller and an Arduino to control things. I’m currently working on a robotics project that will control servos as well as sound clips from a soundboard, and I thought I would ask your help. I sent this to your email as well.
Do you have any ideas or suggestions on how I could use a PlayStation controller to control some servos with the thumbsticks/L2/R2 and trigger some sound clips with the other buttons?
I’d appreciate a reply whenever you can.
Best wishes.
Hi, I finally got my controller paired but it always give only RightHatY : 1 whichever button I pressed. Do you know why? Here’s the debugging from serial monitor :
PS3 Bluetooth Library Started
Bluetooth Dongle Initialized
No response to HCI Reset
HCI Reset complete
Write class of device
Bluetooth Dongle Initialized
HCI Reset complete
Write class of device
Local Bluetooth Address: 00:11:22:98:76:54
Wait For Incoming Connection Request
Keyboard is connecting
Incoming Connection Request
Remote Name: PLAYSTATION(R)3 Controller
Connected to Device: 00:26:5C:69:31:01
HID Control Incoming Connection Request
HID Control Successfully Configured
HID Interrupt Incoming Connection Request
HID Interrupt Successfully Configured
Wait For Incoming Connection Request
Dualshock 3 Controller Enabled
My bluetooth dongle doesn’t power on everytime. It works fine sometime but the other times it fails to turn on. I have a spark fun Usb shield and using arduino Uno. I tried connecting external 12v power supply to arduino. Can you also tell me the connections for arduino mega 2560.
I can’t even compile the PS3BT example using Uno. Here’s the error message http://pastebin.com/P2AWT6FH
Tried compiling using Mega but these error still occur.
Hi Varun,
I am not sure if counterfeit PS3 controllers work. I remember reading somewhere that it was ill-advised to use one, but I never looked into the details. Since you already have some, it might be worth a try. I would be interested to hear if they work.
Regards,
Barrett
Hello,
Are you sure that counterfeit ps3 controller don’t work this.
I have pair of them ,could be better if you could tell me about there compatibility.
Thank you
Chris,
Great! Thanks for sharing the info!
Regards,
Barrett
I actually got the PS3 controller to pair with the dongle. I followed the post on March 11, 2016 by gisholt. Thanks for your reply. This should work for others having the same issue.
http://forum.arduino.cc/index.php?topic=137747.15
Hi Chris,
I haven’t worked with library for a while, but the reason you might not be seeing the address of the Bluetooth dongle is that it is only shown if debugging is enabled (if I remember correctly). I show how to enable debugging in this video: https://www.youtube.com/watch?v=9oNMqMQrMnA. Note that this is likely to cause memory issues on the 328P (UNOs or Nanos) as debugging increases the size of the sketch.
Regards,
Barrett
Hi,
Ihave some problems with the compiler, i have this message on screen:
In file included from C:\Users\walmart\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino/Arduino.h:28:0,
from C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.h:24,
from C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp:20:
C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp: In member function ‘void XBOXRECV::readReport(uint8_t)’:
C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp:310:34: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
case 0x80: str = PSTR(” as controller\r\n”); break;
^
C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp:311:34: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
case 0x40: str = PSTR(” as headset\r\n”); break;
^
C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp:312:34: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
case 0xC0: str = PSTR(” as controller+headset\r\n”); break;
^
Hi, I have some problems to run the example, the compiler sends this message:
In file included from C:\Users\walmart\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino/Arduino.h:28:0,
from C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.h:24,
from C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp:20:
C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp: In member function ‘void XBOXRECV::readReport(uint8_t)’:
C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp:310:34: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
case 0x80: str = PSTR(” as controller\r\n”); break;
^
C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp:311:34: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
case 0x40: str = PSTR(” as headset\r\n”); break;
^
C:\Users\walmart\Documents\Arduino\libraries\USB_Host_Shield_Library\XBOXRECV.cpp:312:34: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
case 0xC0: str = PSTR(” as controller+headset\r\n”); break;
^
I do not know why, please help.
I´m using an arduino uno.
Hello. I too do not get the anything from serial monitor except that the library started. I plug in my ps3 via usb and run the ps3usb sketch and the serial monitor displays the buttons I push on the controller. When it comes to trying to get the MAC address from Bluetooth dongle, nothing. I have tried 3 different dongles. I am doing this for my college project and am running out of time so I am getting desperate and hope someone can help me here please or email me please chrisbeaudet@msn.com Thanks!
Hi, when I try to run the Library (code), with the dongle and everything else connected. The serial monitor wont display anything. Any help?
Hi, I have done everything like in your video and it was a success, but, it only works if I plug in the usb cable to the arduino. if i power the arduino and the usb host shield with an external power source (9v or 12v), nothing happens. please help me! I am not sure what’s going on.
Hi,
I’m trying to using the old coding since the latest coding i got problem with it. But when I compile the old coding it has error to compile
hidescriptorparser.cpp:3:54: error: variable ‘ReportDescParserBase::usagePageTitles0’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’
const char *ReportDescParserBase::usagePageTitles0[] PROGMEM =
could you help me?
Thank you.
Hi, I have done everything like in your video and it was a success, but, it only works if I plug in the usb cable to the arduino. if i power the arduino and the usb host shield with an external power source (9v or 12v), nothing happens. please help me! I am not sure what’s going on.
Hi long,
The library-bluetooth dongle communication is finicky. In most cases the problem is dongle compatibility. Please check the list of dongles on the original post and on the developer page (link in original post). Just keep trying dongles until you get it to work.
Regards,
Barrett
Hi kennethabarra1,
Yes, the library is compatible with the Navigation controller. Please see the readme for the library for a list of compatible devices: https://github.com/felis/USB_Host_Shield_2.0
Hi Chang,
Thanks for letting me know! I will add it to the list of working dongles.
Regards,
Barrett
Hi Jose,
Sorry, I don’t. You could contact the developers of the library. They might know.
Regards,
Barrett
Hi,
I only have “PS3 Bluetooth Library Started” on screen. And im using Mega board 2560 and ORICO BTA- 403. Is that the only reason that MAC ID didnt show up?
please help me!
Thanks