Electrical – How to use rn42 bluetooth module with dualshock 3

arduinobluetoothspiusb

I have a rn42 Bluetooth module with HID features, now how do I use it to connect to a DualShock 3 or 4 controller with an Arduino. Since the DualShock 3 pairs only to a particular mac address, how to store the rn42 mac address into the PS3 controller.
There are numerous solutions for connecting a DualShock 3 with Arduino but all use a USB shield and Dongle and I don't want to spend cash on them and want to achieve this only with the rn42. Please, someone help.

Best Answer

It would be easier to use the USB shield and bluetooth dongle.

However, if you are determined to use this obsolete Roving Networks module, then read on...

Firstly, study the PS3 bluetooth interface https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information

  1. First you have to set up the Bluetooth dongle using the HCI protocol.

  2. Then you wait for the incoming request from the PS3 Controller.

  3. When the request arrives, you accept, and change the role, so the Arduino, becomes the master of the connection.

  4. Then you listen on the Bulkin endpoint. The controller will then send a L2CAP connection request, for the HCI Control channel (PSM: 0x11).

  5. You respond by sending an connection response. First with the result: pending, and then with the result success.

  6. Then you have to send a configuration request. The controller will then respond with a configuration request as well.

  7. You then respond, and the controller will then respond, that the channel have been successfully established.

  8. The program then repeats the steps from 4-7, but this time it sets up the HID Interrupt (PSM: 0x13) channel.

  9. Just like for USB connection, the host has to sent a special command to make the Dualshock 3 and Navigation controller sent buttons reports ect. back. It is a little different for bluetooth. This time you have to send a Set Feature Report (0x53) with a report ID (0xF4) and the following data: 0x42, 0x03, 0x00, 0x00.

  10. Then just listen on the bulkin endpoint, and you will see the bytes changing, when you push a button, use the joysticks etc.

You will see that the PS3 controller requires Bluetooth v2.0+EDR support, which your RN42 module supports.

To find the PS3 controller BT address, you can write to it directly with a USB shield, and some libraries included in this sketch: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L22

Good luck.