Using arcade buttons to replace an analog joystick?

Discussion in 'General Electronics Chat' started by Alkamist, Oct 13, 2016.

  1. Alkamist

    Thread Starter New Member

    Oct 13, 2016
    8
    1
    Greetings everyone! I am very novice with electronics and I am struggling to think up a solution for my problem.

    Basically I want to build a custom GameCube controller for use in the fighting game Super Smash Brothers Melee. This is essentially what I want to build

    I am going to use a cannibalized GameCube controller board, and I want to cut out the left joystick and patch in a system of 8 buttons to get different inputs.

    Here's how it will work:
    - The joystick uses two potentiometers (X and Y axis).
    - Each axis will have four arcade buttons assigned to it (one high, one low, and two modifiers).
    - Four buttons are arranged in the WASD formation like how you move in computer games.
    - There are four modifier buttons (2 X and 2 Y) you press with your thumb that modify how far each axis is pressed.
    - The axis values need to default to the center when no buttons are pressed.
    - I bought some trimpots to adjust the strength of the modifiers, where do they fit in?

    So how do I wire this up? How do I get the arcade buttons to interact in such a way that gets the behavior that I want? Also how do I make sure it is safe if multiple buttons are pressed at the same time?

    If anyone can help I would appreciate it greatly!

    Diagram for a GameCube controller PCB:
    http://www.slagcoin.com/joystick/pcb_diagrams/gc_diagram1.jpg
     
  2. Hypatia's Protege

    Distinguished Member

    Mar 1, 2015
    2,788
    1,236
    Inasmuch as the circuit expects an analogue signal (as generated by the 'joystick'), implementation of (what amounts to) an elemental DAC is required -- IMO, pursuant to simplicity of construction, part count and ease of 'tailoring', your best course is implementation via a uC -- Otherwise you're looking at a 'component heavy' arrangement of resistors, discrete logic and integrated analogue switches (e.g. cd4066's)

    If you will be scanning the buttons - avoidance of I/O line contention is readily (and 'traditionally') achieved via diode 'or-ing':cool:

    Best regards and good luck!
    HP:)
     
  3. drc_567

    Member

    Aug 23, 2016
    82
    9
    I ran into a similar problem some time ago. The details elude me, but the basic goal was to change the joystick manipulation on a video game to that of a trackball. As I recall , there are indeed potentiometers that control the joystick x and y parameters. However, the input to the circuit board is based on current variation, not voltage. So, if you have any difficulties, start thinking in terms of current flow.
     
  4. Alkamist

    Thread Starter New Member

    Oct 13, 2016
    8
    1
    Thank you for the help! That's a bummer, I was hoping it would be more simple. I do have a Teensy 3.2 board. Perhaps I can use that.

    Perhaps this is the wrong place to ask, but could anyone give any advice on how to implement this functionality with a Teensy board? I can probably figure out the coding myself, but I am confused how to get two analog signals from it that can plug into the place where the joystick was. The Teensy outputs to USB.
     
  5. Hypatia's Protege

    Distinguished Member

    Mar 1, 2015
    2,788
    1,236
    My suggestion is direct implementation of an appropriate uC (e.g. 'PIC' or 'AVR')

    Best regards
    HP
     
  6. Alkamist

    Thread Starter New Member

    Oct 13, 2016
    8
    1
    I'll look into it, thanks for the help!
     
    Hypatia's Protege likes this.
  7. Alkamist

    Thread Starter New Member

    Oct 13, 2016
    8
    1
    I read up a bit on microcontrollers and learned a lot. I found that I should be able to output PWM signals from my Teensy board so I can test my code. I would certainly want to go to a smaller microcontroller after testing of course.

    I have a new question however. Since it seems that what I will be dealing with is a PWM signal, is it ok to run this straight into where the joystick potentiometers were, or would I need to lowpass filter it beforehand? I feel like I could risk getting wrong inputs if I don't filter it.
     
  8. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    Last edited: Oct 14, 2016
    Hypatia's Protege likes this.
  9. Alkamist

    Thread Starter New Member

    Oct 13, 2016
    8
    1
    Thanks for the link! I'll read up on it.
     
  10. Alkamist

    Thread Starter New Member

    Oct 13, 2016
    8
    1
    Would I really need an op amp for this? I would have to power it with an external power supply wouldn't I? From the looks of the product I am basing my design off of, there is no external power needed other than what the GameCube controller board puts out. Would it be possible to get by with just a passive lowpass filter?
     
  11. drc_567

    Member

    Aug 23, 2016
    82
    9
    Just a sruggestion ... The part listed here:
    https://www.sparkfun.com/products/10613
    Is a digital pot, and is also available as a rheostat part. So if your game board uses voltage points to place the cursor, you get the potentiometer part and if the board uses current levels for cursor placement, you use the thermostat (two terminal) part. ... So, first step, find out if you are dealing with voltages or currents. The thinking here is that the digitally adjustable resistors would be reasonably accurate and could be adjusted one time, at your convenience. There is some info on the referenced page on how to use SP I with an Arduino. ... Cost per unit is reasonable ... seems like your video clip required 8 points per axis. The specs for the pot seemed fast enough. You might just get one piece to verify that the switching ... chip select or whatever ... is going to be practical.
     
  12. Alkamist

    Thread Starter New Member

    Oct 13, 2016
    8
    1
    Thank you for the suggestion! It believe would be 7 points per axis: 3 low, 3 high, and one in the middle.

    This is an interesting option. I'll have to do some research into it. Is there a way to run one of these from an ATTiny84 or something of the sort? I would like to avoid using my Teensy board directly in my controller.
     
  13. drc_567

    Member

    Aug 23, 2016
    82
    9
    Latest ...
    The format of the digital potentiometer is a fixed resistance divided into 256 increments. So maybe you would have 10k ohms divided into 39 ohm steps. Then you would have the X step button on your controller initiate an interrupt. That interrupt would set up the SPI interface with the pot to increase the resistance value by one increment and activate the output line to the display. ... So each time you press the Xwalk button, the cursor moves one fixed interval on the screen. Your modifier button activates a times 2 step increment. ... Similarly for the Y axis. ...
    No reason that you could not use a different microcontroller ... Everything has to be tested and checked out though.
     
  14. Alkamist

    Thread Starter New Member

    Oct 13, 2016
    8
    1
    I have written my code now testing with serial on my Teensy board. I have everything working so far it seems. Now I need to order parts and test with hardware.

    Does anyone have any ideas to make this build as clean as possible? I am planning on running all of the buttons to screw terminals for easy access. I am confused on how to handle connecting the microcontrollers and digital pots in a clean fashion though. Something like a breadboard would be nice, I just don't want any connections slipping lose.

    Any suggestions are appreciated!
     
Loading...