Introduction: HACK PlayStation 4 Cam Into Cheap 3D Depth Camera With Stereo Vision for Python OpenCV and Linux

About: I am a 20 year old student who likes electronics and programming Skills languages c# java css and html Interests home automation 3d printing Arduino's Electronics that make life easier

3D depth cameras are a amazing piece of modern technology. They can create videos in real time which include very useful depth information in the 3D space. This depth information can be very useful in projects like autonomous navigation. The only problem is that these camera's are very expensive!

But they don't have to be. In this Instructable I am going to show you how you can turn a cheap $30 PS4 camera into a fast and accurate 3D depth camera capable of seeing depth in real time. For this we are going to use Linux Ubuntu and OpenCV + Python. And the best thing is that it is not complicated and you can do it easy at home in just a couple hours.

Check the YouTube video above for a Demo and how it all works!`

For this project we will need the following supplies:

- A PS4 Camera. Both V1 CUH-ZEY1 and V2 CUH-ZEY1 will work fine! You can buy them on sites like Amazon or Ebay new or second hand.

- USB 3 cable with a USB 3 Type A connector. We will need this connector to change the one on the PS4 camera. Make sure it is 'USB 3'!

- Computer with Linux Ubuntu 18.04 or later on it

- Some tools like cutters and soldering equipment.

Some useful information

This is all possible because Sony has created the PS4 camera for the PS4. This camera is capable of seeing depth using its two cameras which together form a stereo pair. Originally it was only possible to use the PS4 camera with a PS4 console. This however changed after the PS4 hacking community made a open source driver for the PS4 camera. Now that the camera is already some years old it can be bought for almost nothing while its performance is comparable to much more expensive 3D cameras.

The comparable 3D camera for the PS4 camera is the Xbox Kinect from Microsoft. This camera has been used a lot in the DIY community for amazing projects. When the Xbox Kinect is however compared to the PS4 camera we can see that the PS4 camera is much better. This is because:

The PS4 camera can work outside while the Xbox Kinect can't.

The PS4 camera has much better image sensors. The resolution is 1280*800 while the Xbox Kinect is only 640*400.

The PS4 camera is much lighter and smaller which makes it better for smaller projects.

The PS4 camera does not need a external power supply. It can run complete from USB power. The Kinect needs a power outlet to work!

Step 1: Let's Hack the Camera Cable

Sony uses a propriety connector for the PS4 camera called the PS4 AUX connector. Actually this is just a USB 3 connector with a small difference in shape. Nice job Sony. This is probably to stop people hacking the camera. This however won't stop us!

To hack the cable we can just cut off the AUX connector.

After that we remove some of the shielding and expose all the wires.

Then we strip all the wires so that it looks like the image above

Now do the same for the USB 3 cable you also have. Strip the wires as well. Make sure to use the USB 3 Type A connector.

You can also buy a existing adapter to adapt the AUX cable to USB3. However I think they are expensive and hard to find.

Step 2: Connect the Wires

Now that we have both ends it is time to connect them together. We can do this by just following the colors of the cables like in the picture above.

Red -> Red

Orange -> Orange

Purple -> Purple

Blue -> Blue

Yellow -> Yellow

Black -> Black

If your colours don't fully match then just connect all colours that do match. Then connect the ones together that remain. If the cable does not work (the next step fails) then switch the cables around until it works.

If you USB3 cable has a green and white cable pair, then ignore these. They are not used in the PS4 camera.

Make sure that the length of the entire cable after the hack is not longer than 2m. Shorter is better.

Step 3: Testing the Cable

Now connect the cable to your computer. Make sure you connect the camera to your computer with a USB 3 port! This can be recognised by a Blue color or "ss" markings.

Now open a terminal and run 'lsusb'

You should get a list similar to the picture above. If there is a device in the list which is named 'OmniVision Technologies, Inc', them your cable is working!

If the cable is not working try to plug it in again or into another USB 3 port.

If the cable is still not working retry step 2. Take a look at the tips at the bottom to solve the problem.

Step 4: The Software

To use the camera we need to setup a couple things.

First we need to install Pyusb on the computer by running the following command in a Terminal: 'sudo pip install --pre pyusb'

Now that the system is ready we need the program for getting the video from the PS4 camera. This can be downloaded using the link below for the Github Repo.

After downloading unzip the zip file.

Step 5: Let's Use the Camera!

Now it is time to start using the PS4 camera!

First we need to initialize it. This can be done by:

  1. Go to the folder downloaded from Github called "PS4-eye-camera-for-linux-with-python-and-OpenCV"
  2. Then go to a folder called "Firmware_loader"
  3. In here start a Terminal by right clicking
  4. In the Terminal type "sudo python3"

You should see "PS4 camera firmware uploaded and device reset"

Now we need to know at what index the camera has been initalized.

  1. Type in a Terminal v4l2-ctl --list-devices
  2. This should show a device named USB Camera-OV580: USB Camera-OV (usb-0000:00:14.0-2):
  3. This device will have two /dev/videoX locations.
  4. The number behind video will indicate the index.
  5. The lowest number of the two is the index we need.
  6. Go to and and change this line with the index number cap = cv2.VideoCapture(index number here)

See the images above for some details

Step 6: Get the Video Stream

Now we can finally view the real time Depth or RGB video from the camera.

  1. Go again to the folder downloaded from Github called "PS4-eye-camera-for-linux-with-python-and-OpenCV"
  2. In here now go to "OpenCV_viewer".
  3. In here start a Terminal by right clicking.

For Depth

Type in the Terminal "Python3"


Type in the Terminal "Python3"

If you like projects like this then subscribe to my Instructables and youtube channel!