RSS Delicious Facebook Twitter

News_ Programs_ Applications_ Games_ Khrown's World_ Stuff_ Music!

[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » Forum of DE » Arduino And C+ Programing » Arduino and A ps3 Controller
Arduino and A ps3 Controller
sault73Date: Tuesday, 26/Aug/2014, 3:22 AM | Message # 1
Ultimo Rango
Group: Administradores
Messages: 6
Status: Offline

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.

A USB host shield: Circuits@home and Sparkfun.

A Bluetooth dongle: 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.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.

/* Barrett Anderies
   March 11, 2013
   This is a modified version of the PS3BT.ino example sketch by Kristian Lauszus
   For more information visit his blog: or   
   send him an e-mail:

#include <PS3BT.h>                    //Include the necessary libraries.
#include <Servo.h>

USB Usb;
BTD Btd(&Usb);
PS3BT PS3(&Btd);   

Servo servo1;                    //Create instances of type Servo. servo1 is the steering servo and servo2 is the ESC.
Servo servo2;

void setup() {
    if (Usb.Init() == -1) {                     
      Serial.print(F("\r\nOSC did not start"));
      while(1); //halt
    Serial.print(F("\r\nPS3 Bluetooth Library Started"));                
    pinMode(3, OUTPUT);
    pinMode(5, OUTPUT);
    servo1.attach(5);                    //Steering servo on digital pin 5
    servo2.attach(3);                    //ESC on sigital pin 3
void loop()   

    if(PS3.PS3Connected || PS3.PS3NavigationConnected) {
      servo1.write(map(PS3.getAnalogHat(RightHatX), 0, 255, 0, 180));
      servo2.write(map(PS3.getAnalogHat(LeftHatY), 0, 255, 180, 0));
      if(PS3.getButtonClick(PS)) {
Attachments: 1392840.png(475.6 Kb)

Message edited by sault73 - Tuesday, 26/Aug/2014, 4:43 PM
dustinwpearceDate: Tuesday, 16/Dec/2014, 11:03 PM | Message # 2
Primer Rango
Group: Usuarios
Messages: 1
Status: Offline
Thank you so much for this. i have been fighting with a far more complex design and bad coding. you have saved me another 2 weeks of aggravation. this is exactly what i wanted to do. i coupled mine with a bec and got excellent torque out of servo. thanks again!!!!!
Forum » Forum of DE » Arduino And C+ Programing » Arduino and A ps3 Controller
  • Page 1 of 1
  • 1