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: Tying buttons and joystick into GPIO pins...  (Read 4313 times)

0 Members and 1 Guest are viewing this topic.

morton

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 336
  • Last login:July 23, 2021, 09:36:59 am
  • I want to build my own arcade controls!
Tying buttons and joystick into GPIO pins...
« on: April 05, 2017, 09:15:22 am »
Have seen a few threads and articles on using the GPIO pins on the Pi instead of a USB encoder for handling control inputs.

Is anyone here well versed with this? Reason I ask is that I am curious a few things:

- Does the GPIO input method have an advantage over say, a Zero Delay USB encoder? Less Lag?
- Originally I intended to use a VGA666, but am thinking an HDMI to DVI adapter may work best, as it would keep GPIO pins free.
- Most articles I have seen feature a specific set of pins to use. I know the VGA666 leaves 6 free, but would all 6 of those be useable for control inputs?

I am still reading, but these questions are still hampering my efforts, and cannot glean a definitive answer from what I've read. I had considered a 1 player build with 2 buttons, and leave the rest to be handled by a ZeroDelay for coin and start and admin buttons... Any help would be appreciated. Thanks in advance.

keilmillerjr

  • Trade Count: (+5)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1847
  • Last login:October 06, 2023, 10:20:39 pm
  • Web Developer.
Re: Tying buttons and joystick into GPIO pins...
« Reply #1 on: April 05, 2017, 06:30:15 pm »
Utilizing gpio pins will have some lag due to having to run an interpreted language (python) to utilize them. This lag I would assume would be minimal as there would be no comparisons with the somple code required. I think many choose this route as it's easy, cheap, and self contained. All your intended controls can be wired to gpio.

What are you using for a monitor? New firmware allows for 240p over composite. No adapters needed. ;)

morton

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 336
  • Last login:July 23, 2021, 09:36:59 am
  • I want to build my own arcade controls!
Re: Tying buttons and joystick into GPIO pins...
« Reply #2 on: April 05, 2017, 09:09:23 pm »
Lag you say?? Maybe there is little advantage to that over a USB encoder then?

For my monitor I want to use an arcade monitor. I may go CRT... I realize the composite outputs 240p now will have to read up on that, I thought it always did, but never checked?

Thanks

nitrogen_widget

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1746
  • Last login:Yesterday at 07:02:12 am
  • I want to build my own arcade controls!
Re: Tying buttons and joystick into GPIO pins...
« Reply #3 on: April 05, 2017, 11:15:18 pm »
There are gpio drivers that are not python but kernal modules or binaries or even advmame with built in gpio.

https://github.com/search?utf8=%E2%9C%93&q=gpio+joystick&type=




Slippyblade

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3167
  • Last login:November 16, 2023, 11:39:51 am
  • And to the death god we say, "Not today!"
Re: Tying buttons and joystick into GPIO pins...
« Reply #4 on: April 06, 2017, 01:46:48 am »
Here's a good tute on doing what you need.  Scroll WAY down and find the section on RetroGame

https://learn.adafruit.com/retro-gaming-with-raspberry-pi?view=all

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Re: Tying buttons and joystick into GPIO pins...
« Reply #5 on: April 06, 2017, 10:22:55 am »
Lag you say?? Maybe there is little advantage to that over a USB encoder then?

I don't have any benchmarks on one vs. the other. However, my suggestion is: keep GPIO for stuff that USB currently can't handle, like custom stuff, or the gert666. If you're worried about lag, get a keyboard encoder rather than a gamepad encoder. Ultimarc and GroovyGameGear work great. The encoders will make your life simpler, and in my opinion $40-60 well spent.

For my monitor I want to use an arcade monitor. I may go CRT... I realize the composite outputs 240p now will have to read up on that, I thought it always did, but never checked?

It always output to the composite. In the past it wasn't capable of outputting at such a low resolution, and there were visible scan lines. With several of my old CRTs the scan lines are now gone. One still has scan lines, but I think that has more to do with it being old/crappy and there being some kind of other interference.



Raspberry Pi, AttractMode, and Skeletor enthusiast.

keilmillerjr

  • Trade Count: (+5)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1847
  • Last login:October 06, 2023, 10:20:39 pm
  • Web Developer.
Re: Tying buttons and joystick into GPIO pins...
« Reply #6 on: April 06, 2017, 02:07:20 pm »
Lag you say?? Maybe there is little advantage to that over a USB encoder then?

I don't have any benchmarks on one vs. the other. However, my suggestion is: keep GPIO for stuff that USB currently can't handle, like custom stuff, or the gert666. If you're worried about lag, get a keyboard encoder rather than a gamepad encoder. Ultimarc and GroovyGameGear work great. The encoders will make your life simpler, and in my opinion $40-60 well spent.

For my monitor I want to use an arcade monitor. I may go CRT... I realize the composite outputs 240p now will have to read up on that, I thought it always did, but never checked?

It always output to the composite. In the past it wasn't capable of outputting at such a low resolution, and there were visible scan lines. With several of my old CRTs the scan lines are now gone. One still has scan lines, but I think that has more to do with it being old/crappy and there being some kind of other interference.

It was fixed resolution of 480i.

behrmr

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 459
  • Last login:April 23, 2021, 09:17:13 am
Re: Tying buttons and joystick into GPIO pins...
« Reply #7 on: April 06, 2017, 04:05:18 pm »
Have seen a few threads and articles on using the GPIO pins on the Pi instead of a USB encoder for handling control inputs.

Is anyone here well versed with this? Reason I ask is that I am curious a few things:

- Does the GPIO input method have an advantage over say, a Zero Delay USB encoder? Less Lag?
- Originally I intended to use a VGA666, but am thinking an HDMI to DVI adapter may work best, as it would keep GPIO pins free.
- Most articles I have seen feature a specific set of pins to use. I know the VGA666 leaves 6 free, but would all 6 of those be useable for control inputs?

I am still reading, but these questions are still hampering my efforts, and cannot glean a definitive answer from what I've read. I had considered a 1 player build with 2 buttons, and leave the rest to be handled by a ZeroDelay for coin and start and admin buttons... Any help would be appreciated. Thanks in advance.

If you use the VGA666 adapter you will not have enough GPIO pins left for your controls.  My experience outputting 15khz to an arcade monitor was that the signal was going to need an amp so don't be surprised if you have to go that route.  I think that using a jpac helps with that but you are trying to save money so that probably doesn't help.

I also tried one of the cheap HDMI adapters and a VGA breakout cable and didn't see any real difference in image quality vs. the VGA666.  But your experience may be different.  They are both about the same price anyway.

Good luck.


morton

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 336
  • Last login:July 23, 2021, 09:36:59 am
  • I want to build my own arcade controls!
Re: Tying buttons and joystick into GPIO pins...
« Reply #8 on: April 10, 2017, 01:38:36 pm »
I have a VGA666 I got for the hell of it, just not sure what I will do with it. I am considering a 21" CRT computer monitor, as I believe most NTSC CRT TVs will only leave me with component connection at best.

I was under the assumption that my GPIO pins would be less laggy or finicky than a USB encoder. The VGA666 takes up all but 6 pins, so was figuring that if I had a common ground, I would only need six pins open for a joystick (4) and 2 buttons, but I guess I need more pins? Was gonna use USB Encoder still for the coin and start buttons, but seems like I am better off using the encoder for all controls eh?

mahuti

  • Wiki Master
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 2757
  • Last login:March 02, 2022, 09:51:19 pm
  • I dare anything! I am Skeletor!
Re: Tying buttons and joystick into GPIO pins...
« Reply #9 on: April 10, 2017, 04:53:30 pm »
You'll need 4 connectors for 4-way joystick + buttons. You'll need (usually) a coin button, a player 1 start button, an exit button, and whatever other buttons you need for Mame. For most consoles you'd need 4 connectors for a 4-way joystick + start & select, and whatever other buttons. You could probably be OK with 8 or 9, but 6 just isn't enough for most anything. Pacman on free play I guess would work... or other 4 way maze games on free play.

If you have a CRT computer monitor, you can just do HDMI - VGA adapter... no need for the VGA666.

If you're really discerning, then maybe lag would an issue. Personally, using any of my keyboard or gamepad encoders from  Ultimarc or GGG, I don't notice lag.
Raspberry Pi, AttractMode, and Skeletor enthusiast.

JDFan

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3448
  • Last login:May 21, 2023, 04:07:42 pm
  • I want to build my own arcade controls!
Re: Tying buttons and joystick into GPIO pins...
« Reply #10 on: April 11, 2017, 11:43:14 am »
6 pins might suffice for a 4 way and 2 buttons - if you get a bit adventurous with the setup - ie. 6 pins + ground pin for 4 way and 2 action buttons then wire up the coin up button to use joystick Up and Down both pressed and Start button to joystick Left and Right both pressed - since you can not hit both using the joystick no chance of hitting both by mistake but wiring the button to both connections would activate both when pressed.)

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 02:12:01 pm
  • Designated spam hunter
Re: Tying buttons and joystick into GPIO pins...
« Reply #11 on: April 11, 2017, 08:31:30 pm »
6 pins might suffice for a 4 way and 2 buttons - if you get a bit adventurous with the setup - ie. 6 pins + ground pin for 4 way and 2 action buttons then wire up the coin up button to use joystick Up and Down both pressed and Start button to joystick Left and Right both pressed - since you can not hit both using the joystick no chance of hitting both by mistake but wiring the button to both connections would activate both when pressed.)
KADE Extended Mode used the "impossible keypresses" trick. (related wiring thread here)



The red lines in the diagram above are like the Y-wire shown below.



You can also use diodes (diagram here) to isolate the inputs.


Scott

morton

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 336
  • Last login:July 23, 2021, 09:36:59 am
  • I want to build my own arcade controls!
Re: Tying buttons and joystick into GPIO pins...
« Reply #12 on: April 18, 2017, 10:30:03 am »
If I were to use GPIO's it would be to get the absolute best response possible... which I am not so sure is the case when using the pins. My thinking was to use the pins AND VGA666, I would use a stick, two buttons, and run the rest off a USB encoder as the admin, coin and start buttons don't need the responsiveness.  It is only a 1 player cab, so I needn't worry about multiple players.

In regards to the HDMI to VGA adapter - are these as good as the VGA666? Or do they introduce SOME lag? Or?