Shop OBEX P1 Docs P2 Docs Learn Events
Gamepad help — Parallax Forums

Gamepad help

musictechmusictech Posts: 54
edited 2005-05-01 02:30 in BASIC Stamp
I have to pick between two controllers to be used in a project.· They are both basically the same price and layout.· One is for playstation 2 the other is a usb connectable for a PC.· The only deciding factor I have is ease in doing code and the amount of stamps I have to use.· I am connecting 6 to 10 of these to a project.· I have seen the ps2 code, but haven't seen anything on pc gamepads.· Anyone know which would be easier in using?

·

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2005-04-11 17:29
    Forget connecting a USB-based gamepad to a BS2. Cannot be done in an economical way without a PC acting as a USB master between the two. The 'PS2' based controller -- now I think I've seen circuits for doing that.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-11 17:36
    You can connect a PS2 controller to the BASIC Stamp -- read about it here:

    ·http://www.parallax.com/dl/docs/cols/nv/vol4/col/nv101.pdf


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • musictechmusictech Posts: 54
    edited 2005-04-11 18:14
    Jon,

    Do you remember the gauge of wire used in the ps2 controllers. I want to use an RJ-45 and some ethernet cable so I can unattach the controller when I want.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-11 23:34
    It's pretty small; I'm guessing 26 or 28 (stranded -- not solid)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • musictechmusictech Posts: 54
    edited 2005-04-27 14:20
    Jon,

    I need to connect a few playstation controllers to a stamp (8 total, but I figure I will only get about half that). Anyway to trim down the code so that I can use multiple controllers? Also, is there a way to wire it up that I can use less pins?

    Thanks
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-27 14:37
    Sure. You could use a 74HC595 (3 pins) to do your device select. The clock and data line from that could be shared with the PSX controllers. Then you'd just need the (shared) data pin back from the PSX controllers.

    Pins:

    SData --> Data out to 595 and to (shared) PsxCmd pin on PSX controllers
    SClk --> Clock out to 595 and to inverter that goes to (shared) PsxClock pins on PSX controllers
    Latch --> Latch out to 595
    PDataIn --> Connect to shared PsxDat line

    My schedule is really busy right now, but maybe in a couple months I will make a serial adapter for the PSX controller (I'll allow mutliples as you require) using the SX/B compiler.· That would allow BASIC Stamp users to get data from a PSX controller using SEROUT and SERIN.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • musictechmusictech Posts: 54
    edited 2005-04-27 17:12
    Jon,

    I hope you can help me make sense of this too.

    The PS2 Controller I have (turbo shock by intec) has a very different wiring pattern from what is listed in the nuts and volts article.· The pin out is as follows


    ·· ______
    ·/ Green |
    |· None· |
    |· Blue·· |
    |
    |
    |· Black· |
    |· Yellow|
    |· Red··· |
    |
    |
    |· Brown |
    | Orange|
    \ Violet· |
    ·

    However, after taking the back off of one of the controllers I found these abreviations corresponding to where the wires hook up inside.

    Brown·· clk
    Yellow·· 3.5V
    Green··· DI
    Orange· DO
    Red······ CS
    Violet··· ACK
    Black···· GND
    Blue····· 7.5V

    Now most of these are straight forward, but there is a few I have no clue which pin they correspond too.· Please help =)

    Thanks
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-27 17:25
    these abbreviations have pretty standard definitions:

    clk = clock
    DI = data input
    DO = data output
    CS = controller select or clear to send (dont know which it would be, but I think it is the latter due to the presence of ACK)
    ACK = Acknowledge

    The others of course are power connections.
  • musictechmusictech Posts: 54
    edited 2005-04-27 17:49
    Brown obviously connects to the top of the 2n3904 that connects to the clock. What would DI, DO, CS, and ACK hook to.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-27 18:04
    Ok I think the correspondance is as follows

    PsxClock = Clk
    PsxCmd = DI
    PsxDat = DO
    PsxAttn = CS

    the last one I am not at all certain of, can you trace the leads to find where the signals of ACK and CS terminate in the intec controller, ie does it connect to a chip? If so what is the part number on the chip and which pin is it connected to? Can you also do this for the DI and DO lines just to be sure Ive got it right, because depending on your reference point is the controller, then DI=PsxCmd, but if the reference point is the master then DI = PsxDat. (it is more likely that the labels are using the controller as the reference point)

    Post Edited (Paul Baker) : 4/27/2005 6:07:23 PM GMT
  • musictechmusictech Posts: 54
    edited 2005-04-27 18:44
    All the connections from the controller lead into a black dot or bump on the board. I am guessing it is a protective cover of some sort but can't really trace much.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-27 18:55
    Ah man thats not good news, yes the black bump is a protective sealant. I have removed such covers before but gained no further insight (specialty ICs are typically hidden underneath them and its near impossible to get information on the chip). Hmmm ok I have an idea, the critical factor is determining whether a particular line is an input or an output of the hidden chip. If that can be determined you can determine what the signal is. Inputs have a high impedance when measuring the resistance into the terminal, an output will have a low impedance when measuring the resistance.

    Try the following experiment and tell me what your results are:

    Apply all power signals to the controller
    Then measure the resistance of each signal line by taking the measurement with repect to both ground and 5V.
    If both measurements result in a high value, then the pin on the chip is an input.
    If either measurement results in a sufficiently lower resistance value, the pin on the chip is an output.

    The open collector output of the PsxData may be seen as a high impedance depending whether the chip is driving the line or not, even though it is an output so dont worry if both DI and DO seem to be inputs.

    Post Edited (Paul Baker) : 4/27/2005 7:04:06 PM GMT
  • musictechmusictech Posts: 54
    edited 2005-04-28 00:32
    Some corrections. The connector goes as follows:
    ______
    / Violet |
    | None |
    | Brown|
    |
    |
    | Red |
    | Yellow|
    | Black |
    |
    |
    | Blue |
    | Orange|
    \ Green |

    Using you test Paul, connecting the blue and yellow to 5V and black to ground, I get the following. Red, orange, and violet are outputs from the ps2 controller. Green and brown are inputs into the ps2 controller.
  • musictechmusictech Posts: 54
    edited 2005-04-28 03:48
    Well, we figured it out. Not exactly the way we set out to fix it, but it worked all the same. After examing the back of the inside of the controller we managed to trace the buttons for movement to the pins they came off of. After locating the pins we needed, we soldered new leads there and ran it to the stamp. I still use the same for leads, but I have no circuitry other than straight connections to power and ground. Oh, and I had to tie the clock input low for it to work. After doing that I get a logic 1 or logic 0 signal for my directions.

    Kind of like shooting the horse to cure the disease but they will be done for tomorrow.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-28 14:07
    Glad to hear you figured out a setup, there is no shame in jerry-rigging a device especially when you're in a pinch.
  • Philip GamblinPhilip Gamblin Posts: 202
    edited 2005-05-01 02:30
    I found something rather cool at Best Buy today, a wireless PS2 controller. I don't remember if it was Sony or a knockoff, but it the data stream is the same ( it claims compatibility) may be that you don't need wires after all.
Sign In or Register to comment.