Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Button wiring  (Read 2506 times)

0 Members and 1 Guest are viewing this topic.

Anshum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 29, 2018, 01:55:45 pm
  • I want to build my own arcade controls!
Button wiring
« on: April 10, 2016, 03:04:31 pm »
I'am in the process of building my arcade machine. The problem is that I could not find any keyboard encoders where I live (India), so I decided to use an old keyboard to use as an encoder. The problem is I do not have very clear instructions for the process. I have already opened it up and traced the keys that I'am going to use now how would I go about connecting my buttons to the wire from the keyboard board?

I have similar sort of encoder

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 822
  • Last login:Yesterday at 10:49:34 am
Re: Button wiring
« Reply #1 on: April 11, 2016, 12:46:48 am »
Super easy: assuming that you are using common 3 pin microswitch arcade buttons connect your keyboard ground to every single "L" shaped pin on your microswitches (google for daisy chain) and the middle pin (NO, Normally Open) to the solder pad of the key you want to map the button to.

Anshum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 29, 2018, 01:55:45 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #2 on: April 11, 2016, 01:52:31 am »
Yes but the thing is the combination of the left and right side of the encoder gives me a specific key, so therefore I have 2 wires for 1 key.
Also I have 2 pin microswitch, the NC (normally closed) is not there

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 822
  • Last login:Yesterday at 10:49:34 am
Re: Button wiring
« Reply #3 on: April 11, 2016, 09:52:07 am »
Not sure I have understand your issue. Obviously you need two pins for an input: one is the ground, the other is the line you wanna short for the signal to be sent. For the buttons, if you have two pins only (like japanese buttons or leaf switches) they are NO, so you are ready to go.

Jamesbeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:February 11, 2019, 06:13:39 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #4 on: April 11, 2016, 10:09:39 am »
If I'm understanding what you are asking, you probably don't have a common ground, so you may have to use two pads on the encoder for each button.
Basically, each switch needs to connect two pads on the encoder.

Anshum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 29, 2018, 01:55:45 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #5 on: April 11, 2016, 11:59:16 am »
Yeah there are usually 3 pins on a microswitch Ground, Normally open (NO), Normally Closed (NC). I have Normally open and ground and i'm missing Normally Closed.
So should I connect 2 wires to ground and NO

gumby510

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 121
  • Last login:November 17, 2022, 09:19:44 pm
  • SR-20 NX 2000
Re: Button wiring
« Reply #6 on: April 11, 2016, 12:11:24 pm »
Can't you order an encoder from ultimarc?

Jamesbeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:February 11, 2019, 06:13:39 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #7 on: April 11, 2016, 12:12:13 pm »
Yes, ground and NO.

NO means 'normally open', which means that no connection is made until you press the button.
This is what you want for arcade machine buttons.



Jamesbeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:February 11, 2019, 06:13:39 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #8 on: April 11, 2016, 12:14:12 pm »
Can't you order an encoder from ultimarc?

Probably cost prohibitive for someone living in India.
I don't know what the exchange rate is, but I bet it's very unfavorable.

Anshum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 29, 2018, 01:55:45 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #9 on: April 11, 2016, 12:44:11 pm »
Yeah plus the shipping is as much as the board.

JDFan

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3448
  • Last login:March 03, 2025, 10:29:54 am
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #10 on: April 11, 2016, 01:27:39 pm »
Yeah there are usually 3 pins on a microswitch Ground, Normally open (NO), Normally Closed (NC). I have Normally open and ground and i'm missing Normally Closed.
So should I connect 2 wires to ground and NO

You need to wire the 2 wires from the keyboard encoder to the button switch ( one will connect to the ground position and 1 to the NO position --- and each button will have 2 wires going to it -- you can not use a daisy chain for this type of matrix setup.

ie. lets say your keycode you traced for "5" (player 1 coin up) uses the red wire to the far left of the pic of the encoder and the yellow wire to the far right as the inputs (could be any combination of 2 wires as you traced just use those 2 wires) -- THen you would connect either the red or yellow wire to ground and th other one of the 2 to the NO position.

By doing this anytime the button is pressed those 2 wires are connected to each other which then signals the encoder that a connection of the 2 has been pressed. (same as if you had touched the 2 wires together.)

depending on the matrix some wires may go to several buttons ( ie. the red and yellow wire send a "5" and the red and blue wire send a "3" and the blue and yellow wire send a "1" )  in which case you will splice that wire to run to each button (this is one of the main reason people use encoders rather than keyboard hacks - as if 3 or 4 buttons are pressed at the same time they may make a combination for a 5th or 6th connection that gets sent to the game !! - ie. lets say for example - the button 1 has the red and yellow wire which sends a "5" and button 2 has the red and blue wire which sends a "3" and button 3 has the blue and yellow wire which sends a "1" key press code -  IF you press both buttons 1 and 2 the game will get sent codes for button 3 as well since all 3 red, yellow, and blue wires have been connected. ) -- So when deciding which key presses are used try not to use the same wires too many times in the setup to avoid this esp. if using MAME or similar which allows pretty much any key code to be used - it is best to limit how many connections each wire is used for to avoid this ghosting.




Anshum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 29, 2018, 01:55:45 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #11 on: April 11, 2016, 02:06:01 pm »
Yeah there are usually 3 pins on a microswitch Ground, Normally open (NO), Normally Closed (NC). I have Normally open and ground and i'm missing Normally Closed.
So should I connect 2 wires to ground and NO

You need to wire the 2 wires from the keyboard encoder to the button switch ( one will connect to the ground position and 1 to the NO position --- and each button will have 2 wires going to it -- you can not use a daisy chain for this type of matrix setup.

ie. lets say your keycode you traced for "5" (player 1 coin up) uses the red wire to the far left of the pic of the encoder and the yellow wire to the far right as the inputs (could be any combination of 2 wires as you traced just use those 2 wires) -- THen you would connect either the red or yellow wire to ground and th other one of the 2 to the NO position.

By doing this anytime the button is pressed those 2 wires are connected to each other which then signals the encoder that a connection of the 2 has been pressed. (same as if you had touched the 2 wires together.)

depending on the matrix some wires may go to several buttons ( ie. the red and yellow wire send a "5" and the red and blue wire send a "3" and the blue and yellow wire send a "1" )  in which case you will splice that wire to run to each button (this is one of the main reason people use encoders rather than keyboard hacks - as if 3 or 4 buttons are pressed at the same time they may make a combination for a 5th or 6th connection that gets sent to the game !! - ie. lets say for example - the button 1 has the red and yellow wire which sends a "5" and button 2 has the red and blue wire which sends a "3" and button 3 has the blue and yellow wire which sends a "1" key press code -  IF you press both buttons 1 and 2 the game will get sent codes for button 3 as well since all 3 red, yellow, and blue wires have been connected. ) -- So when deciding which key presses are used try not to use the same wires too many times in the setup to avoid this esp. if using MAME or similar which allows pretty much any key code to be used - it is best to limit how many connections each wire is used for to avoid this ghosting.
Thank you so much. This is exactly what I needed, I'm going to look for an encoder at a few more places, if I find nothing then I will probably have to do this.
Also what if I use 2 cheap gamepads with usb interfaces for player 1 and player 2? and do all the wire connections to them, wouldn't that prevent ghosting?

Jamesbeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:February 11, 2019, 06:13:39 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #12 on: April 11, 2016, 03:23:11 pm »
I hacked two gamepads exactly as you describe, and it worked great. A lot of work though.
One point to note is that, while gamepads often have a common ground for most of the buttons, quite a few of them (including mine) have a different ground for two of the directions (up and right I think, though it has been a while so I may be remembering wrong).

As long as you are careful to trace the pcb traces you will be ok.

Have you seen the Zero Delay and Xin Mo encoders?
They ship from China, and are less expensive than the ipac.

Anshum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 29, 2018, 01:55:45 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #13 on: April 11, 2016, 03:32:21 pm »
Yes I have seen those. I'm looking for them around my neighborhood shops.
I have one doubt, if I hack the gamepads then is there going to be any problem software-wise, like will they automatically start wokring on system boot up and are they going to work with my front end (using launchbox in BigBox mode)

Jamesbeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:February 11, 2019, 06:13:39 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #14 on: April 11, 2016, 07:21:15 pm »
Gamepads should be fine once you've configured mame and your front end to use them.
Simple usb gamepads are quite mature technology now, so they tend to work pretty well.

The only drawback I had with my controller hacks was that the pc always seemed to want to use P1 as P2 and vice versa. I swapped the controllers around at the usb ports and they've been fine ever since.

The beauty of it is, they are gamepads, so you can try them out and see if they work before you even hack them.
« Last Edit: April 11, 2016, 07:23:10 pm by Jamesbeat »

JDFan

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3448
  • Last login:March 03, 2025, 10:29:54 am
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #15 on: April 11, 2016, 10:45:04 pm »
Yes I have seen those. I'm looking for them around my neighborhood shops.
I have one doubt, if I hack the gamepads then is there going to be any problem software-wise, like will they automatically start wokring on system boot up and are they going to work with my front end (using launchbox in BigBox mode)

If for some reason there is a problem using the gamepad with a certain setup - there are software programs like Joy2key which will capture the gamepad input and pass it to the system as a keyboard key press ( as with most software solutions there will be the need to set things up initially but it should work for those programs that have problems with the gamepad input.)

Anshum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 29, 2018, 01:55:45 pm
  • I want to build my own arcade controls!
Re: Button wiring
« Reply #16 on: April 12, 2016, 01:59:38 am »
That's good. So i'll probably do gamepads now