wiki:starkadroid

Version 8 (modified by pulkomandy, 12 years ago) ( diff )

--

The Starkadroid is a project I made for building a mamecab. A mamecab is a fake arcade cabinet powered with a PC, and from wich you can play many games.

We had some buttons, a PC, and nothing to put in between. The usual solution is to dismantle a PC gamepad or keyboard and solder the arcade buttons on it. But we had two problems with that :

  • The mamecab we are building will be used in real world situation with people hitting it violently when they game over. we don't want a wire to break and the whole thing to stop working every two weeks. So soldering on a PCB not made for it is not good.
  • There are better uses for gamepads than dismantling them.

Anyway, the device exposes itself as a single gamepad with 2 axis and 36 buttons. Not all of them are used, and maybe the report will change a bit in the future. But I was too lazy to do it properly for now.

Hardware

the base board is the vusbdev.

The device expects the buttons to be connected in a matrix, that is, each button is at the intersection of two different wires. It's a good idea to put a diode in series with each button to avoid interferences. So it should look like this :

(where O is a button and |>|is a diode)

wire 1 -----O---|>wire 7 wire 2 -----O---|>wire 7

...

wire 6 -----O---|>wire 7
wire 1 -----O---|>wire 8 wire 2 -----O---|>wire 8

...

...

wire 6 -----O---|>wire 12

This way you can have up to 36 buttons plugged in.

I wired the diodes on a piece of protoboard.

Wires 1 to 6 are port B, 7 to 12 are port C.

This wiring scheme require your buttons to have two free wires. If this is not the case, for example if your control panel has a single ground connected to all buttons and only one wire for each of them, you can still get it working with some TTL logic.

A 74LS244 buffer can be used as follow :

  • plug VCC to +5V and GND to GND
  • plug your buttons to A (input) pins
  • plug a wire in the 7..12 range to the 1G and 2G pins
  • plug wires from the 1..6 range to Y (output) pins matching the A you used.

This does not conflict with the diode system above and if needed, you can mix both on the same card. For example, we use diodes for the buttons, but a buffer for the coin mechanism.

Software

Source code

The bootloader is the same as for ak2usb. See there for infos.

The software is really straight forward. It scans all the lines on PORTB and reads the result in PORTC for each of them. All of this is put in an HID report descriptor that's then sent to the computer. And then it loops and starts again.

Upgrade

Here are instructions on how to upgrade the firmware :

  • You need a PC with windows or linux, or another OS that can run avrdude.
  • You need AVRDude ( http://savannah.nongnu.org/projects/avrdude ) or another software that can handle 'usbasp' programming (extreme burner is another example)
  • You need the latest firmware .hex file

Now how to actually do it :

  • Unplug the VUSBDev from the computer
  • Set the leftmost dipswitch to ON to enter firmware upgrade mode.
  • Plug in the adapter again. It should be detected as 'usb asp', not 'starkadroid' or anything else.
  • Run the firmware upgrade command :
    avrdude -c usbasp -p atmega8 -Uflash:w:starkadroid.hex
    
  • Wait for it to finish. It is not too long.
  • Close the dipswitch again. The adapter enters application mode immediately.
  • The computer may not detect it, so you may need to unplug & replug the VUSBDev once more.

And you're done!

Future plans

  • It is possible to have even more inputs by using some demultiplexers on the output side of the matrix. With 6 bits one can have 64 lines of 6 buttons each, for a total of 384 buttons ! However, the scanning is going to take more time, and I'm not sure it's possible to make an usb hid report that big (48 bytes).
  • Allowing a QEI input would be nice (for a spinner).
Note: See TracWiki for help on using the wiki.