Shop OBEX P1 Docs P2 Docs Learn Events
(Wireless?) PS2 Controller Interface — Parallax Forums

(Wireless?) PS2 Controller Interface

bulkheadbulkhead Posts: 405
edited 2006-01-29 06:30 in General Discussion
I'm doing mine like the one in the Nuts & Volts article and have a few questions on wiring (see diagram)


From Jon Williams' "Playstation Control Redux" article in Nuts & Volts

Is there a reason why there is no resistor on the data line?

Would any transistor work in place of the 2n3904? Preferably, one I could pick up from RS. Edit: I found these at RS, lol.

Also wondering if anyone has tried using a wireless controller successfully? I've read about using the Madcatz wireless lynx, but I'm not sure if it requires different code to communicate.

Thanks.

Edit: Almost forgot, but what's the difference between Analog ($73) and Digital ($41) mode?

Post Edited (bulkhead) : 1/27/2006 8:55:54 PM GMT

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-27 04:28
    I didn't put one on that line because it's a Stamp input and the PSX doesn't drive that line; it either floats (and is pulled up) or is pulled low by the controller to exert a "0" bit. You can put one in the line, it won't hurt anything.

    Analog gives you joystick data, digital just the buttons.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • CJCJ Posts: 470
    edited 2006-01-27 14:30
    about using wireless controllers, should work just the same as long as you can supply proper power to the receiver

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Who says you have to have knowledge to use it?

    I've killed a fly with my bare mind.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-27 15:33
    That I don't know -- I've heard mixed reports of success with wireless controllers and I've never bothered to work with one myself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • bulkheadbulkhead Posts: 405
    edited 2006-01-27 20:30
    Ok, I wired up my controller using lynxmotion's controller adapter: www.lynxmotion.com/images/index/wiring07.jpg

    The only thing I did not do was invert the clock signal. Instead, it is connected directly to the stamp's pin through a 220 ohm resistor. I also adjusted the value in the program to read "clockMode = Direct"

    My problem is that the status comes back as "ÿ" which is equivalent to "255." This means that all bits are read as 1's. Is this because there is a pullup resistor on the data line? Is that supposed to be there?

    Edit: I inverted the clock signal (and changed the code back) and now it doesn't recieve the status. It does, however, retrieve the ID, which displays as either "A" which is eqiuvalent to "digital" or "ÿ" again. It will read "A" a few times, then read a few "ÿ" then more "A." Is there anything wrong with my wiring that could cause this fluctuation? It seems that the data line is read incorrectly (as all 1's) occassionally, while it works fine for other trials. This seems like a wiring issue since it does work correctly by returning "A" (if it were a programming error, it wouldn't return "A" ever).

    Post Edited (bulkhead) : 1/27/2006 10:40:47 PM GMT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-28 01:14
    Yes, the pull-up(s) must be there. You see, the controller is designed to share the data line with other controllers so that line is never driven, it can only pull the line low to exert a "0" bit (and it will only do this when its Attn line is asserted). If you suspect a wiring problem, recheck everything and put a 'scope on it if you can to make sure things are getting to where they're supposed to. I've built up that circuit a few times and never had any trouble with it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • bulkheadbulkhead Posts: 405
    edited 2006-01-28 03:34
    I double checked everything, and here is what the controller ID prints as when I get the packet several times (each character equates to getting the data packet once):

    AAÿAAAAÿAAÿAÿAAAÿ

    The only difference in wiring was that I used a 220 ohm resistor going to the transistor. After adding a 270 ohm resistor in series with the 220 (that makes 490 right?), I still get this:

    AÿÿAAAAAAAAAÿAÿAAAÿAÿAA

    After resetting, this sequence:

    AÿÿÿÿAAÿÿAÿAAÿÿA

    The A is equivalent to a 41 in dec, the ÿ is equivalent to a 255 (11111111 in binary). As you can see, this appears to be random. Although I do admit that sequence of 9 A's seems not random, all other trials have pointed to a completely random success rate. These are the only two bytes that it will recieve, either the correct one, "A" or it will read as all 1's. Any idea on what could cause this? Oh, I forgot to mention that it's connected to the +5V output on the stamp. Should it be connected to a separate power supply or is using the stamp's power okay?

    Also, I already checked the code, and it seems fine. I would guess that since it can successfully read the controller's ID once (as the A's indicate) then it isn't a programming error. Also, the fact that the success rate is completely random eliminates the possibliity of a shifting or memory storage issue, since it would have a visible pattern if that were the case. This really is a mystery.
  • bulkheadbulkhead Posts: 405
    edited 2006-01-29 06:30
    Ok, after I checked the wiring and everything, and tested the code, I still couldn't get it to work. Then I tried changing a controller, and it works now! I'm running it with one of those dance pads for DDR (the only other working controller I have), and the controller type is returned as "41" or the same as a digital controller. Imagine controlling a robot with one of these, lol. Thanks everyone.
Sign In or Register to comment.