PS2, PlayStation2 Controller Vibration Protocol

Anything that doesn't fit our other forums goes here.
3 postsPage 1 of 1
3 postsPage 1 of 1

PS2, PlayStation2 Controller Vibration Protocol

Post by Ray » Sun May 18, 2008 2:15 pm

Post by Ray
Sun May 18, 2008 2:15 pm

Since I can hardly find detailed description and properties of Vibration and Change mode technique of PS2 Controller in the Web Site (in English)

I start to study from simple experiments and hope it will be a good starting point to discuss. Here I leave my report for my back reference as well as information to other people, if interested.

You can also visit the following related web site if you know Japanese:
http://www.csie.ntu.edu.tw/~b89094/dual ... shock.html


Properties of PS2 Controller reading, Vibration and Mode.

1) The Status reading can be read any time by sending a series of command data, in which PS2 will send back a series of Data bytes that contain information of key pressed and the 4 values of the analog sticks. Here, I call this series of command data as “Command frame” for easy reference in later parts.

You can visit the following site for detailed mechanism.
http://www.csie.ntu.edu.tw/~b89094/dual ... s_eng.html

2) I had tried different clock rate to successfully access the Controllers, so it may not necessary a fixed clock freq.


3) It seems it will fool the PS2 Controller if you put too many Data frames together at a time. So, I only call one “Command frame” in a constant interrupt of around 16ms a time.

4) In order to make a PS2 Controller to vibrate (especially a wireless one) you should make a configuration first

A simple method is:
Frame 1--- Enter Config. Mode
CMD = 01 43 00 01 00 (00, 00, 00, 00)
DAT = -- ID SS XX XX(XX,XX,XX,XX)
Frame 2--- Vibration Enable
CMD = 01 4D 00 00 01 FF FF FF FF
DAT = -- ID SS XX YY FF FF FF FF
Frame 3-- Exit Config. Mode
CMD = 01 43 00 00 00 (00,00,00,00)
DAT = -- ID SS 00 00 (00,00,00,00)

Important Note:
i) the ( ) means it is optional depending you need to extract the data of the analog stick if you are in Analog Mode.
ii) If no ( ) are inserted, you need to send total 9 bytes out.
iii) I found some PS2 Controller (especially wired type) do not stictly follow all configuration sequences and can be simply to access. (e.g. just enter Frame2 and then read with Vib. Constantly)
iv) ID = Controller ID (e.g. 41 = Digital mode, 73 = Analog mode)
v) ID = F3 is called Native mode (detail is not known, please tell!)
vi) ID = 79 means there is error in the Controller.
vii) SS is the state of Controller, if it is 00, it means you had, e.g. pushed the analog button to change its state. In this case, the vibration will STOP and you need to re-config. the controller again (Unless you lock the PS2 in Analog mode). If it is 5A, it means (no change occurs)
viii) Vibration will STOP if no read command frame is send with 3 seconds starting from the configuration you had made.

Here is a vibration test video (Sorry for poor recording)
http://www.youtube.com/watch?v=2RdkRT2dJVA


5) To change the mode of PS2 you can simply push the “Analog” button or send “Command frame” and you can even lock the mode using “Command frame”

A simple method is:
Frame 1--- Enter Config. Mode
CMD = 01 43 00 01 00 (00, 00, 00, 00)
DAT = -- ID SS XX XX(XX,XX,XX,XX)
Frame 2--- Change Mode
CMD = 01 44 00 MM NN 00 00 00 00
DAT = -- ID SS 00 00 00 00 00 00
Frame 3-- Exit Config. Mode
CMD = 01 43 00 00 00 (00,00,00,00)
DAT = -- ID SS 00 00 (00,00,00,00)


Note: i) I found that the Vibration Enable should follow after the Mode Change if you need to vibrate by the config. sequence.
ii) The mode change will be CANCELLED if no “Read command frame” is sent back to the controller within 3 seconds.
iii) MM =00 for Digital Mode, MM=01 for Analog Mode
iv) NN = 03 to lock the mode, NN = 00 (no lock)
v) All 9 bytes must be sent in Frame 2

Here is the video
http://www.youtube.com/watch?v=WgRx8iOXiek


6) Finally the Read with vibration parameter

A simple method is:
Frame 1--- Enter Config. Mode
CMD = 01 42 00 MM NN (00, 00, 00, 00)
DAT = -- ID SS XX XX(XX,XX,XX,XX)

Note: i) MM = 00 then Right motor off (Some Controller may be left, ?)
ii) MM = 01 Right motor on ( 2 states, rotate or Not rotate)
iii) NN = 00 ~ FFH Left Motor Power (Strength from zero to max)

http://www.youtube.com/watch?v=QP2ocqAUYk0



Simple Algorithm using Interrupt

An interrupt will be called every 16ms to do one command frame only:
(Here I make a Forced Analog mode with Vibration of variable strength 00 ~ FFH)

1) Read Command Frame (with vibration parameter)
2) Check Analog Mode, i.e. If ID = 73H then 1), If ID <> 73H then 3)
3) Enter Config. Mode
4) If ID = F3 (Native Mode) then 5) Else, back to 1) (wait for next time)
5) Enable Forced Analog Mode
6) Enable Vibration Mode
7) Exit Config. Mode
8) Goto 1)

Note: i) You can stop the vibration simply setting MM = NN = 00H
ii) You can force the PS2 Controller in Digital mode in 5) instead.


Here is the Final Test of the Algorthm:
phpBB [media]
:wink:


(Had been edited for grammatical mistake)
Since I can hardly find detailed description and properties of Vibration and Change mode technique of PS2 Controller in the Web Site (in English)

I start to study from simple experiments and hope it will be a good starting point to discuss. Here I leave my report for my back reference as well as information to other people, if interested.

You can also visit the following related web site if you know Japanese:
http://www.csie.ntu.edu.tw/~b89094/dual ... shock.html


Properties of PS2 Controller reading, Vibration and Mode.

1) The Status reading can be read any time by sending a series of command data, in which PS2 will send back a series of Data bytes that contain information of key pressed and the 4 values of the analog sticks. Here, I call this series of command data as “Command frame” for easy reference in later parts.

You can visit the following site for detailed mechanism.
http://www.csie.ntu.edu.tw/~b89094/dual ... s_eng.html

2) I had tried different clock rate to successfully access the Controllers, so it may not necessary a fixed clock freq.


3) It seems it will fool the PS2 Controller if you put too many Data frames together at a time. So, I only call one “Command frame” in a constant interrupt of around 16ms a time.

4) In order to make a PS2 Controller to vibrate (especially a wireless one) you should make a configuration first

A simple method is:
Frame 1--- Enter Config. Mode
CMD = 01 43 00 01 00 (00, 00, 00, 00)
DAT = -- ID SS XX XX(XX,XX,XX,XX)
Frame 2--- Vibration Enable
CMD = 01 4D 00 00 01 FF FF FF FF
DAT = -- ID SS XX YY FF FF FF FF
Frame 3-- Exit Config. Mode
CMD = 01 43 00 00 00 (00,00,00,00)
DAT = -- ID SS 00 00 (00,00,00,00)

Important Note:
i) the ( ) means it is optional depending you need to extract the data of the analog stick if you are in Analog Mode.
ii) If no ( ) are inserted, you need to send total 9 bytes out.
iii) I found some PS2 Controller (especially wired type) do not stictly follow all configuration sequences and can be simply to access. (e.g. just enter Frame2 and then read with Vib. Constantly)
iv) ID = Controller ID (e.g. 41 = Digital mode, 73 = Analog mode)
v) ID = F3 is called Native mode (detail is not known, please tell!)
vi) ID = 79 means there is error in the Controller.
vii) SS is the state of Controller, if it is 00, it means you had, e.g. pushed the analog button to change its state. In this case, the vibration will STOP and you need to re-config. the controller again (Unless you lock the PS2 in Analog mode). If it is 5A, it means (no change occurs)
viii) Vibration will STOP if no read command frame is send with 3 seconds starting from the configuration you had made.

Here is a vibration test video (Sorry for poor recording)
http://www.youtube.com/watch?v=2RdkRT2dJVA


5) To change the mode of PS2 you can simply push the “Analog” button or send “Command frame” and you can even lock the mode using “Command frame”

A simple method is:
Frame 1--- Enter Config. Mode
CMD = 01 43 00 01 00 (00, 00, 00, 00)
DAT = -- ID SS XX XX(XX,XX,XX,XX)
Frame 2--- Change Mode
CMD = 01 44 00 MM NN 00 00 00 00
DAT = -- ID SS 00 00 00 00 00 00
Frame 3-- Exit Config. Mode
CMD = 01 43 00 00 00 (00,00,00,00)
DAT = -- ID SS 00 00 (00,00,00,00)


Note: i) I found that the Vibration Enable should follow after the Mode Change if you need to vibrate by the config. sequence.
ii) The mode change will be CANCELLED if no “Read command frame” is sent back to the controller within 3 seconds.
iii) MM =00 for Digital Mode, MM=01 for Analog Mode
iv) NN = 03 to lock the mode, NN = 00 (no lock)
v) All 9 bytes must be sent in Frame 2

Here is the video
http://www.youtube.com/watch?v=WgRx8iOXiek


6) Finally the Read with vibration parameter

A simple method is:
Frame 1--- Enter Config. Mode
CMD = 01 42 00 MM NN (00, 00, 00, 00)
DAT = -- ID SS XX XX(XX,XX,XX,XX)

Note: i) MM = 00 then Right motor off (Some Controller may be left, ?)
ii) MM = 01 Right motor on ( 2 states, rotate or Not rotate)
iii) NN = 00 ~ FFH Left Motor Power (Strength from zero to max)

http://www.youtube.com/watch?v=QP2ocqAUYk0



Simple Algorithm using Interrupt

An interrupt will be called every 16ms to do one command frame only:
(Here I make a Forced Analog mode with Vibration of variable strength 00 ~ FFH)

1) Read Command Frame (with vibration parameter)
2) Check Analog Mode, i.e. If ID = 73H then 1), If ID <> 73H then 3)
3) Enter Config. Mode
4) If ID = F3 (Native Mode) then 5) Else, back to 1) (wait for next time)
5) Enable Forced Analog Mode
6) Enable Vibration Mode
7) Exit Config. Mode
8) Goto 1)

Note: i) You can stop the vibration simply setting MM = NN = 00H
ii) You can force the PS2 Controller in Digital mode in 5) instead.


Here is the Final Test of the Algorthm:
phpBB [media]
:wink:


(Had been edited for grammatical mistake)
Last edited by Ray on Sat Feb 21, 2009 2:44 am, edited 3 times in total.
Ray offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 230
Joined: Sun Apr 23, 2006 1:00 am
Location: HK

Post by limor » Tue Jul 01, 2008 11:43 pm

Post by limor
Tue Jul 01, 2008 11:43 pm

I moved this thread from RB100 to to "General" because many people would not have seen this information which is of generic nature and very useful for any type of PS2 based robot control.
I moved this thread from RB100 to to "General" because many people would not have seen this information which is of generic nature and very useful for any type of PS2 based robot control.
limor offline
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by Robo1 » Wed Jul 02, 2008 3:09 pm

Post by Robo1
Wed Jul 02, 2008 3:09 pm

Cheers Ray

Good information I have a PS2 controller controlling my biped and I had always wondered about getting the vibration working. I will have to have a look into programming this tonight.

Thanks Bren
Cheers Ray

Good information I have a PS2 controller controlling my biped and I had always wondered about getting the vibration working. I will have to have a look into programming this tonight.

Thanks Bren
Robo1 offline
Savvy Roboteer
Savvy Roboteer
Posts: 501
Joined: Fri Jun 30, 2006 1:00 am
Location: UK - Bristol


3 postsPage 1 of 1
3 postsPage 1 of 1
cron