Table of contents1. Introduction
2. Required equipment
2.1 Tools
2.2 Components
3. Hardware part
3.1 Wiring schematic
3.2 Host shield modification
3.3 Disabling joysticks
3.4 Case modifications
3.5 Wiring digital potentiometers
3.6 Soldering wires to controller pcb
3.7 The rest of the wiring
4. Software part
4.1 Installation
4.2 Calibration
5. Advanced version modifications
5.1 Buttons
5.2 Joysticks
5.3 Battery1. IntroductionBE CAREFUL WHEN DRILLING OR SOLDERING OR DOING OTHER THINGS. EVERYTHING YOU DO, YOU DO ON YOUR OWN RESPONSIBILITY. THAT INCLUDES EVERYTHING DETAILED IN THIS TUTORIAL AND USAGE OF THIS DEVICE.This tutorial will quide you how to install Teensy 3.0 and USB host shield to DS4. The code is made to work with xbox 360 controllers, but can be modified to work with any USB device the host shield supports.
Shortly: The purpose of this device is to use XIM2 / XIM3 / XIM EDGE on PS4.
The version detailed here makes original joysticks and buttons on flexboard not working. It is possbile to make a version that has all original joysticks and buttons working, but is harder to do. How to do that is detailed in "5. Advanced version modifications"
This is what the finished mod should look like:


2. Required equipment2.1 ToolsYou will need following tools for this mod:
- Dremel-like drill
- Tools for it
- Soldering iron (and all regular stuff that is needed for soldering)
- Screwdriver set
- Hot glue gun
- Pair of working brain halfs with some intelligence inside
2.2 ComponentsYou will need following components for this mod:
- DualShock 4 controller (color does not matter)
- Teensy 3.0 (without header pins) (Teensy 3.1 will probably work, but not yet tested)
- mini USB host shield (from circuitsathome.com)
- 8x MCP4131 or MCP4151 digital potentiometers (MCP4151 recommended)
- AWG 30 wire (multiple colors recommended!)
- A little thicker wire for 5V and ground
- 4,7kohm resistor
- 2x 8,2kohm resistors
3. Hardware part3.1 Wiring schematicGeneral rule in these connection pics: Same color with same name connect together. (Does not apply 100% in digital pots).


Turquoise RX,RY,LX and LY and brown AREF can be ignored if you are not going to make original joysticks work again.




3.2 Host shield modificationThe shield needs to be modificated so that 5v is connected to VBUS.
You need to cut this trace:

Be carefull when soldering wire from VIN to VBUS.
It is recommended to solder this wire to bottom side of the shield.
3.3 Disabling joysticksThe wiper pins from the pots of joystics need to be disconnected.

Basically easiest is to just brutally rip those off, if desoldering seems like too much work.
3.4 Case modificationsYou need to remove parts from "battery holder" plastic part, that is on the backside of the pcb.

This is from the upper left corner:

And this is from the upper right corner:

Sorry for not having those in the same picture. I added those upper cuts later.
Bottom parts need to be modificated too. This is where you need the drill.
Make room for both teensy and host shield usb connectors. Make also hole for teensy reset button.

Modify also the other parts:


When teensy and usb host shield fit there nicely put those parts back.

But leave this out:

Finally mount teensy and host shield with hot glue:


Remember to connect that ribbon cable before glueing. Also it is recommended to solder 5V wire to the backside of the host shield before glueing.
I would recommend removing rumble pads completely. You wont be needing those anyway.
3.5 Wiring digital potentiometersFirst you need to make 2 "double potentimeters" for RX and RY:

Notice that all pins except chip select (pin 1) are connected together.
You can solder A, B and wiper pins directly to the controller pcb.

The ones on the center are L2 and R2. Those are upside down here, but that is not necessary. Use hot glue to mount those 2. You dont need to glue LX, LY, RX and RY.
SDI/SDO, ground and 3,3V wired. NOTE: L2 and R2 are not connected correctly in these pics!

SCK wired:

And finally CS wires:
3.6 Soldering wires to controller pcbFlexboard connection solder spots:
Remove the carbon paint with something sharp (for example, screwdriver).
Grind solder spots a little with sand paper.
Add solder to solder spots.
Result:

Now you can solder wires. Cut wires to about same length. About 10cm should be ok.

Sorry for unsharp pic.
Finally glue wires with hot glue:
3.7 The rest of the wiringNow that all wires are connected to controller pcb, you can put it all together.


I would recommend wiring host shield connections first. Then start soldering wires to front pins first and from there move to the back. That way you dont need to fight wires with soldering iron.
When you have connected everything it is recommended to try the code before assembling case together.
You need to leave something (for example piece of tape) between flexboard and controller pcb. This will prevent it from making any contact with solder spots.
Leave battery out too. It will not fit there anymore.
4. Software part4.1 InstallationThe
final package.
4.2 CalibrationCalibration will work as easily as connecting DS4 to USB host shield with usb cable and waiting 5 seconds. Make sure Teensy is connected to pc first.
5. Advanced version modificationsThese modifications require more skills that the "basic" version. Dont try these unless you have skills, patience and tools to make these.
5.1 ButtonsThis part will focus on how to make this mod while leaving flexboard buttons working. For this there are 2 possible ways to do this.
1: Soldering to front and using carbon paint.


You will make the contacts higher with carbon paint. The soldering should be done well. You also need to solder dummy wires to those "empty" contacts.
2: Soldering to backside vias.


This is probably easier, but only if you have good soldering skills and tools. You need to realize that the size of these vias is smaller than 1mm !
In addition to these, L2 and R2 digital potentiometers need to be wired differently in both.
5.2 and 5.3 were supposed to be written, but it never happened. Sorry about that...