GPIO to Keys simplest method?

Home Forums RetroPie Project Controller Configuration in RetroPie GPIO to Keys simplest method?

This topic contains 21 replies, has 7 voices, and was last updated by Profile photo of mholgatem mholgatem 1 year, 7 months ago.

Viewing 22 posts - 1 through 22 (of 22 total)
  • Author
    Posts
  • #96250
    Profile photo of raoulangel
    raoulangel
    Participant

    I have read dozens of messages on here, downloaded modules, configured and edited files and still no luck. If a person starts with a fresh retropie image, is there a simple, basic, step-by-step that I can follow that will let me attach a joystick and 8 buttons to the GPIO, and make them work as up, down, left, right, a, b, enter, escape, tab, pause, select and start? PLEASE this has been two weeks now with no success…

    #96467
    Profile photo of proaudiosoft
    proaudiosoft
    Participant

    Doesnt look like no one is going to help you with this. I think it’s kinda a taboo topic since their pushing the whole block thingy…..

    #96491
    Profile photo of joer456
    joer456
    Participant

    I am also interested in this topic and cant find a straight forward answer anywhere! The emulators that I use are all RetroArch and I want to use my GPIO pins on my Pi2 as controls.
    4x Joystick (up,down,left,right_
    1x A
    1x B
    1x X
    1x Y
    1X L
    1x R
    1X Start
    1x Select
    1X ESC

    I know how to find and edit the RetroArch.cfg file to change mappings for a keyboard but I was wondering if anyone knew how to map GPIO pins instead of keys?
    I’m beginning to think buying a keyboard encoder/ I-PAC is the easiest way of doing this

    #96499
    Profile photo of danielfsc
    danielfsc
    Participant

    I use this module and works 100% to me. I don´t have a ESC button but I use start+select.
    https://github.com/digitalLumberjack/mk_arcade_joystick_rpi

    #96509
    Profile photo of raoulangel
    raoulangel
    Participant

    That mk_arcade_joystick_rpi one I tried over and over… I followed every step, even copied and pasted th commands to the PI using tty, but when I tried to load mk_arcade_joystick module it said the module was not found..

    I didn’t miss a step, so where is this mysterious module?

    #96532
    Profile photo of proaudiosoft
    proaudiosoft
    Participant

    I have a pi2, just got it going using a method, super easy:

    Compilation
    $ git clone https://github.com/ian57/Raspicade-Retrogame-2Player-Pi2.git
    $ cd Raspicade-Retrogame-2Player-Pi2
    $ make

    Retrogame requires the uinput kernel module. This is already present on the system but isn’t enabled by default. For testing, you can type:

    sudo modprobe uinput

    To make this persistent between reboots, append a line to /etc/modules (or edit the file) :

    sudo sh -c ‘echo uinput >> /etc/modules’

    Now we’re in good shape to test it! Retrogame needs to be run as root (need access to memory), i.e.:
    sudo ./retrogame

    Give it a try. If it seems to be working, press control+C to stop the program and we’ll then set up the system to launch this automatically in the background at startup.

    sudo nano /etc/rc.local

    Before the final “exit 0” line, insert this line:

    /home/pi/Raspicade-Retrogame-2Player-Pi2/retrogame &

    If you placed the software in a different location, this line should be changed accordingly. “sudo” isn’t necessary here because the rc.local script is already run as root.

    Reboot the system to test the startup function:

    sudo reboot

    #96562
    Profile photo of joer456
    joer456
    Participant

    I’ve decided to go down the route of using a USB keyboard to create my arcade buttons, seems much simpler. I plan on taking apart the usb keyboard and soldering the buttons and joystick as shown in the below pic. I’ll then edit the cfg files to accommodate for the keys being pressed by the arcade buttons

    Attachments:
    #96583
    Profile photo of raoulangel
    raoulangel
    Participant

    Actually, if you have the space for all that, I suggest this:

    https://www.ultimarc.com/minipac.html

    It’s what I used on my Zaxxon Tabletop cab. Super-simple, uses USB for power and I/O, and There was enough room inside the box for the extra board.. I wanted to use the GPIO this time, as I felt all the hype about how useful, convenient and simple it was had convinced me…

    #96951
    Profile photo of proaudiosoft
    proaudiosoft
    Participant

    its as easy as pie, literally. would be glad to assist anyone.

    #96952
    Profile photo of raoulangel
    raoulangel
    Participant

    Proaudiosoft… I am going to work on this tonight.. I’ll follow your previous post and if I hit a wall I’ll hit you up. Thanks

    #97013
    Profile photo of raoulangel
    raoulangel
    Participant

    proaudiosoft, I followed this:
    I have a pi2, just got it going using a method, super easy:

    Compilation
    $ git clone https://github.com/ian57/Raspicade-Retrogame-2Player-Pi2.git
    $ cd Raspicade-Retrogame-2Player-Pi2
    $ make

    When I typed make, I get:

    “make: Nothing to be done for ‘all’.”

    What happened? This is not as simple as you made it sound…

    #97235
    Profile photo of surtana
    surtana
    Participant

    @proaudiosoft: I followed your tutorial, but still I don’t get any reaction when using my arcade buttons or joysticks.
    I also modified retrogame.c to fit my GPIO connection setup.

    Should I now be able to Navigate through Emulation Station with the Joystick? By now this ist not possible.
    Is there a way to test the Button / GPIO Connection?

    Greetings
    Tobias

    #97276
    Profile photo of surtana
    surtana
    Participant

    Today I got a Measure Device. So after some testing I found out, that my wiring ist pretty bad, only 2 of 6 Player1 buttons seem to work and only 1 Joystick direction.
    I used an old IDE Cable and cutted of one end to connect the wires to the Buttons.

    After that I started all over with a new SD Card. I Installed Retropie on it using win32 Disk Imager. Then expanded the file system, changed memory split to 256 and reboot.
    I copied the folder Adafruit-Retrogame from my pc to the pie into the roms folder.

    I think my mistake was thinking the Retrogame makes the Buttons work in EmulationStation, but when connected to a MAME Rom and opening the Input Config there is a reaction to the Buttons. Unfortunately not the way I wanted. The Pins I thought I configured to be KEY_A turns out to be DOWN.

    I think I will renew the whole wiring.

    Regards

    #97280
    Profile photo of raoulangel
    raoulangel
    Participant

    So you copied the retrogame.c folder to the ROMS folder? How do you make it run at startup?

    #97297
    Profile photo of surtana
    surtana
    Participant

    I modified this part:

    sudo nano /etc/rc.local

    Before the final “exit 0″ line, insert this line:

    /home/pi/Raspicade-Retrogame-2Player-Pi2/retrogame &

    to:

    sudo /home/pi/RetroPie/roms/Adafruit-Retrogame/retrogame &

    I placed it there, because that’s the folder I had access to from my PC over Network.

    #98598
    Profile photo of raoulangel
    raoulangel
    Participant

    Got it to work great… Here’s the result!!

    One other thing, has anyone gotten trackball/mouse/dial controls to work? Is there a driver like the old DOS mouse drivers that are needed?

    #101900
    Profile photo of phoenix
    phoenix
    Participant

    I didn’t come across this thread until late, but for anyone else working on this, I found the instructions at https://learn.adafruit.com/retro-gaming-with-raspberry-pi/buttons to be quite helpful.

    The procedure is essentially what @raoulangel described.

    #103614
    Profile photo of phoenix
    phoenix
    Participant

    I have found an even better solution – GPIoneer. Just google it. It was designed for “PiPlay”, but works just fine with Retropie. It is very similar to adafruit’s “retrogame”, but much easier to configure using the web interface.

    edit: Gpioneer is great for adding Key inputs; but Retropie only sees it as a keyboard, not as a gamepad.

    #110050
    Profile photo of mholgatem
    mholgatem
    Participant

    @phoenix, I know that this post is old; but out of curiosity, what is the difference between Retropie recognizing it as a keyboard vs a gamepad? does Retropie limit functionality on keyboards? I’m the developer of GPioneer, so I’d like to know if I can make this better. I use Piplay, not Retropie; but I’d like GPioneer to be able to support both.

    #110057
    Profile photo of proaudiosoft
    proaudiosoft
    Participant

    The absolute easiest and fastest way to setup GPIO and have it integrated to all the emulators: bartop-arcade.com

    works fantastic! just check out there products section. Well worth the time saving, and all the frustration.

    #110210
    Profile photo of phoenix
    phoenix
    Participant

    @phoenix, I know that this post is old; but out of curiosity, what is the difference between Retropie recognizing it as a keyboard vs a gamepad? does Retropie limit functionality on keyboards? I’m the developer of GPioneer, so I’d like to know if I can make this better. I use Piplay, not Retropie; but I’d like GPioneer to be able to support both.

    The difference is when one is stupid. I didn’t realize that all I needed to do was keep holding the button when emulationstation starts configuring. I just pressed it, saw it said “keyboard input”, and gave up. Once I figured that out, I was fine. GPIoneer is by far the best way to interface directly with arcade controls via the GPIO. Kudos, sir.

    #110216
    Profile photo of mholgatem
    mholgatem
    Participant

    ah, cool. Well I’m glad that you like it and that it has helped you out!

Viewing 22 posts - 1 through 22 (of 22 total)

Forums are currently read only - please visit the new RetroPie forums at https://retropie.org.uk/forums/

Skip to toolbar