Shop OBEX P1 Docs P2 Docs Learn Events
Playstation controler connected to the Propeller — Parallax Forums

Playstation controler connected to the Propeller

KlapKlap Posts: 65
edited 2009-06-02 21:34 in Propeller 1
I got the PS2 controller working for the Basic Stamp but I was wondering if anyone has got it working with the Propeller yet. All I could find was a PS2 emulator which plugs into a PlayStation 2, but I would like to connect the PS2 controller to the Propeller. Has anyone done this yet?

Comments

  • JonnyMacJonnyMac Posts: 9,195
    edited 2009-05-07 19:09
    Not yet, but it's on my list.... especially since I've connected the PS2 controller to the BASIC Stamp and SX.
  • KlapKlap Posts: 65
    edited 2009-05-07 19:28
    Ohh wait. I think I found something.

    obex.parallax.com/objects/203/

    I remember trying this a while back but could not get it to work. Has anyone else been able to get this code to work?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-05-07 21:23
    I got it working a while back, but was disappointed that it did not read my guitar hero controller.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • BradCBradC Posts: 2,601
    edited 2009-05-08 01:45
    Klap said...
    Ohh wait. I think I found something.

    obex.parallax.com/objects/203/

    I remember trying this a while back but could not get it to work. Has anyone else been able to get this code to work?

    Yep.. I had it working. I did not want to dedicate a cog to it though so I re-wrote it in SPIN so it can be polled from a main loop
    I've attached a modified version of the original demo code for VGA also.. it's been _ages_ since I did it but it worked at the time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "VOOM"?!? Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!
  • FrameShift.FrameShift. Posts: 35
    edited 2009-05-08 15:16
    Quick question.
    I know some other ways ive seen to interface a PS2 controller to a micro controller used an adapter of some kind.
    Does this need that or could you directly connect it to the prop?

    -Tom
  • Rick PriceRick Price Posts: 36
    edited 2009-05-14 00:16
    I have it working right now.

    I am using the PS2 driver in the obex library, I believe the url posted earlier is the correct one. I had to change the initialization of the serial library, (just a name change) after that all was good.

    The code does not turn on analog mode on my controller, that has to be done by hand, I am sure it could be changed to do this.

    I am using the controller to steer a robot car.
  • BradCBradC Posts: 2,601
    edited 2009-05-14 00:18
    Rick Price said...
    The code does not turn on analog mode on my controller, that has to be done by hand, I am sure it could be changed to do this.

    The code I posted above has the details of how to switch on (and lock on) analogue mode.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "VOOM"?!? Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!
  • Rick PriceRick Price Posts: 36
    edited 2009-05-14 17:47
    BradC said...
    Rick Price said...
    The code does not turn on analog mode on my controller, that has to be done by hand, I am sure it could be changed to do this.

    The code I posted above has the details of how to switch on (and lock on) analogue mode.

    Okay, thanks.

    I totally missed that.

    Not needing to use a cog is also nice.

    Why don't you put your code into OBEX?
  • KlapKlap Posts: 65
    edited 2009-05-18 04:42
    I finally got the time to try this code out, I didn't work for me.
    I was not completely sure about the wire connections so I am including a schematic of the circuit I built. I am using a propeller spin stamp which operates with a built in external 10,000,000 clock freq instead of the 5,000,000 clock so I changed that and also the halved the pll from 16x to 8x. (I did this for both the main program and the sub program)
    Except for that small change I didn't alter a single line of code.

    So the way I see it there is only two options; either everybody else is wrong and the code is fundamentally flawed or my circuit is not hooked up correctly.

    Please help.
    417 x 473 - 17K
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-05-18 13:29
    Here's the diagram from when I did this.
    I used an actual connector so I didn't splice the lines.
    (Sorry, as a result I don't know the color codes.)

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
    236 x 327 - 20K
    400 x 300 - 77K
    437 x 339 - 23K
  • Rick PriceRick Price Posts: 36
    edited 2009-05-19 00:57
    I used this site to understand the wiring: www.geocities.com/digitan000/Hardware/22/e22_page.html.

    I bought a PS2 extension cable and cut it in half and then wired the half that the controller plugs into to a ribbon cable (and ribbon cable end), I then plug it into my board.

    The colours were not correct in my extension cable, I figured out the colours with a voltmeter and wrote them down before I made the connections.

    The site above has some useful rule of thumb methods to see if things are working. In my case, a controller I bought did not work, I had to use another one.


    I have it working right now without any trouble, I can try and help you debug things if you wish.

    Klap said...
    I finally got the time to try this code out, I didn't work for me.
    I was not completely sure about the wire connections so I am including a schematic of the circuit I built. I am using a propeller spin stamp which operates with a built in external 10,000,000 clock freq instead of the 5,000,000 clock so I changed that and also the halved the pll from 16x to 8x. (I did this for both the main program and the sub program)
    Except for that small change I didn't alter a single line of code.

    So the way I see it there is only two options; either everybody else is wrong and the code is fundamentally flawed or my circuit is not hooked up correctly.

    Please help.
  • Rick PriceRick Price Posts: 36
    edited 2009-05-19 01:05
    I would double check your wiring, the colours you are listing do not seem the same as the site that I mentioned above www.geocities.com/digitan000/Hardware/22/e22_page.html; that would worry me.

    I cannot verify their colours though, because I used an extension cable that used a different colour scheme.

    I would maybe try by counting the pins on the connector, because the pin numbers from the site above worked for me.

    Do you have an oscilloscope or logic probe?
    Klap said...
    I finally got the time to try this code out, I didn't work for me.
    I was not completely sure about the wire connections so I am including a schematic of the circuit I built. I am using a propeller spin stamp which operates with a built in external 10,000,000 clock freq instead of the 5,000,000 clock so I changed that and also the halved the pll from 16x to 8x. (I did this for both the main program and the sub program)
    Except for that small change I didn't alter a single line of code.

    So the way I see it there is only two options; either everybody else is wrong and the code is fundamentally flawed or my circuit is not hooked up correctly.

    Please help.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2009-05-19 01:41
    Lynxmotion sells a playstation to microcontroller cable for $4.95.
    http://www.lynxmotion.com/Product.aspx?productID=73&CategoryID=46

    John Abshier
  • whickerwhicker Posts: 749
    edited 2009-05-21 05:41
    You can power the controller off of 3.3 Volts.
    Eliminates the current limiting resistors anyway.
    Still need the pullup for the data pin (1). 10k is fine.
  • KlapKlap Posts: 65
    edited 2009-06-02 16:52
    I am using the lynxmotion connection. That is why my colors may be different than if you hack the end of the controller. As I said, I am following the instructions/code exactly as specified at: http://obex.parallax.com/objects/203/

    Here is what it says:



    Play Station 2 Controller driver v1.0

    Author: Juan Carlos Orozco
    Copyright (c) 2007 Juan Carlos Orozco ACELAB LLC
    http://www.acelab.com
    Industrial Automation

    License: See end of file for terms of use.

    Use the Sony Playstation Controller Cable (adapter) from LynxMotion
    http://www.lynxmotion.com/Product.aspx?productID=73&CategoryID=

    Connect DAT, CMD, SEL, CLK signals to four consecutive pins of the propeller
    DAT should be the lowest pin. Use this pin when calling Start(first_pin)
    DAT (Brown), CMD (Orange), SEL (Blue) and CLK (Black or White)
    Use a 1K resistor from Propeller output to each controller pin.
    Use a 10K pullup to 5V for DAT pin.

    Conect Power 5V (Yellow) and Gnd (Red covered with black)



    I followed this exactly. The only problem is that there is no wiring diagram, which makes this a little ambiguous. Has anyone made a wiring diagram using the LynxMotion adapter? (mine should be dead on unless I am doing something wrong). Better yet can anyone look at my wiring diagram and see if it is correct? (see picture). The code I am using is exactly the same as the code located at http://obex.parallax.com/objects/203/ (except for the clock).
    417 x 473 - 17K
  • Rick PriceRick Price Posts: 36
    edited 2009-06-02 18:00
    Klap said...
    I am using the lynxmotion connection. That is why my colors may be different than if you hack the end of the controller. As I said, I am following the instructions/code exactly as specified at: http://obex.parallax.com/objects/203/

    Here is what it says:



    Play Station 2 Controller driver v1.0

    Author: Juan Carlos Orozco
    Copyright (c) 2007 Juan Carlos Orozco ACELAB LLC
    http://www.acelab.com
    Industrial Automation

    License: See end of file for terms of use.

    Use the Sony Playstation Controller Cable (adapter) from LynxMotion
    http://www.lynxmotion.com/Product.aspx?productID=73&CategoryID=

    Connect DAT, CMD, SEL, CLK signals to four consecutive pins of the propeller
    DAT should be the lowest pin. Use this pin when calling Start(first_pin)
    DAT (Brown), CMD (Orange), SEL (Blue) and CLK (Black or White)
    Use a 1K resistor from Propeller output to each controller pin.
    Use a 10K pullup to 5V for DAT pin.

    Conect Power 5V (Yellow) and Gnd (Red covered with black)



    I followed this exactly. The only problem is that there is no wiring diagram, which makes this a little ambiguous. Has anyone made a wiring diagram using the LynxMotion adapter? (mine should be dead on unless I am doing something wrong). Better yet can anyone look at my wiring diagram and see if it is correct? (see picture). The code I am using is exactly the same as the code located at http://obex.parallax.com/objects/203/ (except for the clock).

    Are you able to change the diagram to also show what pins on the connector each thing is going to? I can then verify it against my working setup.

    In terms of DAT, CMD,SEL,CLK you are doing it in the same order as me (I start at P0), so that should be the same as you.


    If you plug in the controller, I assume the analog light is not on, if you push the button, does it turn on? It seems that if the controller is powered, then pushing the analog button turns the light on and off (I also switches modes [noparse]:)[/noparse] ). I had one controller that I bought that was bad, and it failed this test. My good controller worked with that test. At least if the LED works, you know you have the power connected correctly.
  • KlapKlap Posts: 65
    edited 2009-06-02 21:06
    Alright, I think this is what you are asking for (see attachment). Please let me know if this setup is correct.
    1089 x 1295 - 77K
  • KlapKlap Posts: 65
    edited 2009-06-02 21:34
    I finally figured out what what wrong. Apparnetly this code only works for a propeller that has an external 5MH clock. I was using a 10MH external clock (which I took account for in the constants lines) but not in the rest of the code.
Sign In or Register to comment.