How to Build a Cheap Arcade Spinner for MAME

Поділитися
Вставка
  • Опубліковано 22 лис 2018
  • I show you how to build a cheap acade spinner for MAME and other emulators using an Arduino Micro or a clone with the Atmega32u4 chip. You will need to install the Arduino Joystick Library available at: github.com/MHe...
    The Arduino code for the spinner is here: github.com/jmt...
    You will need a breadboard, and Arduino Micro (or clone), some momentary switch buttons, some breadboard jumper wires, and a 2 phase rotary encoder. In the video I say any 2 phase encoder will work. That's not exactly true. It needs to support an operating voltage of 5v DC. Most support a range of voltages, e.g. 5-24v. Another thing I said in the video which is partially incorrect is that you can reverse the +/- on the buttons, so that when a button is pushed it will read HIGH instead of LOW, but that you'd have to change the code. You can do that, but not only do you have to change the code, you also have to wire on pulldown resistors. The Arduino Micro has internal pullup resistors, but not internal pulldown ones.
    This device will be detected as both a mouse and a joystick/gamepad. The joystick only has an X axis which we don't use. It was needed by the library to declare the joystick. We just center that x axis in setup() and forget about it. The spinner controls the mouse X axis which is by default mapped to the analog dial in MAME (don't forget to enable the mouse in MAME under advanced options!). The buttons will work as regular gamepad/joystick buttons. The 2400 different positions that can be detected on the 600ppr encoder I'm using are way too many for our purposes. The "mouse" is only polled every 1ms. This means at max we can only send 1000 move mouse commands per second, not even enough to get halfway around the encoder in 1 second. So, we only move the mouse for every 2 transitions. I find this works OK, but you may want to adjust it depending on the rotary encoder you're using. In the code I'm moving the mouse by 1 pixel at a time. If you want to speed it up you can move it by more. The code uses the Atmega32u4 ports directly because that's faster than using digitalRead/Write. I'm not a great programmer, so if you see a way to make this work better let me know.

КОМЕНТАРІ •