Shopping Cart

Posts

Sony PS3 Controller support added to USB Host library

A fragment of PS3 Bluetooth code

A fragment of PS3 Bluetooth code


I’m quite pleased to announce that ever-popular Sony PS3 game controllers are now supported by current (rev.2.0) USB Host Library. Kristian Lauszus from TKJ Electronics developed a library to interface with Dualshock 3, as well as Move Navigation and Motion controllers via a Bluetooth dongle (only CSR-based ones are supported at the moment). This library has been merged into the main code and I will start maintaining it as soon as my Dualshock 3 arrives.

Sony PS3 controllers are advanced versions of ordinary HID joysticks. They can be interfaced via USB or Bluetooth, the buttons can be read as analog or digital and controller contains rumble motor which can be activated remotely to indicate a hit, for example. The controller also contains a gyroscope and accelerometers so it is possible to control a robot by simply waving and/or rotating the controller.

Kristian got his inspiration from Richard Ibbotson’s articles, as well as works by Tomoyuki Tanaka and others (full list can be found in PS3README file). His Wiki page gives implementation details, communication protocol, differences between controllers, as well as plenty of links to other sources of PS3 controller interfacing knowledge.

Kristian developed this library as a part of his Balancing robot project. The project is very well documented – if you are interested in robots, PID or remote control, please take a look. I also enjoyed watching this video presentation, give it a shot to see balancing robot in action.

Oleg.

Related posts:

  1. Wireless Xbox360 controller support for USB Host 2.0 library
  2. Bluetooth RFCOMM/SPP service support for USB Host 2.0 Library released!
  3. A documentation project for USB Host Library 2.0 has begun!
  4. Balanduino – Balancing Robot Kit on Kickstarter
  5. USB Host Shield library Version 2.0 released.
  6. USGlobalsat ND-100S GPS receiver works with USB Host library
  7. Google Open Accessory Interface for USB Host Shield Library 2.0 released
  8. Arduino 1.0-compatible USB Host Library released
  9. Andriod ADK-compatible USB Host Library release.
  10. PS3 and Wiimote Game Controllers on the Arduino Host Shield: Part 1

31 comments to Sony PS3 Controller support added to USB Host library

  • Zodius

    This library is great! It’s saved me loads of time trying to get my hexapod robot responding to external input. Unfortunately I have an issue that I can’t figure out. I’ve got a CSR Bluetooth dongle visually identical to the one on the Balancing robot and am connecting it to an Arduino Mega ADK. I can then sync a PS3 Sixaxis controller to it and get the lights changing and read most of the inputs. However, I can’t read any of the analog buttons, the controllers status, or the motion sensor values. The same occurs with a different Belkin branded bluetooth dongle, but both work fine on PC when setup with MotioninJoy, able to read everything.

    Anybody got any ideas what I’m doing wrong?

    • Hi,
      I got one bluetooth dongle that has the exact same problem.
      If you uncomment PRINTREPORT in PS3BT.cpp, you can see that the data is not changing. I still don’t know what the problem is. I had the same issue when I used it with the FEZ Devices: http://wiki.tinyclr.com/index.php?title=PS3_Controller with the same dongle.
      I recommend getting a different dongle. Just buy some different ones at ebay and they will properly work. I think is related to if it’s supports EDR or not, but I’m not sure, as it must support V. 2.0+EDR.

      Best Regards
      Lauszus

  • Harry

    The new ps3 library is graet. Thanks!

    The library should work with Arduino UNO?
    Did you use any timer or interrupt in the library? Can I still use timer2 to generate an constant 1 msec interrupt?

    Thanks!

    • Yes it works with all the Arduinos supported by the USB Host Shield.
      No I havn’t used timer2 in the library. I have only used the standard millis() and delay() functions which use timer0.

      Regards
      Lauszus

  • Thud

    Fascinating articles guys, but what I would really like to see is an Xbox 360 Wireless Controller Library along similar lines to the PS3 and Wii libraries available. Is anybody doing any work on this?

    Cheers

  • Roman Foltyn

    Hallo,
    USB is working correctly with the Shield SPEEDLINK PS3 Controller Type SL-4445-BK.
    Once connected via USB cable Controller in August and then reports the number of the program is part of BT Host to Controller. then when you insert the BT dongle everything works great.

    But here I have a big problem … Original Sony PS3 Controller Model CECHZC2E b1 purchased today is not recognized by USB Shielt and I can not enter the host address to it .. I thought of is defective and replaced it with another … The same problem.

    I tried to apply pressure all the keys on the Serial Monitor controller is there.

    Is Genuine Controller Sony need to do something extra?

    Please advice, I will not give you the same advice.

    I send greetings

    RomanF

  • Matej

    How do i pair PS3 controller with BT dongle?

    Thanx ;)

  • Matej

    This is what i get if I press button TRIANGLE once and then CROSS:

    PS3 Bluetooth Library Started
    Bluetooth Dongle Initialized
    No response to HCI Reset
    HCI Reset complete
    Local Bluetooth Address: 00:15:83:3D:0A:57
    Wait For Incoming Connection Request
    Incoming Connection Request
    Remote Name: PLAYSTATION(R)3 Controller
    Connected to Device: 04:76:6E:DA:DD:8C
    Scan Disabled
    Your dongle may not support reading the analog buttons, sensors and status
    Your HCI Version is: 1
    But should be at least 3
    This means that it doesn’t support Bluetooth Version 2.0+EDR
    HID Control Incoming Connection Request
    HID Control Configuration Request
    Wait For Incoming Connection Request
    HID Control Successfully Configured
    HID Interrupt Incoming Connection Request
    HID Interrupt Configuration Request
    HID Interrupt Successfully Configured
    Dualshock 3 Controller Enabled
    PS3 Controller – Traingle
    PS3 Controller – Traingle
    PS3 Controller – Traingle
    PS3 Controller – Traingle
    PS3 Controller – Traingle
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross
    PS3 Controller – Cross

    I have tried this with 3 original Dualshock3 controllers on Arduino Mega and Leonardo.

  • Matej

    What does this means “Your HCI Version is: 1″.
    Does this applies to Bluetooth dongle or Dualshock3 controller?

    Thankyou.

  • mej

    Hi Lauszus,

    I’ve got a SparkFun USB Host Shield and a MadCatz PS3 controller. I downloaded the USB Host Library and ran the example sketch PS3USB (after changing the values for VID and PID in PS3USB.h so that they matched my controller’s) and the serial monitor is continuously scrolling and the parameter values don’t change regardless of whether or not I’m pressing any buttons on my controller.

    Are there more values that I need to change in the header file? Or is this how the sketch should run? I’m a bit new to this so any help would be appreciated, thanks.

    • mej

      I’ve since gotten a usb cable for my official sony PS3 controller. I changed the VID and PID values once again and the sketch shows

      PS3 USB Library Started
      Dualshock 3 Controller Connected
      Bluetooth Address was set to: 00:00:00:00:00:00

      and nothing else; it doesn’t respond to any button presses/holds.

      • Try to connect an external power supply to the Arduino.
        The Sparkfun shield rely on a VIN that it’s greater than 5V since it got an onboard 5V regulator connected to VIN on the Arduino.

  • gio

    hi, i have a problem to pair the dongle with the control( i have 2 dualshocks and 1 sixaxis only detects the sixaxis i dont know why) when i started the serial monitor detect the dongle and shows the address, then i plugged the control and showed dualshock 3 detected and show the same address of the dongle, plug the dongle again and push the ps button but it didn´t pair only flash, what can be the problem? thanks a lot

  • gio

    THANKS FOR ANSWERED, I DONT KNOW VERY MUCH OF THIS,WHAT DO YOU WANT TO LOOK? I DONT UNDERSTAND, COULD YOU EXPLAIN ME WITH MORE DETAILS, PLEASE, I NEED TO CHANGE SOMETHING IN THE SKETCH? THANKS

    • Please send me the output from the serial monitor after you have done the following: plug in the dongle and then unplug it again. Then plug in your PS3 controller.

  • gio

    Ps3 bluetooth library started
    Bluetooth dongle initialized
    Hci reset complete
    Write class of device
    Local bluetooth address:00:1f:81:00:02:50
    Wait for incoming connection request
    Dualshock 3 controller conected
    Bluetooth adress was set to :00:1f:81:00:02:50
    Bluetooth dongle initialized
    No response to hci reset
    Hci reset complete
    Write class of device
    Local bluetooth adress: 00:1f:81:00:02:50
    Wait for incoming conection request
    Incoming connection request

    Thats all and no pair

    • The paring is working fine. It is happening when you plug in your PS3 controller and the following line gets printed:

      Bluetooth adress was set to :00:1f:81:00:02:50

      It’s a problem with your Bluetooth dongle. You will have to try a different one!

  • gio

    Ok i will, the dongle needs something particular? Thanks

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">