VOTE NOW!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Design 1/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Usability 2/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Creativity 3/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Content 4/4

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!

Bill of materials used in this project

RESISTOR ARRAY 9X 4k7 SIP-10
1
CERAMIC CAPACITOR 10nF X7R RADIAL 5mm PITCH
1
CERAMIC CAPACITOR 470 nF X7R RADIAL 5MM PITCH
2
MICROCONTROLLER PIC18F24K50-I/SP
1
SCREW TERMINAL 3-POS 3.5MM PITCH
8
USB-B CONNECTOR
1
5-POS PIN HEADER FOR PROGRAMMING
1
May 03,2020
956 viewsReport item
  • Comments(0)
  • Likes(6)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
    View More
    VOTING 2 votes
    • Engineer from
      • 10
        design
      • 10
        usability
      • 10
        creativity
      • 10
        content
      10.00
    • PCBWay Support from CHINA, PEOPLES REPUBLIC
      PCBWay Online Support Team
      • 10
        design
      • 10
        usability
      • 10
        creativity
      • 10
        content
      10.00