The NEW Build Your Own Arcade Controls

Main => Raspberry Pi & Dev Board => Topic started by: txgraeme on June 09, 2018, 04:56:03 pm

Title: DIY PiZero Encoder for 49way Midway Joystick
Post by: txgraeme on June 09, 2018, 04:56:03 pm
Does anyone know if it's possible to build a Pi Zero Encoder for 49way joysticks?  The Pi Zeros now have support for use in USB Gadget mode (https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget), and so I was thinking with the GPIO pins available then it can be done quite easily on the hardware side.  The software side I'm basically clueless on.  Anyone have ideas or experience with it?

Thanks in advance.  It would be nice to have a backup for my GDL cabinet when the original hardware fails. 
Title: Re: DIY PiZero Encoder for 49way Midway Joystick
Post by: nitrogen_widget on June 11, 2018, 11:27:35 pm
Wouldn't a micro controller work better?
I picked up a few NANO's off amazon that can be programmed as keyboard,mouse,joystick encoders and have a usb interface.
They are cheaper also.

but i'm not sure how a 49 way actually works.
how many output wires does it have?
Title: Re: DIY PiZero Encoder for 49way Midway Joystick
Post by: txgraeme on June 14, 2018, 05:20:50 pm
Thanks for the response, you list some good things to consider. A micro controller may work better, but I've never done one of those myself. I had always assumed that people had issues because I've not seen a method to use them with the 49ways. I have a set of the GPwiz49 but they only register in Windows, so I am out of luck if I want to use my Linux OS.

IIRC, the 49 ways have 3 optical switches each direction, which are logically combined into 8 active joystick circuits on a 12 pin header.  Roughly 4 buttons on CP per player means controller would need 16 inputs and PiZero GPIO has ~26 (https://www.raspberrypi.org/documentation/usage/gpio/ (https://www.raspberrypi.org/documentation/usage/gpio/)).

My presumption is that a wrapper program could translate inputs for Mame, and  a script in Mame could auto-select game mode for joystick mapping.

EDIT: updated circuit numbers above.
Title: Re: DIY PiZero Encoder for 49way Midway Joystick
Post by: txgraeme on June 14, 2018, 06:37:51 pm
Here is an example code library (Pi Zero) for similar devices:
http://gpiozero.readthedocs.io/en/stable/ (http://gpiozero.readthedocs.io/en/stable/)

Here is a description of previously designed interface using EPROM:
http://www.seanriddle.com/49way.html (http://www.seanriddle.com/49way.html)
Title: Re: DIY PiZero Encoder for 49way Midway Joystick
Post by: baritonomarchetto on June 15, 2018, 12:35:14 am
Arduino nano cannot emulate joystick/mouse/keyboard (HID interfaces) as is. It would be better to work with an arduino pro micro or leonardo if emulating keypresses or mouse is your goal. They have a limited number of inputs anyway. For (way) more inputs and native HID emulation you should consider arduino DUE.
Title: Re: DIY PiZero Encoder for 49way Midway Joystick
Post by: txgraeme on June 15, 2018, 04:58:58 pm
I believe the pi zero has all the inputs required, so I will be focusing my efforts on that board. It already has existing code built-in to act as HID (for example ,https://randomnerdtutorials.com/raspberry-pi-zero-usb-keyboard-hid/), so it may be better choice here.