Using a USB host shield and a Bluetooth dongle to get data from a PS3 controller – Success!

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.

UPDATE: I have found another place to purchase new dongles: here.

UPDATE: You can buy new dongles (not factory seconds like mine) here.

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: 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.

147 thoughts on “Using a USB host shield and a Bluetooth dongle to get data from a PS3 controller – Success!

  1. // Analog button values can be read from almost all buttons
    if(PS3.(L2_ANALOG) > 0 || PS3.getAnalogButton(R2_ANALOG) > 0) {
    Serial.print(F(“\r\nL2: “));
    Serial.print(F(“\tR2: “));

    i have tried rerighting this a dozen times i have no idea what to do.

  2. having some trouble, I upload the sketch to the uno, after uploading is done, I click serial monitor in top right, screen pops up and I am getting this message “OSC did not start ” and that’s it. why is this problem occurring?

  3. John,

    I see. You should be able to modify the PS3BT example sketch to control your motors. Just take the code for the controls you would like to use and instead of outputting that value to the terminal, scale it from 0-255 and write it to the analog output your motor is attached to.

  4. Thats exactly what I wana do. I remoded out a board and have already hooded all them up an they all ran these are very very micro the smallest brushed motors smaller then the tip of my pinky. I just havt to learn the code.

  5. I’m not exactly sure what you’re asking. It sounds to me like you are talking about using an analog output (PWM) to control the speed of a motor. Is that correct? Do you intend to power the motor directly from the Arduino or will you have a separate motor controller? It is unlikely that the Arduino will be able to supply enough current to power multiple motors, even if they are small.

  6. wanted to clarify somethings after rewatching your other video

    i am using motors for a prototype uav so im using micro motors 4.5mm x 5mm x 10mm so no esc just positive n negative can be reversed for opisite direction. i will have 4 motors per button 4 for x 4 for Triangle 4 for r1r2 tho id like r1r2 on gradual up down (ill probably have to do research for that ) or (x-on, square-off) (triangle- on, circle -off) if that complicates code less. each motor i want max 3.8 volts .2amps( or .8) so acounting for 4 ill have to relook up amp req if i had some examples i could look off of im sure i cold figure something out.

  7. Im controlling a mini uav prototype i want x to turn on full voltage n x full voltage off
    Square full voltage on full voltage off

    R1 full voltage r2 less voltage. For 3 differet ports

  8. Hi John,

    Great. What exactly do you mean by “port”? What are you trying to do with the USB host shield? All of the code you will write will be in a sketch that you create (or modify from example code). You will include the USB host shield libraries in that code in order to use the USB host shield. Once you learn how to access data from the USB host shield you can use it to write to serial ports, control servos/ESCs, and many more things.

  9. Awesome I got them all work ^_^ now I’ve tried searching around don’t know to much about C++ atm just started itt tech but where in the codes do I input what button affects what port. tried the site that made it but no info

  10. Hi John,

    It has been my experience that strange characters show up in the monitor if the baud rates of your sketch and the monitor are not the same. Check that the baud rate in your program is the same as the one selected in your terminal. Hopefully this helps.

  11. i have 8 of these

    2 regular ps3 controllers
    i have followed uploading everything in your instructions
    i have tried on 3 computers
    i have tried on different os systems
    i tried the library you used as well as the updated library

    no matter what dongle or the ps3 controller when plugged into the ubs drive it reads weird carectors in the console

    @*&^*#^$^ BUT also letters with wird accents on them will be able to post pics at home
    will be attending a robotics class tomorro maby i can try that
    or should i order

    or what ones worked for you

    i am doing a prototype uav i have all parts except it wont connect >_<

  12. Pontus,

    When you say you used the “same library version that you suggest”, do you mean the old version that I host on my website, or the latest version from the project GitHub? I would suggest using the latest version because it will probably have fewer bugs. However, you will need to enable debugging in the library to check that everything is working correctly. I recently posted a video about this: Try the latest version of the library and see if you get better results. If not, then I would think it’s most likely the dongle, and not your controller as you noted. You can also contact the developer of the library, Oleg (go to the library GitHub for his information), or Kristian Lauszus, who has worked extensively with the shield (I’ve email him before and he has responded promptly): As for what to look for when buying dongles, 2.0 and EDR are things I know to look out for, but you may also want to check the maximum data transfer rate because some dongles I’ve tried have worked, but very slowly and with a lot of lag.

  13. i install library but serial monitor comes up with figures i have the other progrsm u told mentioned for windows but i need the doogle ip address
    wich u show from serial monitor

  14. Hello again Barret

    Previously I had a hard time setting the adress for my controller but I finally managed to solve that using the external software you mention in your video but now I’m having some other problems.

    The symbol buttons, arrow keys, bumpers and joysticks all work fine but I can’t get either of the triggers to work and when I press ‘Select’ the following message is shown: “Select – ConnectionStatus: Error – PowerRating: Error – WirelessStatus: Error”. Also if I press start I just get static gyro readings.

    I compared my issue with what “chiefcamote” wrote below but as opposed to him/her I don’t get any debug messages about HCI-version, this is what I get when connecting my controller:

    PS3 Bluetooth Library Started
    Bluetooth Dongle Initialized
    HCI Reset complete
    Local Bluetooth Address: 00:15:83:0C:BF:EB
    Wait For Incoming Connection Request
    Incoming Connection Request
    Remote Name: PLAYSTATION(R)3 Controller
    Connected to Device: 38:C0:96:5F:77:D9
    L2CAP Connection Request – PSM: 00 11 SCID: 00 A0 Identifier: 02
    HID Control Incoming Connection Request
    HID Control Configuration Request
    HID Control Successfully Configured
    L2CAP Connection Request – PSM: 00 13 SCID: 00 A1 Identifier: 04
    HID Interrupt Incoming Connection Request
    HID Interrupt Configuration Request
    HID Interrupt Successfully Configured
    Wait For Incoming Connection Request
    Dualshock 3 Controller Enabled

    Do you think that this is also a dongle-issue? I use the same library version that you suggest and I have a hard time imagining that my controller should be the problem since I bought a factory new one.

    When shoping for dongles is 2.0 and EDR the only thing to look out for?

  15. chiefcamote,

    Thank you very much for reporting this. This is interesting. I do not know why having an older version of the host controller interface (HCI) would prevent the code from sending that particular data, but apparently it does. As for your dongle looking like mine, that means NOTHING. I have had multiple dongles that looked exactly the same but behaved completely differently. I’m sorry I can’t provide a more reliable source for these dongles, but I simply haven’t found one. If you haven’t already tried this source, it might be worth a shot: At least the description says it has 2.0 + EDR.

    Let me know if you figure anything out.

  16. The problem with analog buttons L2/R2, Select, and sensors appears to be the dongle and/or the library. Debug with the most recent library prints out the following:

    Bluetooth Dongle Initialized
    No response to HCI Reset
    HCI Reset complete
    Write class of device
    Local Bluetooth Address: 00:15:83:3D:0A:57
    Wait For Incoming Connection Request
    Gamepad is connecting
    Incoming Connection Request
    Remote Name: PLAYSTATION(R)3 Controller
    Connected to Device: 00:23:06:BB:C4:F4
    Your dongle may not support reading the analog buttons, sensors and status
    Your HCI Version is: 2
    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 Successfully Configured
    HID Interrupt Incoming Connection Request
    HID Interrupt Successfully Configured
    Wait For Incoming Connection Request
    Dualshock 3 Controller Enabled

    I am using the same dongle (at least as far as I can tell) that Barrett shows in his video tutorial. You can see this code in the PS3BT.cpp in the library.

  17. Hi Jazz,

    I do not know exactly what “OSC” stands for, but it is the error that the code returns when USB fails to initialize. This is most likely due to an incompatible Bluetooth dongle. I have had this error with several dongles. Try as many as you can; it is difficult to find dongles that work because they all look the same but do not necessarily function exactly the same.

  18. Hi this is Jazz,
    I’m actually doing this as a part of my uni project and I keep getting OSC did not work? What does that mean and how can i fix that?

  19. Hi Manu,

    It looks as if your Bluetooth dongle failed after initially achieving communication with the PS3 controller. I’m not sure what caused this, and unfortunately I do not have time at the moment to look into this. I would suggest looking for this error code in the library code and or emailing the developers about it (as I had to do once when I was getting an error).

  20. Hi Krit,

    This is in response to both your comments. First, yes the arrows are suppose to change the channel (the four lights on the front of the controller). Several other people have said that they are having similar issues with L2 and R2 (as you noted). I am too busy right now to look into this, but I will try to once I have more free time (I will then update this tutorial accordingly). All I can suggest right now is to try an older version of the library (link available on this post). Let me know if you figure anything out or have any further questions.

  21. Hi Kaleb,

    It is odd that it works with the USB power supply and not with an external power supply. Is your dongle being recognized and configured by the shield correctly in both situations? There are two common ways the PS3 controller will fail to connect. This first, and most common, is that the Bluetooth dongle is not communicating with the shield correctly. The second is that the Ps3 controller has had it’s Bluetooth address reset to something other than your dongle’s address. Can you confirm that neither of these are happening? Let me know if you figure anything out or have further questions.

  22. Hi Andrew,

    I am not familiar with that MCU so I’m afraid I do not know. I think a Google search would be able to provide you with far more information than I can.

  23. Hi Pontus,

    I’d like to thank you for reading through the posts BEFORE contacting me. Many people don’t. It sounds like you’ve been thorough with your debugging and I appreciate that.

    First of all ignore the lights on the dongles. I have two dongles that look exactly the same but have completely different light patterns (and work differently). However, it is good that they light up because at least you know they’re getting power. Next, which version of the library are you using (i.e. a copy from my link or a new version from the project GitHub)? Newer versions of the library don’t show debug information in the terminal unless you activate the debug code (activating the debug code may make the sketch too large for an UNO). If you are using the copy of the library I posted then you should see the debug information by default. If you are using the new library and would like to enable debugging there are instructions here (as well as other succinct and useful documentation). I doubt anything is wrong with your shield; the dongles are usually at fault. Try as many as you can! Also, it wouldn’t hurt to try enabling debugging or using a different version of the library.

    Let me know if you figure anything our or have further questions.

    Kind regards,


  24. Hi Olwan,

    It’s interesting that you say you are having trouble with L2 and R2. Another person messaged me about that. Are you using the version of the USB host shield library that I am in my videos, or a newer version (i.e. did you download the library from this page or from the project GetHub? If you are using a new version of the library try using the older one (from my post). At this time I do not know why L2 and R2 are giving people trouble. As for your question about the error message you get when you try to modify the example, I can’t really help me unless I can see your code. I can tell you that the error you’re getting has to do with your dongle failing to respond the the HCI reset (obviously) and that this means that at least you are achieving some communication with it (which is a good start), however, I do not know what would be causing this. If you look at the code I wrote to control the RC car in this post you can see what I left of the example (and perhaps if you’re code has removed more than what I left behind that could be your problem). If you can tell me what version of the library you are using and send me a copy of your code I might be able to help you out.

  25. Hi, the video was too helpful. but i faced a problem that the L2 and R2 didnt work. i repeated the procedures many times and still No response from L2 and R2. any idea ?

    and also i have a Question, i want to make some changes in that example, but when i change some thing i get this MSG in the serial monitor “No response to HCI Reset” any idea what the problem is ?!

    THX in advance

  26. Hey Barrett

    I’ve been reading through all the posts but I havn’t found one that seems to describe my issue in particular.

    I use an Uno with a SparkFun shield that I soldered the header pins to myself. I connect my Uno to my computer with an additional external power source and run the PS3BT sketch but I only get to where the serial monitor prompts “PS3 Bluetooth Library Started” and then nothing happens after that. I’ve tried connecting both of the two dongles I ordered (same variant that you use in the video) and just the controller and the prompt just won’t give me any more information.

    I noticed that when I have either of my dongles connected to the shield they DO power up and flash the LED. However I never get them to have the LED constantly on as you do in your video, rather they always perform the slow blinking.

    My best guess from reading all the posts here is that there is something going wrong in my shield, what’s your best guess?

    Other then that I’d just like to say I found your video very helpful and instructive and I’m impressed by the amount of time and energy you’ve put into supporting people with this, good job!

  27. I am a sophomore computer engineering student, so I’m learning as time progresses about different coding languages an devices used. My question is, can a MSP430g2553 micro controller be used as is the audrino controllers are?

  28. I just saw sakalmorokot’s comment
    I think we’re having the same problem.
    I also just tested out PS3USB and everything is working fine.
    But with PS3BT, R2 and L2 aren’t working.

  29. Hello ,
    I finally got the PS3 controller and Bluetooth to connect
    but somehow my R2 and L2 do not work when I pressed them.
    Nothing show up on the display at all, but the other buttons are working.

    and also when I press the arrows: up, down, left, right – it changed the channel for me.
    that’s how its supposed to happen right? I just want to make sure.

    Thank you

  30. Hi! I ordered the dongle and shield you suggest and both work well when I am connected to my computer through the serial port. The problem I am having is the controller will not connect when I have the arduino powered by an external power supply. The controller just blinks until it reaches it “times out”. I was wondering if you had had this problem or if you had any suggestions to correct this? Thanks!

  31. When I plug in the dongle for the second time I get this error

    PS3 Bluetooth Library Started
    Bluetooth Dongle Initialized
    HCI Reset complete
    Local Bluetooth Address: 00:15:83:0C:BF:EB
    Wait For Incoming Connection Request
    Dualshock 3 Controller Connected
    Bluetooth Address was set to: 00:15:83:0C:BF:EB
    BTD Init Failed, error code: 13

    what can I do?

  32. MooreSauce,

    It’s most likely your dongles. Everyone is having trouble with them, including myself. Of the multiple dongles I have purchased, only one of them works consistently. I’ve even discovered that some dongles work, but they transmit data so slowly that they’re pretty much useless. Given how many people have contacted me about their dongles not having a light, I think you might be correct that new batches don’t have lights. HOWEVER, the light will not turn on until the library has successfully connectes to the dongle, so it is also possible that your light is not coming on because it is not connected (the latest version of the library does not have debugging enabled by default, so you might not get enough information in the terminal to tell). Are you sure that the address on your controller has been set correctly? If not, your dongle could be working (without turning the light on), and it’s you’re controller that’s failing to connect. If it’s not your controller, you could try this dongle: It’s expensive, but it’s probably more likely to work than dongles from other sources.

    Let me know if you figure this out or have any further questions.

  33. Carson,

    Are your baud rates set correctly? That often happens when the baud rate on the Arduino is not the same as the baud rate on the serial monitor. Check them and let me know if that’s not the problem.

  34. sakalmorokot,

    Let me make sure I understand you correctly. You are able to connect your PS3 controller to the USB host shield via Bluetooth, but only some of the buttons work (are showing up in the serial monitor)? That is quite odd, especially since it works with the USB sketch. Are you running the example PS3BT code? Could you have accidentally removed some of the code (perhaps the code that reads L2, R2 and the start button)?

  35. The only software I use is the Arduino IDE. The libraries are written in C++ (which can be written in any text editor, although I would recommend a purpose built code editor such as Sublime Text), but are compiled by the Arduino IDE.

  36. Hi… Thanks your so much for the tutorial… I got some problem with the Bluetooth dongle that I got from eBay which is the same as the one u’ve shown in this tutorial (the black one). The thing is when I connect with it, it worked fine except for the analog button of PS3, L2 R2 and Start button… It didn’t response at all. First, I thought it might be problem from my PS3 controller… But when I use it with PS3USB sketch, everything worked fine… Do you know what is the problem? I really appreciate your help, thanks in advance…

  37. I’m having an issue with my dongle, I ordered the same black one you used, four in fact, and every time I pull up the serial monitor for any dongle i plug in all I see is a few funny looking characters.

    How do I get this to work?

  38. Hello,

    I enjoyed your video and it seems like it will be a great way to control my hexapod project in the future, but as of right now I’m having some problems.

    I am using the Circuits At Home USB Host Shield 2.0 and the Mega 2560 board and I soldered the pins on myself (I am assuming that I didn’t damage it). I have checked the pins and they all seem to be properly attached and not shorted out.

    I am using the dongles that you suggested from Amazon (I bought 4) and none have worked. There was no LED light when I plugged it in so I first thought there was no power, but when I plugged a wired mouse into the usb slot it powered up the mouse (So it is getting power). I am also using an external battery power supply (4 AAs). I think the new version of the Dongles do not have LEDs.

    When I run the PS3BT code I only get “PS3 Bluetooth Library Started” and nothing else. When I run the program with the controller connected, I get nothing as well.

    Do you have any suggestions? Thank you in advance for your help.

  39. hi,
    i have been doing some basic robotics projects for a year so I am new to Arduino
    One question… did you use 2 Arduino UNO for the project because i saw i for the software setup and one for the hardware setup?

  40. Have you enabled debugging in the USB host shield library. This will make the library too large to fit on an UNO or leonardo. Unless you can make your code take up less memory, your only option is to purchase an Arduino with more memory.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s