Thursday, July 6, 2017

Interfacing PS3 controller to HC-05 Bluetooth module

This post will describe how I modified the HC-05 to work in HCI mode to connect to PS3 Controller.
Following steps have to be taken

1)Refer to this link to connect the HC-05 in SPI mode. Using this, it's possible to the change the onboard firmware and change PSKEY's. What I did was flash the HC-05 with RN-42 firmware.

2)Once flashed with RN-42 firmware, put your BT address back and change the following PSKEY's
using the PSTool.exe

  1. PSKEY_VM_DISABLE -> 0x0001
  2. PSKEY_ONCHIP_HCI_CLIENT -> 0x0000
  3. PSKEY_HOST_INTERFACE -> UART H4
  4. PSKEY_UART_BAUDRATE -> Same as USART on the micro
it's better to choose a high baud rate or there's a lag. I used 250,000bps by setting this PSKEY to 0x400. The formula to calculate this is given in the description of that 
PSKEY_UART_BAUDRATE. It's Baud = PSKEY_UART_BAUDRATE * 0.004096

3)Use this library for the code : 
https://github.com/Nero7991/HC-05-PS3-Controller-AVR