Gaming style controller

Status
Not open for further replies.
I want to design a simple controller like device that is for gaming (guild wars 2-windows) This being that I want to have 21 tactile switch buttons (3 of the switches are foot pedals) and 2 analog joysticks with button click, just bought a teensy 3.1.

Here's the things I want to know:
-What type of coding does this device take (new to any type of coding, but willing to learn)
-is there a power source needed for this type of project other than USB
-any examples of pre-made code that I can utilize for a project like this
 
gamingcontrollerHID (1).png
Thats the basic design so far, going to wire up the joys and what not, anything I'm missing please feel free to tell me.
 
we talking about the joysticks? or the buttons on the breadboard? a cause they breadboard is wired pretty much all the same
 
Maybe he was referring to the fact that the first switch has a different pin tied to GND vs all of the others? if that switch's internals are what I think they are, you'd want wire the top-most resistor along the red line shown here:
maybe_this.png
 
Maybe he was referring to the fact that the first switch has a different pin tied to GND vs all of the others? if that switch's internals are what I think they are, you'd want wire the top-most resistor along the red line shown here:
View attachment 1234

Ah, well I'll wire it like you have it, just got lazy during the making up of the breadboard on fritzie, but yeah, all pins will end up the same, anything else as an issue on this board? still have to add a few things to it, but otherwise, its pretty much set, just awaiting my new headers in the mail.
 
Note, if you use the INPUT_PULLUP mode for the buttons you can eliminate all of the resistors. You will need to reverse the sense of the test in the read (i.e. it returns LOW if the switch was pushed if you are using an input pullup, but it would return HIGH if you are using the resistor). Some people dislike that it inverts the test, but I prefer not to have to add extra resistors. If you are building it on a breadboard, there are some breadboards, where the power rails line up with the data pins, and you could connect one end of the switch directly to ground: http://arduino.cc/en/Tutorial/InputPullupSerial.

Also, if you have lots of buttons, these buttons only take 2 0.1" rows instead of 3: http://www.adafruit.com/products/1489
 
Last edited:
Note, if you use the INPUT_PULLUP mode for the buttons you can eliminate all of the resistors. You will need to reverse the sense of the test in the read (i.e. it returns LOW if the switch was pushed if you are using an input pullup, but it would return HIGH if you are using the resistor). Some people dislike that it inverts the test, but I prefer not to have to add extra resistors. If you are building it on a breadboard, there are some breadboards, where the power rails line up with the data pins, and you could connect one end of the switch directly to ground: http://arduino.cc/en/Tutorial/InputPullupSerial.

Also, if you have lots of buttons, these buttons only take 2 0.1" rows instead of 3: http://www.adafruit.com/products/1489
Genius, You now have turned me unto the colourful tact switches ;), also, I do not mind haveing all those resistors, works fine for what I want to do with them, they are only like 10kohms
 
Yikes, that newest picture looks like it has GND connected to one side of each pushbutton and +3.3V power connected to the other side.

Please DO NOT actually connect your wires this way.
 
My custom gaming controller has 5 axis and 13 buttons. The code side is pretty easy thanks to a guide by FuzzieWuzzie. (When you go to his website, the guide is under programming)

This is how I did mine..

  1. Played with the built in joystick demo to get a feel for the hardware side. Including testing the accelerometer hardware & joysticks.
  2. Used the guide above to create a custom HID controller and software.
  3. Design the physical parts, i.e. the case, button layout and wiring.

The hardest part for my has been No 3, which maybe harder in my case as I am converting an existing device, meaning I am limited by space and button layout. No 1 is easy, just connect one side of the button to the teensy pin, the other to ground. For the joysticks connect one side of the pot to 3.3v, the other to agnd and the centre to the Teensy analogue pin. Using the internal pullups as suggested by MichaelMeissner, cuts down on components for one thing and will probably help with no 3. No 2 is much easier thanks to that guide, but I did struggle in a couple of places, just shout if you need help.

Please note that although I have done 1,2 & 3 above I haven't actually got my project completed yet (mainly due to my crap soldering skills and the wrong choice of wire), so take this advice with a pinch of salt if you wish.

Regards,

Les
 
Last edited:
Why not? I see this example:

That example does not short the power supply. Only the red wires connect to the buttons. The black wires do not connect to the pushbuttons. But on your most recent drawing, the pushbuttons do connect to both GND and VCC, which is a terrible mistake. Well, it would be terrible if you actually wire the parts that way and then press the buttons. No harm will happen if you fix it before physically building the circuit.
 
The most common way to connect pushbuttons doesn't involve using VCC at all (the red wires) or any physical resistors. The chip has built-in resistors. You only need to type 7 extra characters to enable them. It's much easier to write pinMode(pin, INPUT_PULLUP) in your program than having to physically connect twice as many wires.

Using the built-in resistors, all you need to do is connect one side of every button to GND, and the other side to the pin that reads it. That's so much easier. It also avoids running the GND and VCC wires all over the place, which is nice, since it those 2 every accidentally touch directly or through the metal contacts of a pushbutton, it's possible to damage your Teensy.

Connecting the buttons this way causes the unpressed state to read as 1 or HIGH, and the pressed as 0 or LOW. That may seem backwards, but it's actually the most commonly used approach. It's called "active-low" and it's actually pretty much the standard way most electronics are designed. It's so common that many chips include internal pullup resistors, but not pulldown ones.

The internal pullup resistors are already inside the chip. You already paid for them. Why not simply use them and reduce the amount of wiring by 50%?
 
Interesting, will take that to the drawing board to revise, so all I need is output and GND, no need for VCC in this case except for joysticks? if so, saved me alot of wiring issues I was thinking about
 
Yes, that's correct, VCC is not needed for pushbuttons.

For more info and breadboard wiring photos, check this tutorial page and scroll down to "Built In Pullup Resistor"

td_tutorial_03g.jpg


You can see the left pushbutton is connected with a resistor to VCC. The right one does the same thing, without needing the resistor and VCC connection. It's *much* simpler. Both work fine.
 
Who would you recommend I go through for custom enclosures (might just go thrift hunting for cheap-o items to put my design in. the idea is to sit in your chair and play without the controller feel, basically mounted on the arm rests of computer chair.) and a custom PCB board?
 
Anyone able to help with how to code this, I'm stumped on how to start and all that jazz, is there a simplified way that I am missing? Thanks for your time guys :D
 
Status
Not open for further replies.
Back
Top