The USB PS3 Dualshock Controller Software allows you to connect a PS3 Dualshock Controller to the USB Host Board and read the analog stick inputs, button presses, accelerometer and button pressure using I2C or serial TTL
You can also set the four LED’s and turn on the rumble motors.
Please note: This software is free to download but only works on one of our USB boards or chips which must be bought separately.
To order, simply select which of our boards or IC products you wish to have the software loaded onto. See the USB Host Board and IC product pages for details on pricing and installing this software.
The USB PS3 Dualshock Controller software for our USB Host board allows you to easily read the analog joysticks, accelerometer, button pressure values and all the buttons from a PS3 Controller. You can also set the 4 LEDS and the rumble motors. Output from the host board is via serial (mainly for testing) and also via I2C. Now you can easily interface this versatile PS3 Game Controller into virtually any Microcontroller project.
Use it to control
- A Robotic Arm and grabber (robot claw)
- Wheeled or tracked vehicles
- Your own Arcade game on a Raspberry Pi
Configuration can be done by sending commands via the serial port. Either by microcontroller or via a terminal program and a suitable serial TTL connection. Commands take effect immediately and are stored in Eeprom on the board.
The following Commands are available.
|Set Serial Output ON/OFF
|Set Serial Hex Output ON/OFF
|Set Serial Port Baud Rate
|Set I2C Address
The USB Host board will communicate over serial TTL at the following baud rates
- 9600 (default)
The default baud rate is 9600
SERIAL turns on or off the output of serial data when the PS3 controller is plugged in. Data is output in ASCII text format.
Turn it on for testing the PS3 controller or if your want the serial data. Turn it off when using I2C communication to save on processing.
The HEX option converts the SERIAL output into single Hexadecimal bytes and adds a CRC checkdigit. It reduces the amount of data transmitted and makes it easier to process at the receiving device. It is very useful for transmission of the data via XBee to a remote device.
The I2C default address is 41. This can be changed to any value between 1 and 127 using the I2C command
Help can be displayed at any time by typing ? or HELP
The current settings for SERIAL and I2C address are displayed.
USB Host Ps3 Dual Shock Controller v1.02
SERIAL <value> - Set Serial Data Output On/Off
(OFF) - [ON|OFF]
HEX <value> - Set Serial Data Output Hexadecimal On/Off
(OFF) - [ON|OFF]
BAUD <value> - Set Serial Port Baud Rate
I2C <value> - Set I2C Address
(41 ) [1 - 127]
HELP or ? - display help
Reading the Data
As mentioned, there are two ways to obtain the PS3 data from the USB Host board. Either by simple serial output or by using I2C communication. Although the serial output is meant primarily for testing the controller, the HEX output has a useful purpose if you want to transmit the data wirelessly (e.g. to control a UAV or robot) as it can be fed directly into an XBee radio (or similar) for easy transmission.
Serial Data Output
Serial data output looks like the following
It conforms to the same format as the I2C data table shown below. Joystick and pressure outputs are comma delimited, whilst the button presses are not. each line is terminated with a CRLF.
HEX Serial Data Output
This is similar to the Serial data output, but each value is output as a single hexadecimal value and there are no comma delimiters. Additionally there is an extra CRC8 checkdigit added to the data to enable the data to be checked for errors. The HEX output is useful for transmission via XBee radio to remote devices.
The data is in the same format as the I2C data table shown below and transmitted as single bytes. Each transmission is prefixed by characters “PS3” and ended with CRLF.
A total of 41 characters is transmitted ( 3 for PS3, 35 data, 1 CRC, 2 for CRLF)
There is a link to an example Arduino program for reading the HEX data at the bottom of the page.
I2C Data Output
I2C data can be read in the normal I2C manner using the following register values for obtaining data. Data can be read on one complete go or read individually. There is a link to an example Arduino program for reading the data at the bottom of the page.
|Left Joystick X
|Left Joystick Y
|Right Joystick X
|Right Joystick Y
|Accelerometer X (0-255) 128 center
|Accelerometer Y (0-255) 128 center
|Button Right Joystick
|Button Left Joystick
Registers for setting LEDs and Rumble motors..
|Rumble Motor Control
1 – Soft Rumble
2 – Short Heavy Rumble
3 – Long Heavy Rumble
Control the 4 LEDs by sending a single BYTE. Bits 0 – 3 controll the 4 LEDS
E.G 00000101 turns on LEDs 1 and 3
Documents and Links
Differences between PS3 Controllers
You can buy genuine Sony PS3 Controllers or you can buy cheap knock-offs on ebay. There are pro’s and cons to both which i will list here
Genuine Sony PS3 Controller
- All Features available
- Pressure sensitive button output
- Accelerometer outputs
- Rumble motors
- Quality Joysticks using full movement range
- Not cheap
- Bluetooth connectivity unavailable at present
There may be some different non-Sony controllers available but the one i bought from ebay was advertised widely by a number of vendors and represents a typical cheap controller. Check with the vendor before purchase that it has all the functionality.
- Comes with Bluetooth Dongle so wireless works straight away
- No Rumble Motors fitted
- No Accelerometer output
- Limited or no pressure sensitive output
- Inferior Joystick control. Max and min outputs occur at only half stick movement and there is a deadband in the center position
If you want a cheap wireless controller for joystick and buttons control, the cheap ebay items are ok. If you want the full features, quality stick movement, rumble motors, pressure sensitive button output and accelerometer output then the genuine Sony product is the one