Hardware
The requirement for the hardware is to connect the PSP Analog Joystick to the Raspberry Pi GPIO via an MCP3002 Analog to Digital Converter, inserting only one resistor in the MCP3002 data output line as a precaution.
Support has now been added for up to four joysticks using and MCP3008 in place of the MCP3002.
This involves the following connections:
3V3
|
VDD / Vref (Pin 8)
|
SPI0 CE1 (GPIO 7)
|
N/C
|
SPI0 CE0 (GPIO 8)
|
CS (Pin 1)
|
SPI0 MISO (GPIO 9)
|
Dout (Pin 6)
|
SPI0 MOSI (GPIO 10)
|
Din (Pin 5)
|
SPI0 SCLK (GPIO 11)
|
CLK (Pin 7)
|
GND
|
VSS (Pin 4)
|
3V3
|
VDD / Vref (Pin 8)
|
X Axis
|
CH0 (Pin 2)
|
Y Axis
|
CH1 (Pin 3)
|
GND
|
VSS (Pin 4)
|
The hardware is very simple. The power for the MCP3002 and joystick comes directly from the Raspberry Pi GPIO, the power consumption is very low.
The communication between the two is a standard SPI.
There is a 1K resistor on the data out line of the MCP3002 to restrict the current flowing from the GPIO pins, in case the GPIO pin has been configured to an alternate operation.
The PSP joystick has four pads on the back were wires can be soldered on to. Two of the pads require the 3V3 supply across them, the pads at each end, 1 and 4. The joystick is the equivalent of a variable resistor, but with two wipers, one for each axis movement. So the way it works is that it creates two potential dividers which provide a varying voltage for each axis, x and y. The inner pads 2 and 3 are the X and Y axis.