PS2 Controller Starter Kit SKPS User’s Manual V1.0 Oct 2008 Information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications.
ROBOT . HEAD to TOE Product User’s Manual – SKPS Index 1. Introduction 1 2. System Overview 2 3. Packing List 3 4. Board Layout 4 5. Product Specification and Limitations 5 6. Hardware Interface 6 6.1 Microcontroller 6 6.2 Computer 8 6.3 PS2 Controller 14 7. Protocol 19 7.1 Non-ASCII Mode (Microcontroller) 19 7.1.1 Button and PS2 Controller Status 19 7.1.2 On Board Vibrator Motor Control 20 7.2 ASCII Mode (Computer) 21 7.2.1 Button and PS2 Controller Status 21 7.2.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 1. INTRODUCTION Play Station 2 (PS2) controller is relatively easy to obtain from any game store and it offers good human manual input for control system. More and more developers are looking into applying existing PS2 controller to control particular system. The major problem to archive this is the socket for PS2 and the protocol to communicate with it. PS2 socket is very unique and difficult to source.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 2. SYSTEM OVERVIEW Sony PS2 Controller Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 3. PACKING LIST Please check the parts and components according to the packing list. If there are any parts missing, please contact us at sales@cytron.com.my immediately. 1. 2. 3. 4. 1 x SKPS board. 1 x mini jumper of SKPS board. 4 x 2510 iron pin. 1 x 2510 4 ways female connector. Note: SKPS does not come with PS2 controller, please purchase separately from Cytron Technologies website.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 4. BOARD LAYOUT C B D A E F G Label A B C D E F G Function PS2 connector socket, please connect the PS2 controller here 5 ways header pin for external power and UART interface to microcontroller. 4 ways 2510 header pin for external power and interface to PC or microcontroller also (depends to user). On board power indicator LED (Green) On board indicator LED (Blue) indicators for check connection with controller status. On board reset button for SKPS.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 5. PRODUCT SPECIFICATION AND LIMITATIONS SKPS is designed to offer a compact and reliable PS2 Controller Converter for user. The specifications are as listed below: Label Definition Function Power Input for SKPS External power source for SKPS, the typical voltage is 5V. Please ensure this 5V source is a stable supply. Please do not use normal AC-DC adaptor to power it. It is recommended to use linear regulator (7805) to provide 5V supply.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 6. HARDWARE INTERFACE Generally, there are 2 methods of using SKPS. It has been designed for interface to embedded system with 5V TTL (microcontroller) or connection to computer (normally for functionality test). 6.1 Microcontroller One of user’s main concerns when using SKPS is the interface with microcontroller. a. To begin, user may connect 5V and Gnd of SKPS to microcontroller board. Header socket can be used to connect SKPS to microcontroller board. b.
ROBOT . HEAD to TOE Product User’s Manual – SKPS f. Any microcontroller with UART peripheral can be used to interface with SKPS. Example of connection to PIC16F877A microcontroller Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 6.2 Computer SKPS can be connected to PC for functionality test. Another main concern during development using SKPS is to check the functionality. Normally, user will need to develop RS232 level shifter for communication to serial port. This generates extra work just to check the functionality of SKPS. Furthermore, laptop and computer nowadays have phase-out the serial port, USB have replaced it.
ROBOT . HEAD to TOE Product User’s Manual – SKPS c. After plug in the SKPS to computer and installation of driver, user is ready to test the functionality of SKPS. Open the HyperTerminal. Enter a name and choose an icon for connection as picture below then click OK. d. Connect using USB Serial Port. If you are not sure which COM is it, please follow step (e) to (g). Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS e. Go to Start, right click on My Computer and choose Properties. Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS f. At System Properties Table, choose Hardware and click on Device Manager. Device Manager Table will show out. g. At Device Manager Table, choose Ports (COM & LPT) and you can check your USB Serial Port COM. The Serial Port COM is “COM20” in this case. Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS h. Set the Port Setting as picture below. Bits per second must be same with SKPS Baud Rate and Flow control must be set to none. After finish setting, click Apply and then click OK. i. Go to File and select Properties. ‘skps’ Properties table will show. Choose Setting tab and click ASCII Setup tab. Click on Echo typed characters locally and then click OK. Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS j. After all settings are complete, user may now check the functionality of SKPS. Please refer ASCII Mode (PC) protocol in Section 6.2. Type “ae” to enable the return of any key pressed or changes of joystick automatically. Type “ad” to disable this feature. k. Make sure data is sent in correct protocol by SKPS when button or joystick is being manipulated (press or push). If the data can be obtained, the SKPS is working. Created by Cytron Technologies Sdn.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 6.3 PS2 Controller User may choose either wired or wireless PS2 Controller to be connected to SKPS. Figure below shows the method to connect PS2 controller to SKPS board. There are many types of PS controller in the market and the sensitivity for each type also different. User is advised to use original PS2 controller. Cytron Technologies does not guarantee compatibility for all PS2 controllers.
ROBOT . HEAD to TOE Product User’s Manual – SKPS Figure below shows an example of PS2 controller which can be used for SKPS. There are 16 buttons that can be used as input button in PS2 controller. L1, L2 R1, R2 Triangle Up Left Right Select Start Circle Square Down Cross Left Joystick Right Joystick Analog value of Left Joystick and Right Joystick can be read from SKPS. There are 2 axes that can be read which are Type 1 and Type 2. It will be mentioned briefly after this.
ROBOT . HEAD to TOE Product User’s Manual – SKPS For Type 1, there are 2 variables for each joystick which is axis X and axis Y. For example user can move the joystick up, down for Y axis and left, right for X axis. For Y axis, when users move the joystick up, the value will change from 128 to 0; when user move the joystick down, the value will change from 128 to 255.
ROBOT . HEAD to TOE Product User’s Manual – SKPS For type 2, they are 4 variables for each joystick. The 4 variables are up, down, left and right. When users move the joystick up, down, left or right the value is at range 0-100. This axis is same for left joystick and right joystick on PS controller. (b) Type 2 For example, when left joystick is being move 10% to left and 50% to down position, the value of joy_ll and joy_ld will change, as in figure below, joy_ll=10 and joy_ld=50.
ROBOT . HEAD to TOE Product User’s Manual – SKPS Please take note that the joy_lx, joy_ly, joy_rx and joy_ry is for type 1 axis; joy_lu, joy_ld, joy_ll, joy_lr, joy_ru, joy_rd, joy_rl and joy_rr is for type 2 axis. This variable is being name according to a standard format. Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 7. PROTOCOL 7.1 Non-ASCII Mode (Microcontroller) 7.1.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 7.1.2 On board Vibrator Motor Control send 1st byte (decimal) send 2nd byte (decimal) 29 motor1 value 30 motor2 value big vibrator placed on left side Controller small vibrator placed on right side Description motor1 = 1 or 0 (on or off) motor2 = 0 -> 255 (adjustable vibration) (a) Example Communication of Circle Button Operation (b) Example Communication of Left Joystick Right Value Operation Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 7.2 ASCII Mode (PC) 7.2.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 7.2.2 Read Key Functions Send 2 byte Received Controller rk all key status any press button/joystick value ae auto read enable any press button/joystick value ad auto read disable any press button/joystick value Description SKPS will return pressed key and changed joystick value once. [“Enter” after result] SKPS will enable return pressed key and changed joystick automatically.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 7.2.3 On board Vibrator Motor Control Send 2 byte Received me motor enable md motor disable Description SKPS will enable vibrator motor (both motor1 and motor2) SKPS will disable vibrator motor Example Communication of Motor Enable Operation. Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 8. GETTING STARTED For this section, SKPS will be interfaced with PR23. Please refer PR23, DIY project from Cytron website for details example of interfacing to SKPS. PR23 shows the method of using SKXBee, since SKPS UART pin is designed to be compatible to SKXBee, user may replace SKXBee with SKPS on PR23. Please refer to http://www.cytron.com.my/PR23.asp for the details of PR23.
ROBOT . HEAD to TOE Product User’s Manual – SKPS c. Function to read SKPS and control the joystick. Below are examples of UART function and SKPS function. Comments explain each command. UART function controls process of sending and receiving data via UART while SKPS function is to read information on PS2 controller including function to read button and joystick and control the vibrator motor. d. Below are sample on how to use those function that mentioned above.
ROBOT . HEAD to TOE Product User’s Manual – SKPS e. After finish writing the program, user may compile it and load the source code. Please refer to PR23 on the method to download the code. f. Upon loading the program, PR23 is now ready to operate with SKPS. User may test it using PS2 controller, try each button and function. Have fun! Created by Cytron Technologies Sdn. Bhd.
ROBOT . HEAD to TOE Product User’s Manual – SKPS 9. WARRANTY ¾ ¾ ¾ ¾ Product warranty is valid for 6 months. Warranty only applies to manufacturing defect. Damage caused by mis-use is not covered under warranty. Warranty does not cover freight cost for both ways. Prepared by Cytron Technologies Sdn. Bhd. 19, Jalan Kebudayaan 1A, Taman Universiti, 81300 Skudai, Johor, Malaysia. Tel: Fax: +607-521 3178 +607-521 1861 URL: www.cytron.com.my Email: support@cytron.com.my sales@cytron.com.