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 --- Bug Reports --- Site News

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

  

Author Topic: Controllers direct to GPIO - no keyboard encoder.  (Read 5463 times)

0 Members and 1 Guest are viewing this topic.

EightBySix

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 523
  • Last login:October 10, 2018, 09:34:37 am
Controllers direct to GPIO - no keyboard encoder.
« on: April 01, 2015, 05:55:19 am »
Wanted to start a thread around this. It's attractive to me because it's one less component (the keyboard encoder). I also have a simple setup of two players, 2 buttons. If you have lots, then you'll run out of pins.

I got it working for player 1 (still to do player 2, coin sensor and a few admin buttons) using retropie - a program to monitor the pins, and initiate key presses - with these instructions from adafruit.

Note that some of the links are updated for the RPi2. It seems to work fine with Emulation Station.

The tricky bit for me was the physical connection from the controls to the GPIO header. The available pins aren't all together, so I connected the control wires individually after crimping these on the end.


The way I did it is flexible (I knew I wouldn't get them right 1st time) but I think a better approach would be to get or make a GPIO breakout cable with some screw terminals like this.

Might actually be better to make one, so I can put meaningful labels on it from the controls.



DaOld Man

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4849
  • Last login:April 06, 2019, 11:07:14 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #1 on: April 05, 2015, 08:47:30 am »
Interesting. How many inputs are available? Enough for two player?

BobA

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5943
  • Last login:July 11, 2018, 09:52:14 pm
  • What Me Worry?
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #2 on: April 05, 2015, 10:51:54 am »
Pi with the 26 pin header has 15 i/o ports.  Can be programmed as either input or output.

DaOld Man

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4849
  • Last login:April 06, 2019, 11:07:14 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #3 on: April 06, 2015, 01:11:12 pm »
Pi with the 26 pin header has 15 i/o ports.  Can be programmed as either input or output.

Not enough for most two player games.
I guess games that have both players using same controls would be ok (IE: Pacman, Donkey Kong, etc). But two player fighter games not so much.

nitrogen_widget

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1192
  • Last login:July 05, 2019, 08:22:21 pm
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #4 on: April 06, 2015, 01:53:52 pm »
Doesn't the new RPI 2 have a 40 pin header?
That should equally a few more inputs.
Maybe enough for neo Geo?
Now I gotta research this.

keilmillerjr

  • Trade Count: (+5)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1665
  • Last login:Today at 09:47:30 pm
  • Web Developer.
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #5 on: April 06, 2015, 05:22:32 pm »
Doesn't the new RPI 2 have a 40 pin header?
That should equally a few more inputs.
Maybe enough for neo Geo?
Now I gotta research this.

Marketing can be deceiving because not all 40 GPIO pins are I/O pins. I forgot the actual number.

nitrogen_widget

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1192
  • Last login:July 05, 2019, 08:22:21 pm
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #6 on: April 07, 2015, 11:08:00 am »
Doesn't the new RPI 2 have a 40 pin header?
That should equally a few more inputs.
Maybe enough for neo Geo?
Now I gotta research this.

Marketing can be deceiving because not all 40 GPIO pins are I/O pins. I forgot the actual number.

It should be half.
if they followed the same scheme as the original.
so 20.
which should be enough for two joysticks with 6 buttons each.

admin/coin/start buttons would have to be handled by USB which isn't too bad an option.
I'm just not sure exactly which fighter games would work on a RPI or an RPI2.

i've read recently that some people have Final Burn Alpha Libretro Playing street fighter 3 smoothly on the RPI2 but I haven't tested this myself.

EightBySix

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 523
  • Last login:October 10, 2018, 09:34:37 am
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #7 on: April 07, 2015, 04:07:58 pm »
There are 15 pins available, plus 4 extra if you are happy to solder a header on = 19.

So for my setup:
 4 directions, and 2 buttons = 6

 x 2 players = 12

Plus p1 and p2 start and coin leaves room for 4 admin type buttons

nitrogen_widget

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1192
  • Last login:July 05, 2019, 08:22:21 pm
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #8 on: April 07, 2015, 06:22:45 pm »
There are 15 pins available, plus 4 extra if you are happy to solder a header on = 19.

So for my setup:
 4 directions, and 2 buttons = 6

 x 2 players = 12

Plus p1 and p2 start and coin leaves room for 4 admin type buttons

ok.
So the classics.

elPaulio

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 6
  • Last login:March 17, 2016, 01:36:24 pm
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #9 on: April 12, 2015, 06:16:05 am »
I did exactly this....

So I ended up making my own connections, but with the pins on the Pi end pre bought.
I had a 20cm cable length with one of those little pin connectors on each side.

I chopped the end off, and reused it. The other end, I crimped myself with spade connectors of various sizes and then simply spliced/soldered them together and put a bit of insulating tape around it
Note, soldering is important, because they would just not hold themselves with tape alone

worked well for me :)

If I were to do it again, id definitely go for either crimping both ends myself, or a breakout board like you suggest. It would just be cleaner, and easier to trace the cabling once its all in there
I have joystick, 6 player buttons and 3 more for start/credit/select/exit, so the wiring got a bit tiresome at times!

scaryevilguy

  • Trade Count: (0)
  • Newbie
  • *
  • Offline Offline
  • Posts: 1
  • Last login:October 19, 2015, 03:55:49 am
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #10 on: April 13, 2015, 05:13:55 am »


This is the pinout I used in a RPi 2 using DigitalLumberjacks driver. It allows 2 joysticks, and 8 buttons per player. Works fine with Retropie

nitrogen_widget

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1192
  • Last login:July 05, 2019, 08:22:21 pm
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #11 on: April 13, 2015, 02:51:12 pm »
Then I guess I was right.
didn't think it made sense to have a 40 pin GPIO but not increase the actual number of usable GPIO's incrementally.

StefanBurger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 38
  • Last login:February 13, 2018, 04:07:59 am
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #12 on: April 21, 2015, 03:28:22 pm »
Adafruit has also an gpio to usb-keyboard driver:
https://github.com/adafruit/Adafruit-Retrogame

mvolke1

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 338
  • Last login:August 11, 2017, 04:30:56 pm
    • My Pi-Powered Galaga-Thmed Bartop
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #13 on: May 07, 2015, 03:19:05 pm »
I use an iPac with my Pi bar top and it's worked great. Very simple.
I'm with stupid.

StefanBurger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 38
  • Last login:February 13, 2018, 04:07:59 am
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #14 on: May 07, 2015, 06:12:32 pm »
I also use Ultimarc iPac4 with raspberry-pi 2 and it works great (just plug and play, will be recognized as a keyboard, no special drivers necessary).

Another approach would be a simple custom pcb with shiftregisters:
http://www.instructables.com/id/Using-a-shift-register-with-Raspberry-Pi/?lang=de

Regards
Stefan

StefanBurger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 38
  • Last login:February 13, 2018, 04:07:59 am
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #15 on: May 07, 2015, 06:15:53 pm »
Some YouTube Tutorial about using shiftregisters to expand number of input ios:

Slippyblade

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3156
  • Last login:April 26, 2019, 02:25:09 pm
  • And to the death god we say, "Not today!"
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #16 on: May 07, 2015, 06:52:47 pm »
I use a KADE mysef programmed as a keyboard encoder.  Not had any problems.

pbj

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8543
  • Last login:Today at 09:02:32 pm
  • Obey.
    • The Chris Burke Band
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #17 on: May 07, 2015, 11:08:31 pm »
Pi 2 has recognized everything I've thrown at it thus far.
This forum needs more threads about Arcade 1Up cabinets.

DaOld Man

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4849
  • Last login:April 06, 2019, 11:07:14 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #18 on: May 09, 2015, 10:07:49 pm »


This is the pinout I used in a RPi 2 using DigitalLumberjacks driver. It allows 2 joysticks, and 8 buttons per player. Works fine with Retropie

Anyone have a pinout pic like this one, but for the RPi B? 26 pins

nitrogen_widget

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1192
  • Last login:July 05, 2019, 08:22:21 pm
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #19 on: May 09, 2015, 10:23:34 pm »

DaOld Man

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4849
  • Last login:April 06, 2019, 11:07:14 pm
  • Wheres my coffee?
    • Skenny's Outpost
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #20 on: May 10, 2015, 12:05:36 am »
I'll be using this guide for my rpi1
https://learn.adafruit.com/retro-gaming-with-raspberry-pi/buttons

Thanks!
So from what I understand, we could use GPIO 24 & 8 for ESC and Player 1 Start?

I have a small (2.8") touchscreen that I plan to plug into this connector too. How would using these pins as inputs affect the screen?

StefanBurger

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 38
  • Last login:February 13, 2018, 04:07:59 am
  • I want to build my own arcade controls!
Re: Controllers direct to GPIO - no keyboard encoder.
« Reply #21 on: May 10, 2015, 01:09:24 am »
...
I have a small (2.8") touchscreen that I plan to plug into this connector too. How would using these pins as inputs affect the screen?

well, assumed thats the same 2.8 touch tft like the following
http://www.adafruit.com/products/1601
...then:

Quote from: adafruit
...Uses the hardware SPI pins (SCK, MOSI, MISO, CE0, CE1) as well as GPIO #25 and #24. All other GPIO are unused. Since we had a tiny bit of space, there's 4 spots for optional slim tactile switches wired to four GPIOs, that you can use if you want to make a basic user interface. For example, you can use one as a power on/off button. See below for the link to get the optional tact switches, they're not included...