RetroPie & Dualshock 3 or 4 controller over bluetooth

Post or find tutorials, how-to, guides, tips & tricks here
Post Reply
User avatar
Site Admin
Posts: 708
Joined: Sun Feb 16, 2014 3:30 pm

RetroPie & Dualshock 3 or 4 controller over bluetooth

Post by hackinformer » Tue Jun 09, 2015 7:35 pm


So after I got Raspbmc up and running without any issues I decided to go straight for the retro games emulator.
Still haven't setup your retro pi then check out our step by step guide here..

For this I used the following:

RetroPie - This script installs RetroArch (all the emulators I want and more) and EmulationStation - a sexy frontend for RetroArch on the Pi.

A Dualshock 3 wireless controller.
A Trust Bluetooth 3.0 USB adapter
SD Card loaded with the latest image of Raspbian.
So from a fresh boot of Raspbian we need to tweak a few things first.
From the raspi-config screen you need to do:
Expand the filesystem to fill the SD card.
Change the memsplit to 128 or 192.
Change the password for user pi.
Overclock (optional and at your own risk)
Once that has been done and the Pi has rebooted, log in and run the following commands:

sudo apt-get update
sudo apt-get upgrade -y

Now we can move on to setting up RetroPie.

First we need to install some dependencies:

sudo apt-get install git dialog -y

And now to download and run the RetroPie setup script:

git clone git://
cd RetroPie-Setup/
chmod +x
sudo ./

Now you have 2 options to install RetroPie - Binaries and Source.
I prefer to use Source so let's select that option.
Now we can choose what to install. If you want everything just leave it as is, but if there are some emulators you'll never use, untick them now to save time and space.
Run the install. Wait 3-4 hours to RetroPie to compile.

Once that is completed you'll have a debug output with any issues encountered (hopefully none).
Reboot your Pi.

Now you have RetroPie installed and you can run it with:

But we're not done yet. I have a PS3 controller I want to use with both EmulationStation and RetroArch over bluetooth.

So to get that working we need the following dependencies:

sudo apt-get install bluez-utils bluez-compat bluez-hcidump libusb-dev libbluetooth-dev joystick checkinstall -y

Give it a few minutes to install.

Once that has completed, let's see if our Bluetooth dongle is detected (for mine I had to make sure it was plugged into one of the Pi's USB ports - not a USB hub).


You should get something similar to this output:

pi@raspberrypi ~ $ hciconfig
hci0: Type: BR/EDR Bus: USB
BD Address: 00:02:72:BF:BC:8F ACL MTU: 1022:8 SCO MTU: 121:3
RX bytes:16777722 acl:289271 sco:0 events:116 errors:0
TX bytes:2561 acl:53 sco:0 commands:56 errors:0

The key thing we're looking for here is the UP RUNNING PSCAN. If it says DOWN - you've got an issue with your dongle's chipset - or as in my case you've plugged it into a USB hub.

Now we can pair the dongle with the controller using Sixpair.

gcc -o sixpair sixpair.c -lusb

With your controller plugged in, run the following:

sudo ./sixpair

You'll get something similar to the following output:

Current Bluetooth master: 00:02:72:BF:BC:8F
Setting master bd_addr to: 00:02:72:BF:BC:8F

(Note: When you first run sixpair, the two addresses above will be different - mine are the same because I've already paired the dongle with the controller.)

Now we just need SixaD to manage the controller.

wget ... src.tar.gz
tar xfvz QtSixA-1.5.1-src.tar.gz
cd QtSixA-1.5.1/sixad
sudo mkdir -p /var/lib/sixad/profiles
sudo checkinstall

I've used checkinstall here as it creates a Deb package to help you uninstall it later on. Just hit enter at the prompts and it'll install.

We'll need to start the sixad daemon at startup:

sudo update-rc.d sixad defaults

And start the service now:

sudo service sixad start

Now unplug the controller and press the PS button. You should see the lights go back and forth and it'll rumble for a second or two. Congrats - it works!

(NOTE: As of the latest Raspbian image (2012-02-22), your controller will probably keep flashing and not rumble. The controller has connected but isn't reading the SixaD profile correctly. You can continue to complete this guide but you'll need to create and use my controller configs manually. Looking into a fix for this.)

But we're not finished yet. We need to set up the controller to work inside EmulationStation and RetroArch.

First off let's create a sixad profile for the controller.

sudo nano /var/lib/sixad/profiles/default

Add the following content:

enable_leds 1
enable_joystick 1
enable_input 0
enable_remote 0
enable_rumble 1
enable_timeout 0
led_n_auto 1
led_n_number 1
led_anim 1
enable_buttons 1
enable_sbuttons 1
enable_axis 1
enable_accel 0
enable_accon 0
enable_speed 0
enable_pos 0

Now reboot with the following:

sudo reboot

Once you've logged in, press the PS button again on the controller. It should rumble like before.
This time we've disabled the motion controls as they have some screwy behaviour when setting up controllers in EmulationStation.

Now run emulationstation - you should get the option to configure you're controller.
When you've entered your controls and pressed a keyboard key to save, press F4 to exit emulationstation.
This will have written a file called es_input.cfg to ~/.emulationstation/
You can delete this file if you need to reconfigure your controller, or edit it to do it manually.

My es_input.cfg contains the following:

JOYNAME PLAYSTATION(R)3 Controller (00:24:33:62:62:5A)
BUTTON 10 10

(Note: If you are going to copy this file make sure you change the MAC address at the top. You can get your controllers MAC address using hciconfig after you've paired it.)

Now to configure RetroArch for the controller.

Run the following command:

retroarch-joyconfig >> ~/RetroPie/configs/all/retroarch.cfg

Configure your controls - this will append the configuration to the end of ~/RetroPie/configs/all/retroarch.cfg.

The end of my config file has the following:

input_player1_joypad_index = "0"
input_player1_a_btn = "13"
input_player1_b_btn = "14"
input_player1_x_btn = "12"
input_player1_y_btn = "15"
input_player1_l_btn = "10"
input_player1_r_btn = "11"
input_player1_l2_btn = "8"
input_player1_r2_btn = "9"
input_player1_l3_btn = "1"
input_player1_r3_btn = "2"
input_player1_start_btn = "3"
input_player1_select_btn = "0"
input_player1_left_btn = "7"
input_player1_up_btn = "4"
input_player1_right_btn = "5"
input_player1_down_btn = "6"
input_player1_l_x_plus_axis = "+0"
input_player1_l_y_plus_axis = "+1"
input_player1_l_x_minus_axis = "-0"
input_player1_l_y_minus_axis = "-1"
input_player1_r_x_plus_axis = "+2"
input_player1_r_y_plus_axis = "+3"
input_player1_r_x_minus_axis = "-2"
input_player1_r_x_minus_axis = "-3"
input_exit_emulator_btn = "16"

I added in the last line to exit the emulator using the PS button.

Now we're on the home stretch! We just need to add some roms in.
I copied mine from my PC with a USB pen.
The roms need to go in the following folder: /home/pi/RetroPie/roms
Each emulator has a separate folder. You can use startx if you find that easier to manage the files -but make sure you log out before running emulationstation.

Run emulationstation now and test some games out. All should be working fine!
Last edited by hackinformer on Tue Jun 09, 2015 8:26 pm, edited 1 time in total.
Post Reply