Author Topic: Raspberry Pi/PC MAME Keyboard Joystick/Button Hack  (Read 2028 times)

0 Members and 1 Guest are viewing this topic.

Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Raspberry Pi/PC MAME Keyboard Joystick/Button Hack
« on: June 29, 2015, 02:27:39 pm »
Hi everyone,

I had a question regarding a MAME joystick/button hack and if anyone has experience doing this or perhaps using another method. I have MAME on my PC and also just recently set up RaspiCade on my RasPi and playing games using a keyboard. However, I'd like to get some controllers working with it (Joystick and some buttons).

One idea was to take an old USB keyboard and wire in buttons in parallel to the keys. That way I can still use the keyboard, but have the buttons (or joystick left/right/up/down switches) tied into the keyboard in parallel so they would also activate the button when pressed.

I know the RaspiCade lets you set up the GPIO for this, but it may be more complicated to set up. Also, it would not be as easy to adapt to the PC version. If I can tap the keyboard I can essentially still use the keyboard for all the other functions but have the additional feature of actuating the keys using the button/joystick.

Another idea is rather than modify the main keyboard, to just wire in 2nd keyboard 's driver chip to the buttons and chain it using USB to the first keyboard. Can a computer or RasPi support 2 keyboards chained to each other? Will both function? Right now I have the mouse chained to the keyboard (this particular USB keyboard has another USB port on it to allow chaining a mouse or other USB device if needed).

Any advice would be helpful. 

I stumbled upon this and will need some time to understand what is going on here:

http://www.jbprojects.net/projects/mame/mame2.php

I also found some stuff on eBay which includes buttons/joysticks and a USB encoder. Not sure what the USB encoder does but it seems to basically act as a keyboard driver chip and convert the button inputs into characters that I can then map to MAME. I am using default keyboard mapping anyways (like Ctrl, Alt, Shift are fire buttons and the arrows for direction movement, and usually 1 and 2 are to choose players and 5 is to insert coins).

I also saw some Arcade USB encoders....small board which looks like it just maps down certain connectors to specific keys (probably common MAME keyboard mapping for controls), so you don't have to hack a keyboard and trace what combination of pins produces what key strokes and have a mess of wires to tap into.

They have a joystick port which is just 5 wires... I assume this just re-produces the keyboard encoder code for the 4 arrow keys. One high voltage and 4 drains? Or the other way (1 ground and 4 high)? I will have to grab a volt-meter to see how the keyboard encoder works... It looks like there is a matrix/grid with columns set high (scanning in a looping pattern) and rows set as drains/sense pins. When you hit the a key, based on the column that is high at the moment, it sees what sense/drain pins are feeling the high current and uses the combination to tell which button is being pressed.

I guess if it loops through the columns and sensing the rows (scanning through every key hundreds of times a second this way) it can tell which key is being pressed at any moment in time. Even multiple keys can be pressed simultaneously and it can tell which are being pressed, and then load the key into the buffer and send it along to the computer via USB.

I've been digging a bit more since I posted.... I found these:

http://www.extremetech.com/extreme/56538-hack-your-keyboard

http://arcadecontrols.com/arcade.htm

I'm going to pour through these sites. Based on what I see, either I make a very simple hack or I just buy a pre-made kit. Otherwise it will not be worth my time soldering and mapping the matrix.
« Last Edit: June 29, 2015, 07:00:38 pm by edy »
YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf