PS3 Controller/Joypad Guide

Hey everyone,

This guide is on how to get full functionality out of a wired Playstation 3 controller. It has only been tested for CNC Controller v1.0.9, though it’s likely to work with newer versions as well.

v1.0.9 out of the box has limited support for a wired PS3 controller. Only the left joystick works, which controls the X/Y directions of the CNC.

We want the PS3 controller to emulate the Onefinity Joypad.

Requirements

  • PS3 controller
  • Wire to connect PS3 controller to the CNC’s USB port
  • Mac/Linux computer for SSH
    • Windows works as well, though this guide won’t cover SSH using Windows.

Before Starting

WARNING: This guide is fairly technical. I’ve tried to make it so the instructions aren’t difficult to follow, but you will be editing system files. YOU COULD BORK YOUR SYSTEM. If you choose to continue, be aware of this.

Walkthrough Outline

  1. Connect CNC to WIFI.
  2. SSH into CNC system.
  3. Install xboxdrv to map PS3 controller to Onefinity Joypad.
  4. Set up xboxdrv to run automatically on startup.

Establish a WIFI Connection

For versions 1.0.9 and below, see the Youtube video here: Connecting The Onefinity CNC To A Network (Buildbotics Controller)

For higher versions, the process should be more straightforward, but similar to the previous instructions.

SSH into CNC System

On the CNC display, open the menu and go to ADMIN > Network.
Obtain the hostname and and username.
For most people, these are going to be onefinity and bbmc.

Open a terminal on your computer.
Using the username and hostname, enter the following:

# Fill in the username and hostname: ssh <username>@<hostname>.local
ssh bbmc@onefinity.local

If this is the first time SSHing into the CNC system, a prompt will be displayed to accept the “fingerprint.” To continue, type “yes”.

You’ll then be asked for a password. The default password is onefinity.

  • (I strongly suggest you change this password at some point. You can change this password under the ADMIN > Network settings using the CNC’s display.)

If you’ve successfully logged in, you’ll see a login message printed out in the terminal window.

Attempt a Package Update

In the terminal window that is now SSH’d into the CNC system, run the following using the same password as before when prompted:

sudo apt-get update

If you see output containing:

E: The repository 'http://mirrordirector.raspbian.org/raspbian stretch Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.

then the sources list needs to be updated.

To do this, run:

sudo nano /etc/apt/sources.list

This will open an editor to edit the file. This editor might feel clunky, but it’s the simplest one to use for our purposes. Key combinations for exiting, undoing, etc. will be shown at the bottom of the screen.

Now that the file is displayed, comment out the failing repository (by prepending it with #) and add the legacy repository:

# Comment out the line below:
#deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi

# Add the following line:
deb http://legacy.raspbian.org/raspbian/ stretch main contrib non-free rpi

Press control+X to exit the file and say yes to save it.

Again, run:

sudo apt-get update

This time, there shouldn’t be any failure messages.

Now install xboxdrv. This will map the PS3 controller to the Onefinity Joypad mapping:

sudo apt-get install xboxdrv

Test the PS3 Controller

With the PS3 controller plugged in, press the PS button so the 4 red lights on the PS3 controller aren’t flashing.

Then run:

sudo xboxdrv --silent --detach-kernel-driver

Test the controller against these mappings (minus the mode selection button)

If this is working properly, the PS3 controller should have all the Onefinity Joypad functionalities.

Now quit out of the xboxdrv session by pressing Ctrl+C.

Test the PS3 controller again. It should no longer work since xboxdrv isn’t running.

Set xboxdrv to Run at Startup

In order to have the PS3 controller work automatically, we need to run xboxdrv at startup.

To do so, run:

sudo nano /etc/rc.local

Before the lines that call startx, add:

# Launch xboxdrv for PS3 controller compatibility
xboxdrv --daemon --detach-kernel-driver --silent --dbus disabled --detach

This is essentially what my /etc/rc.local looks like after making the change:

#!/bin/bash

# [...] bunch of irrelevant stuff

# Launch xboxdrv for PS3 controller compatibility
xboxdrv --daemon --detach-kernel-driver --silent --dbus disabled --detach

# Start X in /home/pi
cd /home/pi
sudo -u pi startx

Close and save the file.

Let’s test the command before wrapping things up. Run:

sudo xboxdrv --daemon --detach-kernel-driver --silent --dbus disabled --detach

There should be no output after running this command. Test the PS3 controller again and it should be working.

Final Test

From the CNC display, open the menu and restart the system.

Wait for the system to reboot and for the UI to finish loading. Test the PS3 controller and it should now work! This means that xboxdrv is running at startup by itself and that everything was successful.

Request

If you try this on a different version that v1.0.9, please let me know so that I can document it in this post.

Thanks everyone!

Resources

1 Like

UPDATE

Works with v1.3.1.

Troubleshooting

Also, if you’ve followed the steps but the PS3 controller sometimes works and sometimes doesn’t, it has to do with the state of the controller. See the following scenario and fix:

  1. Turn on CNC controller box.
  2. System loads, PS3 controller is already connected, solid red light on PS3 controller is showing.
  3. Try using PS3 controller, doesn’t work.
  4. To fix:
    • HOLD PS3 controller PS button for 12+ seconds.
      • This will reset the controller and you should see four blinking lights. At this point, xboxdrv will try to connect to the PS3 controller again and it should start working. If it doesn’t, try pressing the PS button again to get the solid light back and see if the PS3 controller starts working again.
1 Like