Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: DIY keyboard encoder  (Read 77384 times)

0 Members and 1 Guest are viewing this topic.

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
DIY keyboard encoder
« on: May 20, 2012, 08:06:13 pm »
Hi,  I developed my own arcade encoder on a USB development board called Minimus.  The boards cost about £4.99 from http://www.modtraders.co.uk/minimus-avr-usb-development-board.html

I mentioned this in another thread and it seemed to generate some interest and it was suggested that I create my own thread.

I wrote the firmware to turn this board into a 21 input keyboard encoder and I have some presets for MAME (1 and 2 player).  I have this installed in my cab and it is working really really well.  I have previously used Xin-Mo for this job but this baby performs just as good.  They're all direct inputs,  no bounce or ghosting that you get with some keyboard encoders.

I put up a short video on youtube.


If anyone has any ideas for other presets then please let me know.  I already had a suggestion to add visual pinball/future pinball mappings.  Thanks to PL1 for the suggestion.
The device has eeprom storage and I am using that to store presets.  Presets can be toggled via a combination of buttons/pins

I have just added support for PS/2 devices,  although PS/2 emulation is not 100% tested and working.
I can emulate a USB game controller as well as keyboard.

My aim is to produce a multi-function arcade interface.  I am currently adapting this to provide xbox1 support for a Coinops Project.
I also build arcade cabinets and plan to use some pins to control power output to some devices.  This would have a number of uses including delayed start-up, led driver, sound output e.g. xbox1 takes about 12 seconds to start up and I don't want to show the boot animation.  I could delay power output to amp and monitor for 12 seconds and play a tune while the cabinet starts up.

Interested in peoples thoughts on this.


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9663
  • Last login:Today at 10:35:20 am
  • Designated spam hunter
Re: DIY keyboard encoder
« Reply #1 on: May 21, 2012, 03:29:33 am »
The device has eeprom storage and I am using that to store presets.  Presets can be toggled via a combination of buttons/pins

Cool.

Does this mean you can store more than one keymap and easily swap them without re-flashing?

That might solve the problem of not enough inputs to handle the huge variety of Visual Pinball and Future Pinball tables. (some have a second set of flipper buttons, some have L+R magnasave buttons, etc.)  It could also prevent the rise of the FrankenPin!   >:D   *Screams of terror*


Scott

P.S. -- For those of us on this side of the pond -- In the other thread, 404 mentioned that he still had some v1 boards available. You can also find the boards here and here -- minus the most important part, the firmware.
« Last Edit: May 21, 2012, 03:55:17 am by PL1 »

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #2 on: May 21, 2012, 04:27:50 am »
Yes,  I can store loads of key mappings if necessary.

Activate PIN1, PIN2 and PIN21 together to toggle the mappings.  I suppose I could use a dedicated pin to do the toggle but this would reduce number of inputs to 20.  What do you think?
I am open to suggestions on how we manage the key mappings.

When mapping is changed I echo some text as keyboard input.  e.g. for MAME you would see "==MAME1P==" if you had notepad open.




degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #3 on: May 21, 2012, 04:47:47 am »
Some info on the mappings I have currently.


1. Pin Diagram
    
             USB
           +-----+
           |     |
           |     |
        +--+     +--+
     11 |o         o| N/A (VCC)
     10 |o         o| 12
      9 |o         o| 13
      8 |o         o| N/A (Reset)
      7 |o         o| 14
      6 |o         o| 15
      5 |o         o| 16
      4 |o         o| 17
      3 |o         o| 18
      2 |o         o| 19
      1 |o         o| 20
    GND |o         o| 21
        +-----------+


2. Mapping Presets

a) MAME1P
   1 Player MAME mappings with up to 8 buttons and special buttons.    

   ----+--------------+---------------
   Pin | Description  | Key
   ----+--------------+---------------
     1 | P1 Coin      | 5    
     2 | P1 Start     | 1
     3 | P1 Right     | <Right Arrow>
     4 | P1 Left      | <Left Arrow>
     5 | P1 Up        | <Up Arrow>
     6 | P1 Down      | <Down Arrow>
     7 | P1 Button 1  | <L-Ctrl>
     8 | P1 Button 2  | <L-Alt>
     9 | P1 Button 3  | <Space>
    10 | P1 Button 4  | <L-Shift>
    11 | P1 Button 5  | Z
    12 | P1 Button 6  | X
    13 | P1 Button 7  | C
    14 | P1 Button 8  | V
    15 | Cancel       | <Esc>
    16 | Select       | <Enter>
    17 | Config       | <Tab>
    18 | Pause        | P
    19 | Load / Save  | <F7>
    20 | OSD          | <Tilde>
    21 | Screenshot   | <F12>
   ----+--------------+---------------

b) MAME2P
   2 Player MAME with up to 3 buttons per player.    

   ----+--------------+---------------
   Pin | Description  | Key
   ----+--------------+---------------
     1 | P1 Coin      | 5    
     2 | P1 Start     | 1
     3 | P1 Right     | <Right Arrow>
     4 | P1 Left      | <Left Arrow>
     5 | P1 Up        | <Up Arrow>
     6 | P1 Down      | <Down Arrow>
     7 | P1 Button 1  | <L-Ctrl>
     8 | P1 Button 2  | <L-Alt>
     9 | P1 Button 3  | <Space>
    10 | P2 Coin      | 6
    11 | P2 Start     | 2
    12 | P2 Right     | G
    13 | P2 Left      | D
    14 | P2 Up        | R
    15 | P2 Down      | F
    16 | P2 Button 1  | A
    17 | P2 Button 2  | S
    18 | P2 Button 3  | Q
    19 | Cancel       | <Esc>
    20 | Select       | <Enter>
    21 | Pause        | P
   ----+--------------+---------------

c) GENERIC
   Generic mappings for compatibility with all emulators - that allow redefine keys.
   All alphabetic, except PIN 21 which is the ESCAPE key.  This is typically used as back or exit.
  
   ----+-----
   Pin | Key
   ----+-----
     1 | A
     2 | B
     3 | C
     4 | D
     5 | E
     6 | F
     7 | G
     8 | H
     9 | I
    10 | J
    11 | K
    12 | L
    13 | M
    14 | N
    15 | O
    16 | P
    17 | Q
    18 | R
    19 | S
    20 | T
    21 | <Esc>


...and I will be adding pinball as suggested by PL1.
« Last Edit: May 21, 2012, 04:49:44 am by degenatrons »

eldiau

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 39
  • Last login:June 12, 2023, 06:01:40 pm
Re: DIY keyboard encoder
« Reply #4 on: May 21, 2012, 06:44:56 am »
Very nice!  :applaud:
It would be great to have shifted keys too! As you implemented a sort of shift behavior to change the pin mapping I imagine it should be possible to do something like P1+Up=Esc mapping right?

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9663
  • Last login:Today at 10:35:20 am
  • Designated spam hunter
Re: DIY keyboard encoder
« Reply #5 on: May 21, 2012, 07:05:15 am »
Activate PIN1, PIN2 and PIN21 together to toggle the mappings.  I suppose I could use a dedicated pin to do the toggle but this would reduce number of inputs to 20.  What do you think?

Wouldn't a simultaneous 3-button press like using ctrl-alt-del to reboot work?

It will be easier if at least 2 buttons are always going to be next to each other like Player 1 Buttons 1 + 2 for MAME or Left Flipper and Left Upper Flipper for Pinball.

The only 1 button press method I can think of is to find a 3 Pole Single Throw (3PST) or Double Throw (3PDT) switch. Switch descriptions explained here. Not an easy thing to find or cheap. This is the cheapest I could find. :(

3PST switch with all 3 outputs tied to ground. All inputs are separate until the switch is closed, then all 3 are grounded.

1------/ ----|
.                  |-----Ground
2------/ ----|
.                  |
3------/ ----|

This circuit on the 3PDT switch pictured below would ignore the 3 on the left, connect 1, 2, and 3 to the far, center, and near pivot points respectively and connect all 3 on the right to ground.

To make it a physical 2-button push, you could use a dedicated DPST or DPDT (cheap + easy to find) wired in parallel with buttons 1 + 2 to "press" buttons 1+2  while you also press button 3 at the same time like this:

1------/ ----|
.                  |-----Ground
2------/ ----|    |
.                       |
3------/ --------|


Scott
« Last Edit: May 21, 2012, 07:31:08 am by PL1 »

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #6 on: May 21, 2012, 07:52:01 am »
I am talking about a simultaneous button press,  like ctrl-alt-del.  I currently set this to pin1, pin2 and pin21.  I might change pin 21 to make it <ESC> so combo would be along these lines for MAME:

P1 start + P1 coin + <ESC>

I like the idea of a shifted key to access special config actions as suggested by eldiau.  I could make pin 21 the shifted key and this would be used in combination with other buttons to toggle the config (maybe up/down).  It could also be used to map to less used mappings for MAME or Pinball,  such as load/save,  and effectively allow for at least a further 15 mappings.

Good ideas guys.

404

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1019
  • Last login:August 04, 2015, 10:19:10 pm
Re: DIY keyboard encoder
« Reply #7 on: May 21, 2012, 09:19:34 am »
This is a great project degenatrons!

Tried it and it works great. I don't however, have a control panel or portable arcade stick to put this on to. Don't have an arcade at the moment either. :(

May I ask why you chose a keyboard encoder style over making a standard hid joystick instead?

For those that prefer a static picture of the minimus to mame pinout for 1 player, i have attached a pic based on the original picture by Bob Clough from http://thinkl33t.co.uk

I do have a few of these that i would let go for a cheap price for anyone that is having a hard time finding them in the states online. For any developers in the United States, I have only about a few AVR's left but I will offer up one free minimus to developers interested in making or contributing to the minimus project.
« Last Edit: May 21, 2012, 07:42:28 pm by 404 »

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9663
  • Last login:Today at 10:35:20 am
  • Designated spam hunter
Re: DIY keyboard encoder
« Reply #8 on: May 21, 2012, 09:31:47 am »
Browsers like Firefox allow you to jump to specific tabs by pressing ctrl + number of the tab.

Would something like this work?

1+2+21 = MAME
1+3+21 = Pinball
1+4+21 = Game console

or

1+2+21 = MAME
2+3+21 = Pinball
3+4+21 = Game console


Also I think you mentioned earlier that the program outputs the name of the map as a series of keypresses that would show up if Notepad was open when you switch maps. 

Depending on what you're doing at the time, might this cause problems like jumping around the front end program?

Would using beeps or LED flashes instead be less troublesome? -- 1 beep/flash for map #1, etc

If you can call specific maps by number, you may not even need to have any confirmation output, since the keypresses sent by the map will be obviously wrong if it doesn't switch to the right map.


Scott

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #9 on: May 21, 2012, 10:05:19 am »
404 - It would be trivial for me to adapt this to work as a standard HID joystick.  I took the keyboard encoder approach for default compatibility with MAME and also to use as the basis for another project I have in mind. 
I suppose I could add a toggle to switch from keyboard encoder to HID joystick encoder.   Do you think this would be a useful feature?
Man I just love these boards.  They're super easy to work with.

PL1 - I think we could simplify your suggested mapping if 21 is dedicated shift key.

1+21 = MAME 1 Player
2+21 = MAME 2 Players
3+21 = Pinball
4+21 = HID Joystick 1 Player* 
5+21 = HID Joystick 2 Players*
etc...

*Note: Switching modes from USB keyboard to USB joystick would require device to be unplugged and replugged first time.


I have been using the keyboard echo for debugging and thought it could be useful feature,  but now i am inclined to agree that it could be annoying to have keys sent to front end. 
The minimus has an LED so this could flash to confirm toggle and then have a series of additional flashes to inform you of mode setting.  Cool.

It is good to bounce these ideas around and get input.  It is much appreciated guys.

Cheers


degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #10 on: May 21, 2012, 10:13:39 am »
Actually,  come to think of it,  there is a hardware button on the minimus which could be used for toggle.  This is linked to one of the pins.

Simple solution would be to just press this HWB to toggle through presets.  This pin could also be wired to an arcade button. 
We could still provide for key combinations with this approach.



PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9663
  • Last login:Today at 10:35:20 am
  • Designated spam hunter
Re: DIY keyboard encoder
« Reply #11 on: May 21, 2012, 10:37:46 am »
Simple solution would be to just press this HWB to toggle through presets.  This pin could also be wired to an arcade button. 
We could still provide for key combinations with this approach.

So using the browser tab analogy from earlier:

HWB = ctrl + tab = next tab to the right (next map) - relative shift

HWB + 1 = ctrl +1 = first tab from left (first map) - absolute shift

HWB + 2 = ctrl + 2 = second tab from left (second map) - absolute shift


Scott

404

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1019
  • Last login:August 04, 2015, 10:19:10 pm
Re: DIY keyboard encoder
« Reply #12 on: May 21, 2012, 10:54:39 am »
404 - It would be trivial for me to adapt this to work as a standard HID joystick.  I took the keyboard encoder approach for default compatibility with MAME and also to use as the basis for another project I have in mind. 
I suppose I could add a toggle to switch from keyboard encoder to HID joystick encoder.   Do you think this would be a useful feature?
Man I just love these boards.  They're super easy to work with.


Was just curious that's all. It was not and will never be intended to be a knock on your project. I've been waiting for this for a long time now actually. HID could have been used for other devices as well such as the ps3. Your project is specifically aimed at Mame and it does the job that it was intended to do 100%.

There is an HID project already specifically for mame use but unfortunately, i have been unable to compile the code properly. The author, Jamie Lentin uses the Minimus32 for this project.
http://jamie.lentin.co.uk/embedded/arcade-joystick/

Benjamin Blundell also has a sega genesis/megadrive to minimus project below. However, it doesn't seem as if he is too interested in releasing his source and schematics. :(
http://blog.section9.co.uk/2012/04/04/Minimus-and-Sega.html

Mega Emu's project also uses the same AT90USB162 that is available in the minimus.
http://forum.arcadecontrols.com/index.php?topic=120305.0

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9663
  • Last login:Today at 10:35:20 am
  • Designated spam hunter
Re: DIY keyboard encoder
« Reply #13 on: May 21, 2012, 10:58:26 am »
*fap*

 :dunno
I think you're shifting the wrong tab there, PBJ.

404

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1019
  • Last login:August 04, 2015, 10:19:10 pm
Re: DIY keyboard encoder
« Reply #14 on: May 21, 2012, 11:04:53 am »
Heh.  Are you going to post your firmware for this thing?  I'm glad to see a lot more options coming out for encoders lately - the parts vendors have been raping us for years.

the download link is in the description of the youtube video
www.mediafire.com/download.php?uip37zg8opnjxct

Funny thing is, most of the part vendors are quite literally selling customers an AVR all of these years. Most of which are based on this exact or very similar hardware.

JayB

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 160
  • Last login:January 25, 2013, 06:11:59 pm
Re: DIY keyboard encoder
« Reply #15 on: May 21, 2012, 11:48:56 am »
 :applaud:

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #16 on: May 21, 2012, 12:35:31 pm »
Thanks for the feedback guys,  I will make some tweaks and push out some updated firmware. 

I think that is a good way to move forward.  If you guys can contribute and I can make changes to code and update the firmware.

404 - I spoke with Jamie Lentin a while ago about his HID joystick and he was really helpful in getting me started with the USB libraries and other points of reference.  It is also a big learning curve and I am still learning new things and developing ideas.

Is there any point in producing other MAME defaults?.  I think what I have would work for a 4 player setup using 2 AVR's.  In the MAME config I can simply set multiple keyboards.  Maybe I just need to put some instructions together to make this obvious.

I was looking at support for xbox1,  this is not working yet,  but it made me think about system specific mappings.  For e.g. the xbox frontend (coinops) uses combo of "back" and "start" button to exit the game and "back", "start", "left trigger", "right trigger" to exit to dashboard.  I was able to map these actions to a single pin for convenience. 
I expect to find similar nuances on other systems.

If we have some spare pins then media controls could also be an option.  Volume up/down is a good one for cab users.

Thanks

404

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1019
  • Last login:August 04, 2015, 10:19:10 pm
Re: DIY keyboard encoder
« Reply #17 on: May 21, 2012, 02:03:23 pm »
404 - I spoke with Jamie Lentin a while ago about his HID joystick and he was really helpful in getting me started with the USB libraries and other points of reference.  It is also a big learning curve and I am still learning new things and developing ideas.

I spoke to him as well. He even gave me the compiled hex for his HID joystick but it simply would crash when attempting to hit a button. Tried compiling and couldn't get it to work either. :(

It's entirely possible that i may have screwed up and didn't notice some minimus32 specific changes he made to the code.


Is there any point in producing other MAME defaults?.  I think what I have would work for a 4 player setup using 2 AVR's.  In the MAME config I can simply set multiple keyboards.  Maybe I just need to put some instructions together to make this obvious.

Not that i know of. Anything beyond that should be configured with a REAL keyboard. That's just my opinion though.

I was looking at support for xbox1,  this is not working yet,  but it made me think about system specific mappings.  For e.g. the xbox frontend (coinops) uses combo of "back" and "start" button to exit the game and "back", "start", "left trigger", "right trigger" to exit to dashboard.  I was able to map these actions to a single pin for convenience. 
I expect to find similar nuances on other systems.

Native xbox support is going to be a serious undertaking IMO. I would suggest first looking at the control pad libraries in the OpenXDK. Actually, that's probably about the only source for native xbox pad info legally available on the net.


degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #18 on: May 21, 2012, 02:12:04 pm »
Oh, and I know I'm always griping about feature creep but how about turning one of these into an encoder for a trackball that will work with an Xbox?  I can't get a single old PS/2 mouse to work, so I'm up a creek with hacking one of those.  I've had luck with newer optical mice but those aren't good for trackballs.
Hey,  for xbox,  I have done that very thing.  I have a working prototype using that supports controller, mouse/trackball and keyboard via PS/2 ports.  I had to bolt-on a PCB from a "smartjoy frag" which was used for playing keyboard in FPS games on xbox.  You can get those smartjoys really cheap now.
Some more info and pics on my thread for this on CoinOps forums at http://coinopsproject.freeforums.org/viewtopic.php?f=14&t=761
Still need to do some work on this as xbox does not always acknowledge the device as a keyboard and have to plug/unplug a few times.
I am working on a version which uses some other parts.

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #19 on: May 21, 2012, 03:40:58 pm »
My god, you weren't kidding on the Smartjoy's being cheap.  Some guy on E-bay is selling them $6/each or $20 shipped for 10 of them.   :o  I've got one coming in the mail, should be fun to play with for $6. 
Yep,  I paid about £1 each for mine.  Almost a giveaway.

Mine did not come with instructions,  but I managed to glean all the information I needed from a review at http://hardware.teamxbox.com/articles/xbox/954/SmartJoy-FRAG-Review/p1/

To work with these,  I get my AVR to talk PS/2 and connect it to the PS/2 port.  I have to sacrifice 2 pins (clock and data) put that still leaves 19 inputs and is a lot simpler and more reliable than a hacked pad.
The Miniumus AVR is not that great at PS/2 emulation, I had issues with interrupts, so I am going to make another prototype interface using a keyboard encoder chip.  These are unbelievably cheap too.  http://uk.farnell.com/holtek/ht82k628a-40diplf/ic-win-2000-kb-ps2-cont-dip40/dp/1420878?Ntt=holtek+ps/2

Have fun with your smartjoys!

meltman

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 237
  • Last login:April 02, 2025, 11:06:11 am
  • Brilliant!
    • forum.arcadecontrols.com/index.php/topic,158544.0.html
    • My arcade gallery
Re: DIY keyboard encoder
« Reply #20 on: May 22, 2012, 02:45:59 pm »
This would be really great as a standard HID Joystick. 4 pins for axis, the rest for buttons. The only reason I'd like this is because some non-mame games want joystick input instead of keyboard. I guess having the hardware button switch the function would be cool if it saves the state it's in without power.

Anyone know of a supplier in the US for these things?

Nice work by the way. I was looking at this same thing and thinking of trying to turn it into a cheap encoder.
« Last Edit: May 22, 2012, 02:49:10 pm by meltman »

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9663
  • Last login:Today at 10:35:20 am
  • Designated spam hunter
Re: DIY keyboard encoder
« Reply #21 on: May 22, 2012, 02:56:09 pm »
Anyone know of a supplier in the US for these things?

404 mentioned that he still had some v1 boards available. You can also find the boards here and here.


Scott

404

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1019
  • Last login:August 04, 2015, 10:19:10 pm
Re: DIY keyboard encoder
« Reply #22 on: May 22, 2012, 02:58:10 pm »
This would be really great as a standard HID Joystick. 4 pins for axis, the rest for buttons. The only reason I'd like this is because some non-mame games want joystick input instead of keyboard. I guess having the hardware button switch the function would be cool if it saves the state it's in without power.

Agreed. I'm not taking anything away from Degeneatrons work here but there are more and more "arcade-like" games that don't like keyboards at all. If you have enough skills, look at the link i provided from Jamie Lentin's minimus32 work. Maybe you can get something going there.


Anyone know of a supplier in the US for these things?

check some modchip shops online. If not, i have a few i can spare for a fair price.

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #23 on: May 22, 2012, 04:16:08 pm »
This would be really great as a standard HID Joystick. 4 pins for axis, the rest for buttons. The only reason I'd like this is because some non-mame games want joystick input instead of keyboard. I guess having the hardware button switch the function would be cool if it saves the state it's in without power.

Agreed. I'm not taking anything away from Degeneatrons work here but there are more and more "arcade-like" games that don't like keyboards at all. If you have enough skills, look at the link i provided from Jamie Lentin's minimus32 work. Maybe you can get something going there.


Anyone know of a supplier in the US for these things?

check some modchip shops online. If not, i have a few i can spare for a fair price.


Hey,  I think I could add the USD HID Joystick emulation as another mode.  This way the device works both ways and you use it the way you want to.

I see a benefit now in making this both a USB joystick and USB keyboard encoder.

Cheers


degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #24 on: May 24, 2012, 09:02:24 am »
I added screw terminals the minimus AVR.  This will make it super easy to connect to arcade controls.  

These are really small,  specialist screw terminals with 0.1" pitch.  

This baby looks more like a keyboard encoder now.  

I am in the process of updating the firmware with other mappings as per suggestions on this thread.
Thanks to PL1 for his suggestion to maintain the reference to key mappings in Google Docs Spreadsheet.  I am currently putting something together and will update you guys when it is available.

Cheers





rablack97

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2215
  • Last login:August 09, 2024, 08:49:57 pm
  • If you don't try, you have no chance at innovation
Re: DIY keyboard encoder
« Reply #25 on: May 24, 2012, 10:57:43 am »
Man that looks good, great work.

404

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1019
  • Last login:August 04, 2015, 10:19:10 pm
Re: DIY keyboard encoder
« Reply #26 on: May 24, 2012, 06:00:28 pm »
I added screw terminals the minimus AVR.  This will make it super easy to connect to arcade controls.  

These are really small,  specialist screw terminals with 0.1" pitch.  

This baby looks more like a keyboard encoder now.  

I am in the process of updating the firmware with other mappings as per suggestions on this thread.
Thanks to PL1 for his suggestion to maintain the reference to key mappings in Google Docs Spreadsheet.  I am currently putting something together and will update you guys when it is available.

Cheers


where did you get those? been looking for a set like that for some time now.

rablack97

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2215
  • Last login:August 09, 2024, 08:49:57 pm
  • If you don't try, you have no chance at innovation
Re: DIY keyboard encoder
« Reply #27 on: May 24, 2012, 06:38:46 pm »
I think these are it....found fairly easily.

Screw Terminals

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #28 on: May 24, 2012, 08:10:14 pm »
where did you get those? been looking for a set like that for some time now.

From China,  via an ebay seller,  ordered about 40 days ago.  Search for "0.1 terminal blocks".

johnm

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 130
  • Last login:May 28, 2025, 11:40:55 am
Re: DIY keyboard encoder
« Reply #29 on: May 24, 2012, 08:14:59 pm »
I think these are it....found fairly easily.

Screw Terminals

Those are 5mm pitch, PCB's are generally 2.54mm so one screw terminal would take up 2 points.

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #30 on: May 24, 2012, 08:25:33 pm »
I used 0.1"(2.54mm) pitch, 12 way terminals

They're super small.  Will need a tiny screwdriver.

rablack97

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2215
  • Last login:August 09, 2024, 08:49:57 pm
  • If you don't try, you have no chance at innovation
Re: DIY keyboard encoder
« Reply #31 on: May 24, 2012, 08:26:51 pm »
I think these are it....found fairly easily.

Screw Terminals

Those are 5mm pitch, PCB's are generally 2.54mm so one screw terminal would take up 2 points.

Hence the word think...was worth a shot

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #32 on: May 25, 2012, 06:59:27 pm »
I made some changes to the AVR as per discussions on this thread.  Thanks to everyone for their input.  :)

1. For simplicity,  I set the hardware button (HWB) as the mapping toggle.  It is really simple to toggle modes now.  You can click the HWB switch on the AVR or you can wire an arcade button to the HWB pin.  No key combinations necessary.
2. The LED's (red and blue) flash a number of times to indicate the active mode after a toggle e.g. 4 flashes for Pinball key mappings.  I removed the nasty keyboard echo.
3. I added a key mapping preset for visual pinball/future pinball.
4. Number of pins available as inputs is now 20,  plus the dedicated HWB pin.

The revised pinout is as follows:

Code: [Select]
                   USB
                  +-----+
                  |     |
                  |     |
               +--+     +--+
            10 |o         o| N/A (VCC)
             9 |o         o| 11
             8 |o         o| 12
             7 |o         o| N/A (Reset)
             6 |o         o| 13
             5 |o         o| 14
             4 |o         o| 15
             3 |o         o| 16
  (HWB) Toggle |o         o| 17
             2 |o         o| 18
             1 |o         o| 19
           GND |o         o| 20
               +-----------+

PINBALL mapping is at preset number 4 (after MAME1P, MAME2P and GENERIC).   Thanks to PL1 for the mapping info for Visual Pinball / Future Pinball.
Mappings are as follows.

Code: [Select]
  ----+----------------+---------------
   Pin | Description    | Key
   ----+----------------+---------------
     1 | Coin           | 5
     2 | Start          | 1
     3 | Right          | <Right Arrow>
     4 | Left           | <Left Arrow>
     5 | Up             | <Up Arrow>
     6 | Down           | <Down Arrow>
     7 | Plunger        | <Enter>
     8 | L/Flipper      | <Left Shift>        
     9 | R/Flipper      | <Right Shift>
    10 | L/Up/Flipper   | A        
    11 | R/Up/Flipper   | <Quote>  
    12 | L/Nudge        | Z
    13 | R/Nudge        | /  
    14 | Fwd/Nudge      | <Space>
    15 | L/Magnasave    | <Left-Ctrl>  
    16 | R/Magnasave    | <Right-Ctrl>  
    17 | Test           | T
    18 | Pause          | <Pause/Break>
    19 | View Backglass | <Tab>
    20 | Exit           | <Esc>
   ----+----------------+---------------

I created a site to manage the project source, documentation, pinout details etc.  I will post details for this over the weekend.

Anyone have suggestions for other mappings?

This is coming along really nicely now,  and AVR is super easy to connect to controls with those screw terminals added.

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #33 on: May 25, 2012, 08:35:05 pm »
Updated firmware, instructions and key mapping sheet is now available on my projects site at...

https://sites.google.com/site/degenatrons/controller-interfaces/usb-keyboard-encoder/resources-for-usb-keyboard-encoder

I tested the firmware briefly but I am really too tired to do this thoroughly.  It would be great if someone could take a look and verify that everything is good.  Otherwise,  I will take a look tomorrow.

Thanks

404

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1019
  • Last login:August 04, 2015, 10:19:10 pm
Re: DIY keyboard encoder
« Reply #34 on: May 25, 2012, 08:54:20 pm »
Updated firmware, instructions and key mapping sheet is now available on my projects site at...

https://sites.google.com/site/degenatrons/controller-interfaces/usb-keyboard-encoder/resources-for-usb-keyboard-encoder

I tested the firmware briefly but I am really too tired to do this thoroughly.  It would be great if someone could take a look and verify that everything is good.  Otherwise,  I will take a look tomorrow.

Thanks

As i mentioned earlier, I don't have a control stick to fully test this with. I did however, program the minimus i have laying on my desk and used a small piece of wire to short the pins together. Everything so far seems to work exactly as described. :)

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9663
  • Last login:Today at 10:35:20 am
  • Designated spam hunter
Re: DIY keyboard encoder
« Reply #35 on: May 25, 2012, 09:08:12 pm »
Looks great.

My only concerns at this stage are: 1. compatibility across maps, and 2. logical progression.  

1. If common keys like arrows, enter key, and escape are on different pins for different maps, it defeats the purpose of switchable maps, because you'll have to rewire when you switch.


2. If you look at the order of inputs on an I-Pac, Mini-Pac, or Key-Wiz, you'll notice a pattern of logical progression to the inputs. This will become more important once people solder on the screw terminals you found since it appears it will be harder to read the markings on the board.  

One way you might do that is if "HWB" was moved to "20" and "reset" was moved to "10". the logical look of the layout would change quite a bit.  Not sure if it is possible, or if these switches are hardwired to those points. The resulting layout would look more like the familiar I-Pac/Key-Wiz patterns, and be easier for people to accept and follow.

Four fixed functions on the corners, inputs 1-10 on one side, 11-20 on the other.
vs
Gnd, 1, 2, 2a(HWB), 3, 4,. . .

Better to figure out the logical progression now before you hear the  :angry: calls to remap the board while others complain that they already wired it for the original map.

. . .Why, yes, I have been accused of thinking too much before.  How did you know??? . . .  :laugh2:


Scott

P.S.  One minor fix on the pinball input.  I apologize if the error or misunderstanding is mine.
11 | R/Up/Flipper   | <Quote> should be an apostrophe/single quote ( ' ) instead of a double quotation mark ( " )
« Last Edit: May 25, 2012, 09:20:35 pm by PL1 »

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #36 on: May 26, 2012, 10:17:16 am »
It's good to get confirmation that the update works - even if it was just a basic test.  Thanks 404.

Some good points from PL1.

1.  I will try to align the maps better so that common keys have the same pin assignments across the maps.  This seems like a common sense approach and is a good idea. 

2. I get your point re: the logical progression.  There is an issue though.  The HWB and Reset (and LED's) are linked to dedicated pins.  There may be a way to fix this in software and I will take a look at that.  I already fixed the LED's in software so pins do not send keys when I flash on toggle,  but this was by temporary deactivation of input i.e. not by reassignment.

It was my mistake to use the quote in the pinball mapping.  I will change that to use an apostrophe.

I will take a look at 2 first,  if I can reassign those awkward pins then we should be able to produce a more logical pinout.



404

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1019
  • Last login:August 04, 2015, 10:19:10 pm
Re: DIY keyboard encoder
« Reply #37 on: May 26, 2012, 01:45:11 pm »
It's good to get confirmation that the update works - even if it was just a basic test.  Thanks 404.

sorry i can't be of more help at the moment. I've only been playing with mame for a short time and just have it hooked up to my tv with a spare pc and a gamepad right now. When i can get something better, I'll be sure to help contribute to this project a little more.

404

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1019
  • Last login:August 04, 2015, 10:19:10 pm
Re: DIY keyboard encoder
« Reply #38 on: May 27, 2012, 04:07:54 pm »
out of sheer boredom i put a minimus inside of a nes advantage stick i had laying around. The 2p toggle no longer worked (been so long, i have no idea if any part of the stick works any more). Everything works except for the turbo and slow-mo functions.

degenatrons

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 364
  • Last login:March 29, 2016, 05:53:23 pm
    • KADE
Re: DIY keyboard encoder
« Reply #39 on: May 27, 2012, 05:22:03 pm »
out of sheer boredom i put a minimus inside of a nes advantage stick i had laying around. The 2p toggle no longer worked (been so long, i have no idea if any part of the stick works any more). Everything works except for the turbo and slow-mo functions.
Awesome!  I love NES.  Anything i can do to help make them functions work?