PS4 Dualshock Controller (Bluetooth) - USB Host

HobbyTronics PS4 Dualshock Controller (Bluetooth) - USB Host
Click to enlarge
Model: PS4_BT
Manufacturer: HobbyTronics
Average Rating: Not Rated

HobbyTronics

PS4 Dualshock Controller (Bluetooth) - USB Host

This software is discontinued and has been replaced by a combined PS3/PS4 software

The USB PS4 Dualshock Controller Software allows you to connect a PS4 Dualshock Controller to one of our USB Host Boards and read the analog stick inputs, button presses, accelerometer and touchpad using I2C or serial TTL.

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).
To buy - See the USB Host Board and IC product pages (links on the pictures below) for details on pricing and installing this software.

Download Software
Click Here to Download (Version 1.00)
USB Host BoardUSB Host Mini
USB Host Boards
USB Host IC SOIC  USB Host IC DIP  USB Host IC SSOP
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.

  1. Power up the USB Host board with the Bluetooth Dongle plugged into the USB socket
  2. Blue LED should be flashing
  3. Briefly connect either the SDO (A) or SS pin to GND
  4. Blue LED should be flashing FASTER
  5. Press and hold the PS4 and Share buttons together on the PS4 controller until the PS4 led starts flashing.
  6. 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)

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

Arduino Robot Example using PS4 HEX serial or I2C data

 

Write Review
Your Name:


Your Review: Note: HTML is not translated!

Rating: Bad            Good

Enter the code in the box below:

There are no additional images for this product.
PS4 Dualshock Controller (Bluetooth) - USB Host
$ 0.00 New In Stock
Shopping Cart
0 items
 
DELIVERY/PAYMENT

Free Delivery Orders over £50

UK - £2.40 orders under £50
Airmail from £2.95 (+VAT)
More Details...

 
Brands
 
 Check out our videos
Follow us on:
acebook