Newbie. PI4, trying to use GPIO for controllers
-
I have a xmas Pi 4 8gb that my wife got for me.
I have already extracted a retropie 4 image and setup a 128gb drive and added a bunch of mame roms. It pays great with my usb controller but I don't want to use it for that. I want to use my gutted Pandora's box and the GPIO header. Pandora's box is just a arcade controller with a pair of digital joysticks and a bunch of buttons.
I've found instructions how to attach the wires to the header and that part is all done but I"m a bit confused by configuring the controller itself in Emulation Station.
I can't seem to find how to enable it.
Do I enable it in the retropi operating system or in the emulation station software? A lot of the guides are overwhelming.
My knowledge of Linux Is very limited.
-
Just connecting the wires to the GPIO header will not be enough, you need a driver that translates the inputs into a joystick/gamepad for the OS to identify it properly.
You can use the mkarcadejoystick GPIO driver, it's available in thedrivers
package section of RetroPie-Setup - you'll have to either use the default wiring setup used by the driver or configure themap
parameter of the driver to match your wiring. -
Ahh, that makes more sense.
I think I was misunderstanding and thinking that the Retropie had built in setup for the GPIO.
This is my first Pi so I'm still learning.
So the Raspberry Pi OS is the software like Windows and the Emulation Station is a front end that runs on top of the Pi OS and executes the individual emulator packages (mame, atari 8-bit, sega genesis, etc)?
Emulation Station being the front end makes everything all pretty and easy to configure so when you go and select a game, it will pass the proper command parameters to the emulator for the rom you selected?
And the driver you mentioned will allow the actual Pi OS to enable and utilize the GPIO port for the game controllers. Then the emulators can actually run the game.
Is that kind of correct?
-
@bobotech said in Newbie. PI4, trying to use GPIO for controllers:
Is that kind of correct?
Pretty much. As an alternative to the GPIO drivers available in RetroPie-Setup, you can try GPIOnext, looks more user friendly with its graphical user interface to configure the controls.
-
I have a new question. Thanks to Mitu, I have now gotten all my buttons working with the GPIO using the GPIOnext tool and driver.
Can I add additional buttons to the GPIO header? I currently am using 24 pins plus the 2 grounds.
For each controller, I am using 4 pins for the joystick, 6 pins for the 6 main buttons, and 2 pins for each of the 2 special buttons at the top.
I really want to add 2 buttons to the side of the case for pinball flippers and possibly another couple of buttons to invoke the mame menu during game play.
So I would want another 2 buttons but would really like 4 to 6 more to give me plenty of options for expansion.
-
You can use a I2C GPIO expander (like MCP23017/MCP23008) to get additional inputs.
-
@mitu said in Newbie. PI4, trying to use GPIO for controllers:
You can use a I2C GPIO expander (like MCP23017/MCP23008) to get additional inputs.
Would you recommend using the GPIO expander or doing something simpler like tearing apart a generic usb keyboard and just wiring in the buttons to the keyboard matrix? I just want to add in some secondary buttons, i'm not worried about keyboard bounce or more than 2 keystrokes at a time. (the 2 flipper buttons on the side of the controller).
-
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.