Shopping Cart

Posts

PS3 and Wiimote Game Controllers on the Arduino Host Shield: Part 2

Sony PS3 controller

Sony PS3 controller

This is the second part of a series of articles written to describe development of interface between Arduino and popular game controllers using USB Host Shield. Previous parts:

Revision 0.6 – 13th January 2010

Part 2: Develop the USB interface to the PS3 controller

1.       USB Reduced Hosts

Full USB hosts such as Windows and Linux based computers can manage a large variety of different USB devices and load appropriate USB drivers for each device. There is an enumeration or discovery phase where the host gathers information on the attached USB device and uses this information for the driver selection and configuration. In small embedded applications this is not possible or required to support this variety, so the application usually only supports a few devices, often only one. This means the discovery process can be much reduced since the results are already known. This will reduce the memory required for the application by hard coding the device configuration into the application.

Though the configuration will be hard coded, we still need to initially gather the information from the device itself and other sources.

The existing device drivers mentioned above for Windows and Linux are important in our development process. The Windows drivers are usually complete, but not available in source form. Linux drivers are available in source form, though not always as complete. Device manufacturers are usually very reluctant to provide information required to build a driver or embedded application. So we rely on copying Linux code or “sniffing” Windows code to give us guidance.

 2.        PS3 Game Controller USB Interface

The first thing is to get the device and configuration descriptors. This may be documented, but often not, so we will collect direct from the USB device itself. This may be done under Windows using a program such as USBView or using the Arduino and the host shield.

Using USBView: USBView Software

The PS3 controller is connected to the PC and then selected in USBView. The following descriptor information is delivered for the Sony PS3 controller when connected via USB.

Device Descriptor:
bcdUSB:             0x0200
bDeviceClass:       0x00
bDeviceSubClass:    0x00
bDeviceProtocol:    0x00
bMaxPacketSize0:    0x40 (64)
idVendor:           0x054C (Sony Corporation)
idProduct:          0x0268
bcdDevice:          0x0100
iManufacturer:      0x01
iProduct:           0x02
iSerialNumber:      0x00
bNumConfigurations: 0x01
ConnectionStatus:   DeviceConnected
Current Config Value: 0x01
Device Bus Speed:   Full
Device Address:     0x01
Open Pipes:         2
Endpoint Descriptor:
bEndpointAddress:   0x02
Transfer Type:      Interrupt
wMaxPacketSize:     0x0040 (64)
bInterval:          0x01
Endpoint Descriptor:
bEndpointAddress:   0x81
Transfer Type:      Interrupt
wMaxPacketSize:     0x0040 (64)
bInterval:          0x01

The report shows two additional endpoints besides the control endpoint (endpoint 0). The first of these is an input endpoint (0×02) and is where the host will receive reports from the PS3 game controller when anything changes. The second (0×81) is an output endpoint and is where the host can send reports to the PS3 controller, though these can also be sent via special messages on the control endpoint 0.

Taking the same report for the Madcatz PS3 shows that it also has almost identical information. It also shows with identical idVendor and idProduct. The only difference is in the MaxPacketSize0 which is 8 for the Madcatz. This difference is managed automatically by the USB library.

To read the device and configuration descriptors using the Arduino, we install the USB Host Shield and download the following USB_Desc sketch. The sketch uses this Modified USB Host Library. The library was modified from the version from Oleg to give a longer time for the device to deliver the descriptors. However in the non blocking code we need later, we also need sometimes not to wait at all. Therefore an additional change is made to allow for waiting or not.

The sketch reports the following descriptors with a bit more detail:

Start
freeMemory() reports 683
Device descriptor:
Descriptor Length:    12
Descriptor type:      01
USB version:          0200
Device class:         00
Device Subclass:      00
Device Protocol:      00
Max.packet size:      40
Vendor  ID:           054C
Product ID:           0268
Revision ID:          0100
Mfg.string index:     01
Prod.string index:    02
Serial number index:  00
Number of conf.:      01
Configuration descriptor:
Total length:         0029
Num.intf:             01
Conf.value:           01
Conf.string:          00
Attr.:                80
Max.pwr:              FA
Interface descriptor:
Intf.number:          00
Alt.:                 00
Endpoints:            02
Intf. Class:          03
Intf. Subclass:       00
Intf. Protocol:       00
Intf.string:          00
Unknown descriptor:
Length:               09
Type:                 21
Contents:             110100012294000705
Endpoint descriptor:
Endpoint address:     02
Attr.:                03
Max.pkt size:         0040
Polling interval:     01
Endpoint descriptor:
Endpoint address:     81
Attr.:                03
Max.pkt size:         0040
Polling interval:     01
memoryMin() reports 336

Also here you see the reports from freeMemory and memoryMin(), which for this example were added to check the memory consumption of the USB stack. These are not usually present in the report. There is also an unknown report which is a class report for the HID device. The large difference between freeMemory and memoryMin in this example is due to a 256 byte buffer being defined for the configuration data plus there is also about 100 bytes of stack in data memory used by the USB library. The text strings were moved to program memory with a special print function, otherwise it would not fit into the available data memory of an ATMega168.

 
3.           Configuring the USB library to connect the PS3 game Controller

Having obtained the descriptor information, this is coded into the USB configuration of the USB library. The library requires a structure for each endpoint to contain this data and this structure is then provided to the library using the Usb.setDevTableEntry() function. 

/* Endpoint information structure               */
 
/* bToggle of endpoint 0 initialized to 0xff    */
 
/* during enumeration bToggle is set to 00      */
 
typedef struct {       
 
    byte epAddr;        //copy from endpoint descriptor without bit 7 if set
 
    byte Attr;          // Endpoint transfer type.
 
    unsigned int MaxPktSize;    // Maximum packet size.
 
    byte Interval;      // Polling interval in frames.
 
    byte sndToggle;     //last toggle value, bitmask for HCTL toggle bits
 
    byte rcvToggle;     //last toggle value, bitmask for HCTL toggle bits
 
} EP_RECORD;

We then also make a check to confirm that the device connected is the one which we support by checking the VID and PID in the device descriptor.If this is successful we set the configuration for the device and then we have three pipes connected to the PS3 device from the Arduino and communication is established.

device_descriptor = (USB_DEVICE_DESCRIPTOR *) &buf;
 
    if(
 
    (device_descriptor->idVendor != PS3_VID) ||(device_descriptor->idProduct != PS3_PID)  ) {
 
        Serial.println("Unsupported USB Device");
 
          while(1);  //stop  

 4.        Communication with the Game controller from a sketch

Having established communication we now have to send commands and receive reports in the format the PS3 game controller requires. This format is somewhat described in the documents mentioned in the first article and emulated in the software for linux and python. This information was probably obtained from “sniffing” the interaction of the game controller to a PS3. I do have a USB sniffer from Ellisys which could connect between a PS3 and the controller, but I do not have a PS3. So I relied on published information and also “sniffed” the connection between the game controller and a PC running the Motioninjoy software.

Motioninjoy is probably the most complete PC application to support the PS3 controller so should offer the best information. To sniff the connection I used a PC based program called SnoopyPro

Between the setting of the configuration and the receipt of data on the input pipe , there are two commands sent to the PS3 game controller. The first sets the game controller to send 01 type reports to the input pipe whenever any changes occur on the controller.
SetupPacket:
0000: 21 09 f4 03 00 00 04 00
bmRequestType: 21
DIR: Host-To-Device
TYPE: Class
RECIPIENT: Interface
bRequest: 09
TransferBuffer: 0×00000004 (4) length
0000: 42 0c 00 00

This can be performed using the USB library by:

#define PS3_F4_REPORT_LEN 4
#define HID_REPORT_FEATURE 3
#define PS3_F4_REPORT_ID  0xF4
prog_char feature_F4_report[] PROGMEM = {0x42, 0x0c, 0x00, 0x00};
 
  /* Set the PS3 controller to send reports */
    for (i=0; i<ps3_F4_REPORT_LEN; i++) buf[i] = pgm_read_byte_near( feature_F4_report + i);
    rcode = Usb.setReport( PS3_ADDR, ep_record[ CONTROL_PIPE ].epAddr, PS3_F4_REPORT_LEN,  PS3_IF, HID_REPORT_FEATURE, PS3_F4_REPORT_ID , buf );
    if( rcode ) {
        Serial.print("Set report error: ");
        Serial.println( rcode, HEX );
        while(1);  //stop
    }

Here the report content was held in program memory.

The second command packet is not essential, but sets the LEDs on the game controller so that it stops flashing and goes to light LED 1 constantly. This command is developed later to control all the LED and rumble. 

SetupPacket:

0000: 21 09 01 02 00 00 30 00

bmRequestType: 21

  DIR: Host-To-Device

  TYPE: Class

  RECIPIENT: Interface

bRequest: 09 

TransferBuffer: 0×00000030 (48) length

0000: 00 ff 00 ff 00 00 00 00 00 02 ff 27 10 00 32 ff

0010: 27 10 00 32 ff 27 10 00 32 ff 27 10 00 32 00 00

0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

This can be performed using the USB library by: 

#define PS3_01_REPORT_LEN 48
#define HID_REPORT_OUTPUT  2
#define PS3_01_REPORT_ID  0x01
prog_char output_01_report[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                     0x00, 0x02, 0xff, 0x27, 0x10, 0x00, 0x32, 0xff,
                                     0x27, 0x10, 0x00, 0x32, 0xff, 0x27, 0x10, 0x00,
                                     0x32, 0xff, 0x27, 0x10, 0x00, 0x32, 0x00, 0x00,
                                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
 
   /* Set the PS3 controller LED 1 On */
    for (i=0; i<ps3_01_REPORT_LEN; i++) buf[i] = pgm_read_byte_near( output_01_report + i);
    rcode = Usb.setReport( PS3_ADDR, ep_record[ CONTROL_PIPE ].epAddr, PS3_01_REPORT_LEN,  PS3_IF, HID_REPORT_OUTPUT, PS3_01_REPORT_ID , buf );
    if( rcode ) {
        Serial.print("Set report error: ");
        Serial.println( rcode, HEX );
        while(1);  //stop
    }

01 type reports can now be read from the input pipe using: 

/* Poll PS3 interrupt pipe and process result if any */
 
void PS3_poll( void )
 
{
    byte rcode = 0;     //return code
    /* poll PS3 */
    rcode = Usb.inTransfer(PS3_ADDR, ep_record[ INPUT_PIPE ].epAddr, PS3_01_REPORT_LEN, buf );
    if( rcode != 0 ) {
       return;
    }
    process_report();
    return;
}

 

5.        Interpreting and using PS3 reports

The 01 type reports are formatted as follows:

//Structure which describes the type 01 input report
typedef struct {
    unsigned char ReportType;     //Report Type 01
    unsigned char Reserved1;      // Unknown
    unsigned int  ButtonState;    // Main buttons
    unsigned char PSButtonState;  // PS button
    unsigned char Reserved2;      // Unknown
    unsigned char LeftStickX;     // left Joystick X axis 0 - 255, 128 is mid
    unsigned char LeftStickY;     // left Joystick Y axis 0 - 255, 128 is mid
    unsigned char RightStickX;    // right Joystick X axis 0 - 255, 128 is mid
    unsigned char RightStickY;    // right Joystick Y axis 0 - 255, 128 is mid
    unsigned char Reserved3[4];   // Unknown
    unsigned char PressureUp;     // digital Pad Up button Pressure 0 - 255
    unsigned char PressureRight;  // digital Pad Right button Pressure 0 - 255
    unsigned char PressureDown;   // digital Pad Down button Pressure 0 - 255
    unsigned char PressureLeft;   // digital Pad Left button Pressure 0 - 255
    unsigned char PressureL2;     // digital Pad L2 button Pressure 0 - 255
    unsigned char PressureR2;     // digital Pad R2 button Pressure 0 - 255
    unsigned char PressureL1;     // digital Pad L1 button Pressure 0 - 255
    unsigned char PressureR1;     // digital Pad R1 button Pressure 0 - 255
    unsigned char PressureTriangle;   // digital Pad Triangle button Pressure 0 - 255
    unsigned char PressureCircle;     // digital Pad Circle button Pressure 0 - 255
    unsigned char PressureCross;      // digital Pad Cross button Pressure 0 - 255
    unsigned char PressureSquare;     // digital Pad Square button Pressure 0 - 255
    unsigned char Reserved4[3];   // Unknown
    unsigned char Charge;         // charging status ? 02 = charge, 03 = normal
    unsigned char Power;          // Battery status ?
    unsigned char Connection;     // Connection Type ?
    unsigned char Reserved5[9];   // Unknown
    unsigned int AccelerometerX;  // X axis accelerometer Big Endian 0 - 1023
    unsigned int Accelero         // Y axis accelerometer Big Endian 0 - 1023
    unsigned int AccelerometerZ;  // Z axis accelerometer Big Endian 0 - 1023
    unsigned int GyrometerX;      // Z axis Gyro Big Endian 0 - 1023
 
} TYPE_01_REPORT;

 

The state of the game controller buttons is contained in the ButtonState and PSButtonState variables mapped as follows: 

#define buSelect    (PS3Report->ButtonState & 0x0001)
#define buLAnalog   (PS3Report->ButtonState & 0x0002)
#define buRAnalog   (PS3Report->ButtonState & 0x0004)
#define buStart     (PS3Report->ButtonState & 0x0008)
#define buUp        (PS3Report->ButtonState & 0x0010)
#define buRight     (PS3Report->ButtonState & 0x0020)
#define buDown      (PS3Report->ButtonState & 0x0040)
#define buLeft      (PS3Report->ButtonState & 0x0080)
#define buL2        (PS3Report->ButtonState & 0x0100)
#define buR2        (PS3Report->ButtonState & 0x0200)
#define buL1        (PS3Report->ButtonState & 0x0400)
#define buR1        (PS3Report->ButtonState & 0x0800)
#define buTriangle  (PS3Report->ButtonState & 0x1000)
#define buCircle    (PS3Report->ButtonState & 0x2000)
#define buCross     (PS3Report->ButtonState & 0x4000)
#define buSquare    (PS3Report->ButtonState & 0x8000)
#define buPS        (PS3Report->PSButtonState & 0x01)

  

The Accelerometer and Gyro values are in Big Endian format and need byte swapping before use as an unsigned integer value.

The following example program shows how the values can be used from the report. The example used the LCD display connected to the USB Host Shield. The example also controls the LED and rumble motors. This example does not use the library described below. PS3 LCD sketch.

A menu item is provided in the example to read and set the Bluetooth Device Address of the Game controller. This is used in the pairing process for the game controller when in Bluetooth mode. This setup can alternatively be done with sixpair.c under linux, or Motioninjoy under windows.

6.        A PS3 Game Controller Library

The PS3_USB library adds support for the Sony PS3 Game controller to the Arduino by USB cable on the USB Host Shield from Circuits@Home. It allows a sketch to gather information from the PS3 Game Controller including buttons, joysticks and accelerometers. It also allows output to the LED and rumble features of the Game controller. Additional function is provided to read and write Bluetooth addresses for pairing in Bluetooth mode.

The library requires the USB Host Shield to be installed and uses the libraries developed for the shield, it is not compatible with other USB ports at present. The shield and the libraries do consume memory considerable resources on the Arduino; though they can be supported on most Arduino variants even the ATMega168 based boards with 1K of RAM.

Connections:
The USB Host shield is assembled and links configures depending on the Arduino variant used. The shield supports 3.3V and 5V Arduino in different configurations. The GPIO connections are not required by this library, but another library MaxLCD exists to support an optional LCD display on this interface if required. The USB Host shield uses digital pins D7 through D13 and these pins are not available to the sketch for other purposes. Power for the USB device is derived from the Arduino, so sufficient power must be provide from the USB or external power supply.
The Sony PS3 Game controller is connected by USB cable to the USB A connector on the host shield. The library is tested with the Sony Controller PS3 Game controller and also the Madcatz wireless PS3 game controller which is wireless connected from the game controller to a Madcatz USB dongle. The Madcatz does not support the rumble feature.

Methods:

void init(void);

A method to perform low level initialisation of the PS3 class, should be called in the setup() function to perform hardware initialisation of the USB Host Shield before calling task().

void task( void );

This method must be called regularly to manage the all events occurring on the USB port. Calls to this routine should be made in the range of once per millisecond to 20 times per second. The report data from the PS3 Game Controller will not be available if this routine is not called regularly.

unsigned char getStatus(void);

This method returns an unsigned character to show the status of the USB and PS3 connection. Bits are used as follows:
bit 0: statusDeviceConnected Set when a USB device is plugged into the USB port on the Host Shield
bit 1: statusUSBConfigured Set when a valid PS3 device is detected and configured
bit 2: statusPS3Connected Set when the PS3 device is connected and sending reports based on changes on the controller (buttons pressed, joystick moved,..)
bits 3: statusReportReceived Set when a report is received from the PS3 controller that a change has occurred on one of the parameters. This bit is cleared by the stat_report_received() method;

bool statConnected(void);

This method returns the state of the statusPS3Connected bit for the attached device.

bool statReportReceived(void);

This method returns the state of the statusReportReceived bit for the attached device. Calling this method also clears the bit if set.

bool buttonChanged(void);

This method returns true if a Game Controller button has been pressed or released, since the last call to this method.

bool buttonPressed(unsigned char button);

This method returns the state of the Game Controller button specified in the call. True if button pressed. Buttons are:

#define buSelect 0
#define buLAnalog 1
#define buRAnalog 2
#define buStart 3
#define buUp 4
#define buRight 5
#define buDown 6
#define buLeft 7
#define buL2 8
#define buR2 9
#define buL1 10
#define buR1 11
#define buTriangle 12
#define buCircle 13
#define buCross 14
#define buSquare 15
#define buPS 16
void LEDRumble(unsigned char ledrum);

This method sets the state of the LEDs and rumble motors on the Game Controller. Ledrum values are:

#define psLED1 0x01
#define psLED2 0x02
#define psLED3 0x04
#define psLED4 0x08
#define psRumbleHigh 0x10
#define psRumbleLow 0x20
unsigned int getMotion(unsigned char accel);

This method returns the value read from the accelerometer or Gyro in the Game Controller. Values are in range 0 to 1023 with 512 as centre. Accel values are:

#define AccelerometerX 0
#define AccelerometerY 1
#define AccelerometerZ 2
#define GyrometerZ 3
unsigned char getJoystick(unsigned char joystick);

This method returns the value read from the joystick on the Game Controller. Values are in range 0 to 255. Joystick values are:

#define leftJoystickX 0
#define leftJoystickY 1
#define rightJoystickX 2
#define rightJoystickY 3
unsigned char getPressure(unsigned char button);

This method returns the value read for the button pressure on the Game Controller. Values are in range 0 to 255. Button values are:

#define buUp 4
#define buRight 5
#define buDown 6
#define buLeft 7
#define buL2 8
#define buR2 9
#define buL1 10
#define buR1 11
#define buTriangle 12
#define buCircle 13
#define buCross 14
#define buSquare 15
void setBDADDR(unsigned char * bdaddr);

This method sets the master Bluetooth address to the PS3 Game Controller. The master Bluetooth address is the address where the Game controller will attempt to make a Bluetooth connection when pairing. Bdaddr[6] is a six unsigned char array containing the Bluetooth address with least significant byte first.

void getBDADDR(unsigned char * bdaddr);

This method gets the master Bluetooth address in the PS3 Game Controller. The master Bluetooth address is the address where the Game controller will attempt to make a Bluetooth connection when pairing. Bdaddr[6] is a six unsigned char array containing the Bluetooth address with least significant byte first.

Memory usage:
The library is fairly complex and takes about 5000 bytes of program memory depending on the methods actually used. Due to the complexity and data buffers the data memory usage is about 350 bytes. Since no warning is generated at compile time of data memory usage, care should be taken to monitor and manage consumption. MemoryFree() can be used to check data memory usage. While this fits onto the AtMega168, it may be better to use a larger device if additional code/libraries are complex or if a large number of serial.print() functions are used.

Example sketch:
The test sketch included in the download demonstrates many of the capabilities of the library.
Get Arduino PS3 Library here

No related posts.

28 comments to PS3 and Wiimote Game Controllers on the Arduino Host Shield: Part 2

  • Sam

    Hi. I’m in my school’s robotics club and we’re following these guides to try and sync up a PS3 controller to an arduino board to control our robot. We have got the PS3LCD sketch to compile (finally) and now have absolutely no idea where to connect the pins? Is there a clear picture of how to connect it all up? We really need to know just what pins to plug into where from where and all that.

    Any help would be incredibly appreciated. :)
    Thanks so much and keep up the good work.
    Sam.

  • LCD pinout is given at the top of Max_LCD.h .

  • David

    Hi Oleg, I am also having difficulty with the instructions. When uploading to arduino I get error; Spi.h no such file or directory. I’m sure it’s something simple but what am I overlooking?

    Many thanks,

    David

  • David

    Hi again, after posting I realised that I had the spi.h file in wrong folder. Now I just need to find the memoryfree library…

    David

  • Sam

    pinout: D[4-7] -> GPOUT[4-7], RS-> GPOUT[2], E ->GPOUT[3]

    I assume that this is what you’re talking about. :)
    Basically, we are having a little trouble understanding and reading it. To test our LCD screen we used the program and wiring located here: http://www.hacktronics.com/Tutorials/arduino-character-lcd-tutorial.html

    Would you be able to help us translate which wires go from which pin to which LCD pin? The only one I see the same is RS. If you could help clear this up, I would seriously be so grateful. :) Were running out of time for a competition.

    Thanks anyone. :)

    • D4-7 is Data 4-7, E is Enable, power, contrast is the same. RW has to be grounded. The LCD pins go to GPOUT pins on the USB Host Shield and Max_LCD library is used to interface to LCD. Functions are “manual comtatible” with ones from standard Arduino library.

  • Sam

    Okay, actually I think we’ve figured that out. E stand for Enable?

    The other thing we’re wondering is whether we need to have purchased the Max3421e IC? It is shown on a lot of the pictures next to where all the wires are plugged in.

    Thank you.

  • Mark

    I also need to know whether my teams needs to purchase the max3421e IC?

    • MAX3421E is on the shield. If you mean level converter for GPOUT, it’s called 74HCT245 (U8 on the schematic). If you need 5V signals out, then yes, you need to solder this on.

  • Corey

    Is there any way I can get your email or another way to contact you a different way? By phone, email, or Intanst Message. We really need help with our club. And we will give credit where needed!

    Thanks!

  • I purchased a Mad Catz controller to be able to use the PS3 controller wirelessly. It looks as though they have revised it from the controller that you have. The dongle looks different. It also appears that the Device Descriptor is not the same as the one you were using. At first, the dongle didn’t even light up, or connect. I noticed the idVendor, and idProduct are different, and I changed these in PS3_usb to match. The light worked, and the remote connected, but I’m not getting any output from the PS3_servo program. Can you tell what else is different that I may need to change?

    Device Descriptor:
    bcdUSB: 0×0110
    bDeviceClass: 0×00
    bDeviceSubClass: 0×00
    bDeviceProtocol: 0×00
    bMaxPacketSize0: 0×40 (64)
    idVendor: 0×0738 (Mad Catz, Inc.)
    idProduct: 0xA856
    bcdDevice: 0×0313
    iManufacturer: 0×01
    iProduct: 0×02
    iSerialNumber: 0×00
    bNumConfigurations: 0×01

    ConnectionStatus: DeviceConnected
    Current Config Value: 0×01
    Device Bus Speed: Full
    Device Address: 0×02
    Open Pipes: 2

    Endpoint Descriptor:
    bEndpointAddress: 0×81 IN
    Transfer Type: Interrupt
    wMaxPacketSize: 0×0040 (64)
    bInterval: 0x0A

    Endpoint Descriptor:
    bEndpointAddress: 0×02 OUT
    Transfer Type: Interrupt
    wMaxPacketSize: 0×0040 (64)
    bInterval: 0×01

  • Richard

    What are the leds on the PS3 controller doing ?

    What is the full model number of the Madcatz ? I will try to find one.

  • Richard

    Hi Dan,

    When you say it works on the computer is that a PS3 or a PC. If PC what software package ?

    I will try to find one.

    Thanks,
    Richard

  • Richard

    Hi Dan,

    Managed to get hold of an 88561, and set it up.
    The operation seems much more simple than the Sony controller, and the report format is different.
    There are no LEDS or rumble motors, so simple there ! Buttons, sticks and pressure works OK. Values relating to the Accelerometers and gyro seems to be returned, but they never change. Do you know if they are present on this controller ?
    I will put up a sketch to show support of buttons, sticks and pressure, but let me know if I miss something on motion sensing.
    Richard

    • Hi Richard,
      Thanks for checking it out. I thought it’s supposed to be a six axis controller.
      How does the PS3 manage to read this controller if the report format is that much different?
      In the meantime I’ve managed to find a used Madcatz controller like you used, and it works great. I would still like to use the newer one too, so let me know when you have that sketch posted.
      Any idea if you will get around to making the PS3 controller work over bluetooth. That would be awesome.
      Thanks,
      Daniel

    • David

      Hi Richard,

      Did you manage to put together a sketch for the 88561 Mad Catz Controller? I would like to know what changes needed to be made in order to get this controller to work.

      Thanks,
      David

    • Daniel

      Richard,
      I haven’t seen a sketch that uses the 88561 controller. Did you post that somewhere? Any advancements on getting the PS3 controller to work over bluetooth, or has this been abandoned?
      Thanks,
      Daniel

  • Brad

    Richard,

    I’ve been trying to use your code to connect a Sony PS3 Six-axis Dual Shock 3 controller through USB to the USB host shield. I’ve tried the USB_desc sketch and can’t get anything to print to the Serial terminal. I did use your blueutils sketch to connect a bluetooth dongle through USB. That worked and I was able to put my computer in bluetooth discovery mode which the bluetooth dongle saw, and I got a print out on the serial terminal saying it was connected. The only problem I’m having is hooking up the PS3 controller through USB. I need to inject the bluetooth address of the dongle into it for it to connect to the dongle. Wondering if you had any ideas? I’m looking forward to seeing parts 4 and 5!

    Thanks,
    Brad

  • Richard

    Sorry for the delay in posting the Madcatz code, I have been distracted by other projects, and had to go back and search for it.
    As I said above, there is no LED or rumble, and I don’t think any Accelerometer/Gyro (unless you tell me otherwise). Motion values do not change.
    Example code is now here:
    http://github.com/ribbotson/USB-Host/blob/master/examples/MadPS3LCD.pde
    I didn’t check out all the HID reports, so I may have missed something

    I wil go search for the PS3 Bluetooth code now!

    • Daniel

      Richard,
      Thanks, I will give that a try and let you know. Too bad to hear you got distracted by other projects. This was a very cool project, and an informative tutorial. Looking forward to the PS3 code.
      Thanks,
      Daniel

  • Dmitry

    Hi!

    I was wondering if it is possible to use another game controllers like this one?

    Do they share the protocol, or not?

    Thanks!

  • Hey,

    I’ve been trying to compile the example sketches, and get error referring to the SPI library.
    I found out this library has been changed as of Arduino 19 and the new version is included in the distribution. So no go in Arduino 1.0 and Arduino 23.

    The sketches from Richard are written for the Spi.h for Arduino 18 or earlier.
    I installed Arduino 18, but the old Spi.h isn’t included in that distribution, it was an extra library.
    I can no longer find it on the Arduino playground.
    If anyone has an old copy of this file it would be a great help. I’m looking for: Spi.h (as opposed to SPI.h from Arduino19)

    Thx for the interesting work – Lieven

  • Hi Richard,
    thank you for your information about PS3 and Wiimote Game Controllers… very interesting…

  • Jim

    Hi in my country we have this usb host shield it uses Vinculum 2 instead of MAX3421E
    can I use this for connecting to PS3 Controller

    product page
    http://www.e-gizmo.com/KIT/USBHOST.htm

    data sheet of the shield
    http://www.e-gizmo.com/KIT/images/usbhost/USBHOST%20Rev1r0.pdf

Leave a Reply

  

  

  



You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">