J-ACE Arcade Controls Encoder
Jaka Arcade Controls Encoder
The J-ACE is a DIY USB keyboard encoder. It allows you to make e.g. an USB arcade stick or you can use it in a dedicated MAME cabinet. It has cheap and simple hardware which is easy to build yourself.
Features
- 16 inputs which all have a dedicated microcontroller pin. No ghosting, jamming or delays.
- One additional input for autofire button. Autofire has adjustable speed and can be configured for any combination of action buttons.
- 4 outputs for LEDs. One LED is for autofire indication, three other leds act as num lock, caps lock and scroll lock leds.
- Full-speed USB with up to 1000 Hz update speed (*)
- Advanced debounce function with zero added delay for both press and release of a button.
- Works as standard HID keyboard or standard HID joystick
- 4 separate keymaps, configured as MAME players 1,2,3 and 4.
- No software needed for selection between different keymaps or for changing autofire settings
- Autofire and keymap settings are stored in EEPROM and are retained after power cycle
- Full NKRO (N-key rollover) for keyboard encoder mode. All 16 inputs work simultaneously.
- Shift function doubles the keycodes sent by each button. Allows coin acceptor, pause etc. MAME special function without dedicated button
- Works in Windows, Linux, Mac (standard HID device, no drivers needed)
- Works in all major emulators (MAME, RetroPie, etc.)
- Upgradeable FW (Microchip compatible HID bootloader)
(*) Seems to depend on OS. Windows polls at 1000 Hz, Linux and OSX poll at 500 Hz.
Hardware
The hardware is based on PIC18F24K50, a microcontroller with integrated full-speed USB. The circuit is kept as simple as possible, while trying to provide optimum performance.
The PIC has integrated pull-up resistors at port B. Ports A and C require external pull-ups. The external pull-ups are provided by resistor network RN1. The pull-up resistor value is not critical, so if you can't find 4k7 network you can use pretty much anything between 1k and 47k. Capacitor C3 is not mandatory. It protects the PIC reset input from spurious glitches, which could cause the USB connection to reset in noisy environment, at least in theory.
I have aimed to use full speed USB which generally requires hardware USB support from μC. There are SW USB implementations for Atmel μC's that don't have any USB HW. I find these implementations quite impressive. These are however currently limited to low speed USB. Low speed USB supports maximum update rate of 100 Hz. In practice that would perhaps not matter much, most HID devices are low speed. But I wanted to get the lowest possible lag.
The board uses all through-hole components so it is easy to build for beginners. All connections to joystick, buttons and LEDs have screw terminals for connection. For USB connection, there are two alternatives. The default is a standard USB-B connector, which suits most needs. It is also possible to use a 5-pin header, which is used on some cables or panel mount connectors, e.g. Bulgin Buccaneer series panel mount USB connectors. The Eagle 3D rendition of the J-ACE below shows the board with standard USB B connector.
Firmware
Firmware is written with CCS PIC-C compiler. The aim has been to minimize lag to an absolute minimum. The polling interval is 1 ms, which means update rate of 1000 Hz. The button readout, debounce, shift function, autofire and data transfer takes maximum of 650 μs, so the 1000 Hz constant update rate is reality. The debounce algorithm has separate counters for each button, which means that each button reacts immediately to a press or release, independent of other inputs. The debounce is implemented for both press and release of button, as some microswitch types have contact bounce also at release.
The source code and compiled .HEX file are available for download below. Note! USB header files for HID descriptors is not included in the package, as it is modified from CCS copyrighted code. Contact me if you have the compiler and need the files.
Downloads
j_ace_circuit_diagram.pdf Just what the file name says. It's a circuit diagram!
j_ace_assembly_drawing.pdf J-ACE assembly drawing and bill of materials. Includes order codes for TME, Digi-Key and Mouser.
j_ace_hw.zip Eagle 5.12 schematic and board files for J-ACE
j_ace_gerber.zip Gerber files.
j_ace_fw_v07.zip J-ACE Firmware v0.7. Includes source files and compiled binaries for both keyboard and joystick modes
The bootloader is already included in the .hex files. To enter bootloader mode, keep autofire button pressed when connecting USB cable.
How to build it
This chapter describes the steps required to build a J-ACE. It assumes you have basic electronics tools and know how to use them.
Order the parts
Order the parts which are listed in the BOM. Note that you probably don't need connector X10. To make it easier, I have gathered a TME shared cart, a Digikey shared cart and a Mouser shared cart which have all the required components except the PCB.
Order the PCB
This is easy! Just order it from this page!
Get a PIC programmer
If you don't have a PIC programmer or don't have a place/friend where it could be programmed, the cheapest option is to buy a PICkit2 or PICkit3. Also the cheap Chinese clones e.g. from eBay will usually work.
Solder the components
Assembling the PCB is very straightforward job. Component locations are marked on silkscreen, but you can also use this assembly drawing to find which part goes where. Components IC1 and RN1 need to be mounted with correct orientation. Pin 1 is marked with a dot or notch, they have to match the assembly drawing. Screw terminals need to be attached to each other before soldering.
Program the PIC
Download the latest firmware. Information on how to program the PIC, see here.
Install to your arcade stick
The most common use for J-ACE is an arcade stick or arcade cabinet. I won't go into details of construction an arcade stick, there are lots of resources available on the internet. I have drawn a wiring diagram how to connect joystick, buttons and LEDs to J-ACE, see below. This example wiring diagram has joystick, three action buttons, start button, autofire button and autofire LED. The diagram shows a separate LED, but usually you would use an illuminated arcade button for autofire button. Then LED wiring would go to LED terminals of the illuminated button. Just choose an illuminated button with 5V LED.
As you can see from diagram above, one terminal of each button microswitch and each joystick microswitch is wired to GND on J-ACE. There is one GND terminal on each side of J-ACE, you can use either one. If you use e.g. Seimitsu or Sanwa joystick which includes a cable harness, it is convenient to connect the joystick GND next to direction inputs and buttons GND to the other side. It helps keeping the wiring more organized. For button ground wiring, you can get pre-crimped daisy chained wire which makes wiring quick and easy.
The LEDs are connected between +5V and LED outputs. The LEDs 1,2 and 3 are Num Lock, Caps Lock and Scroll Lock, respectively. The LED4 is autofire LED. It indicates when autofire is active, shows autofire speed when using it, helps in configuring of the autofire. The LED outputs can sink max. 25 mA current.
How to use it
The J-ACE will be recognized either as three standard HID boot protocol keyboards or as one HID compatible game controller, depending on which firmware is loaded. It doesn't require any drivers.
When used with keyboard firmware, you can use it pretty much directly with MAME. On Retropie, you have to configure it like any keyboard on the first boot.
With joystick firmware, you usually need to select J-ACE from the emulator. You don't need to do any calibration as was required with old analog PC joysticks.
Testing the operation in keyboard mode
To test operation of J-ACE in keyboard mode, you could use a text editor, but it doesn't tell the complete truth. The best way is to use a keyboard test application. One example is Aqua's Key Test.This kind of application can show correct operation of multiple simultaneous key presses (referred to as N-key rollover or NKRO). They can also separate left and right ctrl, alt and shift keys. If you know a good keyboard test software for Linux or Mac, let me know.
Another possibility is online keyboard test, such as key-test.ru or keyboardchecker.com. They can also show simultaneous keypresses but they can't separate left and right ctrl, alt and shift.
Testing the operation in joystick mode
To test operation of J-ACE in joystick mode, you can use the tools provided by operating system.
On modern Windows versions, the joystick calibration application can't be easily found from the control panel. But it still is there, you can run it by pressing Win+R and type joy.cpl and hit enter. Or on Windows 10 just open the start menu and type joy.cpl.
On Linux systems you can use e.g. jstest command line tool.
Updating the firmware and changing between keyboard and joystick mode
The J-ACE uses a bootloader, so the PIC programmer is not required for updates. The bootloader also allows to change between keyboard and joystick mode firmware. You can enter the bootloader mode by keeping autofire button pressed down when connecting the USB cable. You can then use the update tools suggested on the my USB HID bootloader page.
Using and configuring Autofire
Many joysticks in '80s were equipped with autofire, sometimes referred to as rapidfire. It repeatedly presses fire button at high rate, which eliminates manual button mashing in shoot-em up games. It eases stress on your fingers and allows to concentrate on controlling of the character and avoiding enemy bullets.
The J-ACE has a dedicated Autofire button. It is recommended to also connect an autofire LED.
Autofire mode is activated by pressing the autofire button. The autofire LED is lit, which indicates that autofire is on. Now when you keep button pressed down, the J-ACE repeatedly presses and releases it, at a predefined rate. The autofire LED flashes at same frequency, giving a visual indication of the fire rate. Pressing the autofire button again disables autofire mode.
You can enter autofire setup mode by keeping autofire button pressed down for more than 1 second. The autofire setup mode is indicated by the autofire LED which blinks at the current firing rate. You can increase the firing rate by moving joystick up and decrease it by moving joystick down. There are five speed settings, which are: 4 cps, 8 cps, 16 cps, 31 cps and 63 cps. Cps means clicks per second. At the fastest rate, you probably can't see anymore that the autofire LED is flashing, but it seems to be constantly lit.
You can also configure which buttons have autofire enabled. When exiting autofire config mode, keep those buttons pressed down, then press the autofire button shortly. When you now press the autofire button, the autofire is activated to those buttons. All the other buttons behave normally.
Note that if you use the Aqua's Key Test or Windows joystick test app, they can't show the fastest autofire rates correctly. But the actual fire rate still is correct. You can see this if you test e.g. on Notepad how many characters you can get per second (in keyboard mode, of course).
Configuring the keyboard mode keymaps
The keyboard mode of J-ACE has four preconfigured keymaps. This allows you to connect four J-ACE based controllers simultaneously and allow four player gaming. You can change the keymap by keeping button 1 pressed down when connecting USB cable. This enters the keymap selection mode. The mode is indicated by flashing all the connected LEDs. Now you can select the desired keymap by joystick. Keep the joystick pointing at desired direction and press button 1.
- UP for player 1 keymap
- RIGHT for player 2 keymap
- DOWN for player 3 keymap
- LEFT for player 4 keymap
Currently the keymaps are fixed.
Shift function
Shift function is similar to shift in keyboard. It changes what other buttons do. J-ACE uses start button as shift. The shift function allows to build a mame controller with fewer buttons, as you don't necessarily don't have to use dedicated buttons for e.g. coin acceptor or other emulator related buttons. The shift function makes the start button behave a little differently. The normal start button keycode is sent when you release the start button, not when you press it down. If you have used the start button as shift to send some other keycodes, then the normal start button keycode is not sent at all.
The shift function is only available when J-ACE is configured to player 1 keymap. The alternative keycodes sent with shift function are showed in table above.
The joystick mode also implements the shift function. If you want to disable the shift function in joystick mode, look at keymap configuration instructions. The same configuration mode is available in joystick firmware as well. The shift is enabled when configured as player 1. The keymap configuration mode with joystick firmware doesn't have any other effect than enabling or disabling the shift function.
For more information, see the project web page. Have fun!
J-ACE Arcade Controls Encoder
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(12)
- groovy978 Sep 15,2024
- Engineer Oct 21,2023
- Engineer Feb 13,2023
- Engineer Oct 09,2022
- burhan Apr 14,2021
- Alexiev Oct 27,2020
- Juri Armillei Sep 05,2020
- Jan Pastrňák Jul 28,2020
- Steve?Sexton May 19,2020
- Ashley Sheriff May 16,2020
- Engineer May 10,2020
- (DIY) C64iSTANBUL May 07,2020
- 2 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
-
10design
-
10usability
-
10creativity
-
10content
-
10design
-
10usability
-
10creativity
-
10content
More by jaka
- PICkit2- programmer The PICkit2- programmer, PK2M for short, is yet another clone of the Microchip PICkit2 PIC programme...
- Car battery maintenance charger Maintenance chargerOn this page you find all the information needed to build a maintenance charger f...
- 12V timer relay with delay on release Delay relayA simple, solid state delayed off 'relay' for 12V and 24V systems. You could use it to co...
- Toyota Hilux Vigo interior light LED upgrade Toyota Hilux Vigo ceiling light LED modification I replaced my Hilux interior light incandescent bul...
- LED board for IL arcade buttons (outside version) IL arcade buttons LED modificationI am a fan of the IL (Industrias Lorenzo, S.A.) arcade buttons and...
- LED board for IL arcade buttons (inside version) IL arcade buttons LED modification I am a fan of the IL (Industrias Lorenzo, S.A.) arcade buttons an...
- Hardsid ISA clone Hardsid ISA cloneThis is a reincarnation of the Hardsid clone which I made almost 20 years ago. The ...
- Microchip ICD to PICkit adapter Microchip ICD to PICkit adapterThis simple adapter allows to use Microchip ICD programmers with targ...
- BJT water detector DIY water detector / leak alarmHere is simple water detector you can build yourself. It can be used ...
- J-ACE Arcade Controls Encoder Jaka Arcade Controls Encoder The J-ACE is a DIY USB keyboard encoder. It allows you to make e.g. an ...
- DIY Weller WMRT compatible handle DIY Weller WMRT compatible handleHere are desoldering tweezers that you can build yourself. They use...
- Accurate digital wall clock with GPS and remote control Kello version 4This is fourth version and maybe final version of my seven segment digital wall clock...
- Weller WMRP and WMRT compatible soldering station This driver can be used with Weller tips which have integrated heater element and temperature sensor...
- Temperature difference thermostat v2.1 Temperature difference thermostat which can be used to control heating. When the inside temperature ...
- Speed test A DIY replica of electronic speed test game, manufactured by Coinline in Finland. A similar game is ...
- JAKADAPTER - Dual Atari joystick USB adapter This adapter allows to connect two Atari style joysticks, paddles, or Sega Megadrive / Genesis gamep...
-
-
-
-
-
-
X-mas ball, Now with ANIMATED LIGHTS!
106 4 7 -
-
-
-
RC radial engine spark plug heater
29 0 0 -
-