PS4 Dualshock Controller (Bluetooth) - USB Host
![]() Cliquer pour agrandir |
![]() |
PS4 Dualshock Controller (Bluetooth) - USB Host
This software is discontinued and has been replaced by a combined PS3/PS4 software
It's time to give up your RC Transmitter with its limited number and type of controls and use the versatile PS4 Game Controller for your robotics project. With the use of a compatible Bluetooth Dongle you can now connect to your PS4 Controller wirelessly using the built-in Bluetooth. This makes using a PS4 controller as the basis for your robotics project very easy to implement.
This is a free software download for our USB Host Board and USB Host IC's (SOIC, DIP, SSOP). |
![]() Click Here to Download (Version 1.00) |
![]() ![]() USB Host Boards |
![]() ![]() ![]() USB Host IC's |
Features
- Bluetooth Connection to PS4 controller
- Easily Pair PS4 with Bluetooth Dongle
- Serial communication at baud rates 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200
- I2C communication
- PS4 Bluetooth has a range of approx 50m
-
PS4 Controller has
- 8 Analog Outputs (Joysticks, Accelerometer, Triggers)
- 18 buttons
- X/Y Trackpad Analog Output
Use it to
- Control a Robotic Arm and grabber (robot claw)
- Control wheeled or tracked vehicles or robots
- Replace an RC Radio system
- Control all features of an R2D2 droid
Pairing with your PS4 Controller
Just as with any bluetooth connection, the Bluetooth Dongle and your PS4 Controller have to be paired in order to communicate.
Pairing the PS4 controller with the bluetooth dongle only needs to be done once.
Our code makes pairing very straightforward; just follow these steps.
- Power up the USB Host board with the Bluetooth Dongle plugged into the USB socket
- Blue LED should be flashing
- Briefly connect either the SDO (A) or SS pin to GND
- Blue LED should be flashing FASTER
- Press and hold the PS4 and Share buttons together on the PS4 controller until the PS4 led starts flashing.
-
The units should now pair and connect.
When connected the motors will rumble and the LED will turn solid blue (default)
Reading the Data
As mentioned, there are two ways to obtain the PS4 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.
The default settings are for Serial Output ON and Hex ON. For testing purposes it is recommended to turn the Hex output OFF first.
Serial Data Output
The Serial data output (non-hex) is designed for testing purposes and is human readable in decimal values.
For decoding using a microcontroller, use the fixed format HEX output instead
The Serial Data output looks like the following
PS4,129,128,128,128,90,94,0,0,000000000000000000,0,0,0\r\n
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 fixed format, so specific data is always in the same position. This makes it great for decoding with a microcontroller and useful for transmission via XBee radio to remote devices.
Each transmission is prefixed by characters "PS4" and ends with CRLF.
A total of 20 characters is transmitted ( 3 for PS4, 8 bytes of analog data, 3 bytes for buttons, 2 bytes trackpad data, 1 Battery Voltage, 1 CRC, 2 for CRLF)
Byte | Description |
Header (3 bytes) |
|
1 | "P" |
2 | "S" |
3 | "4" |
Analog Data (8 bytes) |
|
4 | Left Joystick X |
5 | Left Joystick Y |
6 | Right Joystick X |
7 | Right Joystick Y |
8 | Accelerometer X |
9 | Accelerometer Y |
10 | L2 |
11 | R2 |
Buttons (3 chars) |
|
12 bits 0-3 |
Compas Pad Button Press These 4 bits are treated as a item with the following value 0 = N 1 = NE 2 = E 3 = SE 4 = S 5 = SW 6 = W 7 = NW 8 = No button pressed |
12 bit 4 | Square |
12 bit 5 | X |
12 bit 6 | Circle |
12 bit 7 | Triangle |
13 bit 0 | L1 |
13 bit 1 | R1 |
13 bit 2 | L2 |
13 bit 3 | R2 |
13 bit 4 | Share |
13 bit 5 | Options |
13 bit 6 | L3 |
13 bit 7 | R3 |
14 bit 0 | PS4 |
14 bit 1 | TPad |
Trackpad (2 chars) |
|
15 | TPad X |
16 | TPad Y |
Battery (1 char) |
|
17 | Battery Voltage (values from 0-15) |
Footer (3 chars) |
|
18 | CRC Checksum |
19 | \R |
20 | \N |
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 in 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.
I2C Register | Description |
Analog Data |
|
0 | Left Joystick X |
1 | Left Joystick Y |
2 | Right Joystick X |
3 | Right Joystick Y |
4 | Accelerometer X |
5 | Accelerometer Y |
6 | L2 |
7 | R2 |
Buttons |
|
8 bits 0-3 |
Compas Pad Button Press These 4 bits are treated as a item with the following value 0 = N 1 = NE 2 = E 3 = SE 4 = S 5 = SW 6 = W 7 = NW 8 = No button pressed |
8 bit 4 | Square |
8 bit 5 | X |
8 bit 6 | Circle |
8 bit 7 | Triangle |
9 bit 0 | L1 |
9 bit 1 | R1 |
9 bit 2 | L2 |
9 bit 3 | R2 |
9 bit 4 | Share |
9 bit 5 | Options |
9 bit 6 | L3 |
9 bit 7 | R3 |
10 bit 0 | PS4 |
10 bit 1 | TPad |
Trackpad |
|
11 | TPad X |
12 | TPad Y |
Battery Voltage |
|
13 | Battery Voltage (values from 0-15) |
Configuration Settings
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.
SERIAL <value> |
Set Serial Output ON/OFF [ON|OFF] Default: ON |
HEX <value> |
Set Serial Hex Output ON/OFF [ON|OFF] Default: OFF |
BAUD <value> |
Set Serial Port Baud Rate [2400|4800|9600|14400|19200|38400|57600|115200] Default 9600 (we recommend using 115200) |
RGB <value> |
Set PS4 LED RGB value when connected Default 0000A0 |
I2C <value> |
Set I2C Address [1-127] Default: 41 |
BAUD Rate
The USB Host board will communicate over serial TTL at the following baud rates
- 2400
- 4800
- 9600
- 14400
- 19200
- 38400
- 57600
- 115200 (default)
The default baud rate is 9600, but we recommend using a faster baud rate of 115200
SERIAL
SERIAL turns on or off the output of serial data when the PS4 controller is plugged in. Data is output in ASCII text format.
Turn it on for testing the PS4 controller or if your want the serial data. Turn it off when using I2C communication to save on processing.
HEX
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.
RGB
Set the PS4 LED colour once connection is made. Enter 6 digit hexadecimal value for Red, Green and Blue portions
I2C Address
The I2C default address is 41. This can be changed to any value between 1 and 127 using the I2C command
Help
Help can be displayed at any time by typing ? or HELP
The current settings for SERIAL and I2C address are displayed.
? USB Host PS4 (Bluetooth) Dual Shock Controller v1.00 SERIAL <value> - Set Serial Data Output On/Off (ON) - [ON|OFF] HEX <value> - Set Serial Data Output Hexadecimal On/Off (ON) - [ON|OFF] BAUD <value> - Set Serial Port Baud Rate [2400|4800|9600|14400|19200|38400|57600|115200] I2C <value> - Set I2C Address (41 ) [1 - 127] RGB <value> - LED RGB value (6 digit hex value. e.g. 00FF00) (0000A0) HELP or ? - display help
Compatable Bluetooth Dongles
To connect with the PS4 controller you need a Bluetooth dongle that supports high speed data and EDR.
We have a suitable dongle available here |
![]() |
Documents and Links
![]() USB Host Controller Board V2.4 USBHOST2 17,93€ ![]() |
![]() CSR Bluetooth 4.0 USB Adapter Dongle BT4-USB 6,48€ |
![]() PS3 Dualshock Controller - USB Host PS3 |
![]() USB Host Controller IC - SSOP USBHOST-SSOP 6,48€ |
![]() USB Host Controller IC - SOIC USBHOST-SOIC 6,48€ |
![]() USB Host Controller IC - DIP28 USBHOST-DIP 6,48€ |
![]() USB Host Mini V2 USBHOST-MINI 16,78€ |
![]() USB Host Board - USB Mouse Software USBHOST-MOUSE |
![]() Teensy Robot Controller Board Kit TEENSY-ROBOT 12,95€ |
![]() USB Host Board - USB Modem Software USBHOST-MODEM |
![]() USB Host - Serial Driver for FTDI, CP210X, PL2303, CH340G USBHOST-SERIAL ![]() |
![]() USB Host Board - USB Joystick Software USBHOST-JOYSTICK |
![]() USB Host Board - MIDI device USBHOST-MIDI ![]() |
![]() USB Host Board - CDC Class Serial Software USBHOST-CDC ![]() |
![]() USB Flash Drive Reader/Writer USBHOST-FLASH ![]() |
![]() USB Host Board XBee Shield Kit USBHOST-XBEE 4,73€ |
![]() USB Host - Keyboard to ASCII Converter USBHOST-KEYBOARD ![]() |
![]() PS3 and PS4 Dualshock Controller (Bluetooth) - USB Host PS34_BT ![]() |
Votre avis : N.B. : Le HTML n'est pas pris en charge !
Évaluation : Mauvais Bon
Saisir le code ci-dessous :