How to connect a PS3 remote to the new Raspberry Pi Zero W

Arron Churchill's picture

What you will need

You do not need much to get a PS3 controller connected to the Pi Zero W:

  1. A micro SD card with the latest Raspbian (or noobs) installed
  2. WiFi connectivity to the internet
  3. A USB adapter and hub to connect devices
  4. A USB keyboard and mouse (or a VNC connection)
  5. An HDMI monitor and adapter (or a VNC connection)
  6. A USB mini cable, the same style used for charging the PS3 controller

Before starting get your Raspberry Pi Zero W up and running with Raspbian and a working WiFi connection to the internet. You can do all of the steps below via VNC instead of using the keyboard and mouse if you want.

If you have not already check out our Getting started with the Pi Zero WiFi and Bluetooth guide to setup the WiFi and find out how the Raspberry Pi Zero WiFi is different.

Setting up the PS3 controller

The first thing we need to do is tell the PS3 controller what device (our Pi Zero W) it should connect to. We do this using a USB cable and a program called SixPair.

Step 1 - attach the PS3 controller

Start by attaching the PS3 controller along with your keyboard and mouse (if needed) to the USB port on the Pi Zero. You will need to use both the SB adapter and hub to get all three connected at once. After that attach your monitor via the HDMI adapter and then connect the power.

Step 2 - download software

To get what we need we need to use the Terminal program. This can be found on the top taskbar:

We need to make sure the Raspberry Pi Zero W is ready to get new software, we do this with an update command:

sudo apt-get update

This may take a minute or two to run.

Now type in this command to install the utilities needed for joysticks and USB control.

sudo apt-get -y install libusb-dev joystick python-pygame

This will take care of the downloading and setup for you.

Next run these three commands to download and build the SixPair program.

cd ~
wget http://www.pabr.org/sixlinux/sixpair.c
gcc -o sixpair sixpair.c -lusb

This will be nice and quick.

Step 3 - Setup the PS3 controller

Restart you Raspberry Pi Zero WiFi to make sure everything is ready.

Once the Pi Zero W has restarted open the terminal again and run the command:

sudo ~/sixpair

If everything worked you should see something like this:

Step 4 - Enable discovery

To connect our PS3 controller we need to make the Pi Zero WiFi visible. Click on the Bluetooth icon on the right of the taskbar and select "Make Discoverable".

Now the Pi Zero is ready press the PS button on the PS3 controller. The LEDs on the controller should start flashing.

Step 5 - Pairing the controller

This is the tricky part and might take a few attempts.

First click on the Bluetooth icon again and select "Add Device".

You should get a new screen up, we are looking for a line with an icon that looks like an old gamepad like this:

When it appears try to select it and then click the "Pair" button. This may take several attempts as the device will tend to appear and disappear on its own!

If the icon stops coming up check the PS3 remote. If the LEDs have stopped flashing you need to press the PS3 button again.

If you get an error simply ignore it and try again, it may take a few goes before things work. If you get a PIN code dialog:

just press Ok and try again.

After a few tries you should see the pairing dialog:

When it disappears click on the Bluetooth icon again and see if you have a new device listed with a green tick. If you do everything is ready.

At this stage the PS3 controller should be showing a single LED constantly:

Step 6 - Check the connection

First restart your Raspberry Pi and confirm the LEDs go off on the PS3 controller.

When the Raspberry Pi has restarted press the PS button and check you get the single LED again:

Open the terminal again and make it nice and large this time. Enter this command to check the PS3 controller is working correctly:

jstest /dev/input/js0

When the command starts the screen will fill up very quickly with lots of numbers. Rotate the left stick on the PS3 controller and the first two columns should change as the position of the left stick changes.

Your PS3 controller is now ready to control you Raspberry Pi Zero WiFi based robot using the new built-in Bluetooth :D

Subscribe to Comments for "How to connect a PS3 remote to the new Raspberry Pi Zero W"