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 --- Bug Reports --- Site News

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

  

Author Topic: Control Wiring Help.  (Read 508 times)

0 Members and 1 Guest are viewing this topic.

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Control Wiring Help.
« on: February 17, 2020, 03:46:12 pm »
I have a project to wire up controls for c64 and amiga using an arcade stick and buttons.  the basic idea is have the joystick with the directions and have 9 butons in 3 rows of 3.  the middle button is fire and the outer buttons are fire plus a direction.  in the case of diagonals those are fire plus two directions.  So from general searching I know I need diodes to accomplish this, but I couldn't find anyone trying to do what I'm describing here.  I'm not sure where all to put the diodes and what direction to put them.  I can try wiring up just one extra button and experimenting until it works I suppose, but if anyone has done something like this and can help I would appreciate it.

The basic idea here is a lot of commodore and amiga games put functions on each direction plus fire and it can be difficult to consistently execute those functions.  Having each one on a button should make a lot of games easier to play.  some examples are yie ar kung fu which has different things on each direction alone and has something different on each direction plus a button.  that is a lot of things, experimenting I did figure out most of the moves are worthless and won't hit opponents though.  Another example where it should be good is ninja on c64.  that game has useful functions on fire plus the directions.  I haven't played it yet, but moonstone on amiga looks like a great game for a controller setup this way too.  I'll follow up here once I've figured this out and tested with some games, in case anyone is interested how it worked out.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7621
  • Last login:Today at 04:15:36 pm
  • Designated spam hunter
Re: Control Wiring Help.
« Reply #1 on: February 17, 2020, 07:20:27 pm »
the basic idea is have the joystick with the directions and have 9 butons in 3 rows of 3.  the middle button is fire and the outer buttons are fire plus a direction.  in the case of diagonals those are fire plus two directions.  So from general searching I know I need diodes to accomplish this, but I couldn't find anyone trying to do what I'm describing here.  I'm not sure where all to put the diodes and what direction to put them.
Here's a diagram that shows the correct orientation for the diodes -- cathode toward the multi-input switch.

Wire the joystick like "Button X" (right in this example) and "Button Y" (up in this example) switches.

Wire the fire button like the "Shazaaam!" switch.

Wire the "Right+Fire" button with two diodes like the "Shazaaam!+X" switch. (right upper)

Wire the "Up+Fire" button with two diodes like the "Shazaaam!+Y" switch. (right center)

Wire the diagonal "Right+Up+Fire" button with three diodes per switch -- pink (right), purple (up), and blue. (fire)

You'll need a total of 20 diodes.
- 8 for up/down/left/right.
- 12 for diagonals.

Perfboard, a breadboard, or a euro-style terminal strip may come in handy for making this many connections and keeping them from shifting around and/or shorting against each other.

Heat-shrink tubing and color-coded wiring are your friends.

Use a standard daisy-chained ground for all microswitches.




Scott
EDIT: Somewhat related diodes-on-perfboard pictures here.
For your application, connect the anodes to a partially insulated wire like this then connect that wire to the related encoder input.



It's like the blue wire in the diagram above, but you'll have three diodes for the up input wire, three diodes for the right input wire, three diodes for the down input wire, three diodes for the left input wire, and eight diodes for the fire input wire.
« Last Edit: February 17, 2020, 08:22:44 pm by PL1 »

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #2 on: February 18, 2020, 11:07:49 am »
Thank you for your help!  Iím thinking Iíll use a terminal block to make it easier to keep organized.  I bought a bag of 100 diodes so I think I have everything I need.  Hopefully I have some time tonight.  My first goal is to just get one of these combined buttons functioning so I can test and make sure it does what I expect in a few games.  Iíll also follow up and post some pictures of the final controller.  I might get fancy and design an overlay and get it printed.  Fun stuff.

Oh, last thing is there a particular diode you recommend for this application?  Here are the ones I bought

https://www.amazon.com/MCIGICM-Rectifier-Electronic-Silicon-Doorbell/dp/B071YWNBVM
« Last Edit: February 18, 2020, 11:13:37 am by tcleary »

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7621
  • Last login:Today at 04:15:36 pm
  • Designated spam hunter
Re: Control Wiring Help.
« Reply #3 on: February 18, 2020, 01:06:14 pm »
Iím thinking Iíll use a terminal block to make it easier to keep organized.
The euro-style ones use a setscrew and are smaller than the terminal block type.

Seems easier to connect 3 diode leads under a setscrew than under a screw head.  YMMV.



is there a particular diode you recommend for this application?  Here are the ones I bought

https://www.amazon.com/MCIGICM-Rectifier-Electronic-Silicon-Doorbell/dp/B071YWNBVM
Those 1N4001's will work fine.

The specs are overkill for this aplication, but they are cheap and plentiful.   ;D
--------------
Forgot to mention another thing that will make this project easier -- a soldering tool with a wire-bending slot.
- Makes tighter and more consistent hooks than needlenose pliers.

Tin the wire, trim the diode lead, and bend both into hooks.





Here's a pic with a similar wire-bending soldering tool (2nd from right), click on image for full size.



You may also want a little heat-shrink tubing over the solder joint.


Scott
« Last Edit: February 18, 2020, 01:12:59 pm by PL1 »

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #4 on: February 21, 2020, 04:56:41 pm »
Nice tips.  Ok so after some testing, my brother thought of something that would make this controller better.  The idea is when any of the 8 outer buttons are engaged it would disable the joystick switches.  The example he gave was archon where maybe you are running left and want to quickly shoot up.  So you are holding left on the joystick and press the up+fire button which shoots diagonal up left how I have it wired now.  I thought maybe something was possible using the normally closed connections on the microswitches but I could only think of a way to make one button work how I want using that method.  I canít think of a way where all 8 of those buttons would disable the 4 joystick switches. 

I have a friend who says maybe transistors or some logic gates.  Iím also thinking whatever it is might need to disable the joystick switches and wait for a split second then engage the direction/button switches I want.  Anyway seems like a fun project to figure it out using some sort of components.  If you or anyone has any ideas Iím happy to hear them.  I have been enjoying learning more about electronics. Now that Iím pretty comfortable with diodes time for something else.
« Last Edit: February 21, 2020, 04:59:25 pm by tcleary »

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #5 on: February 21, 2020, 05:02:21 pm »
Here is my project box so far.  It is pretty cool even if I donít get the idea I described above working.  Being able to perfectly execute stuff in the games we tested was nice.


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7621
  • Last login:Today at 04:15:36 pm
  • Designated spam hunter
Re: Control Wiring Help.
« Reply #6 on: February 21, 2020, 07:16:39 pm »
Iím also thinking whatever it is might need to disable the joystick switches and wait for a split second then engage the direction/button switches I want.
It should be possible to do this with a custom Arduino keyboard sketch.
- Even an inexpensive Arduino Pro Micro knockoff has more than enough ports for this keyboard encoder project.

Wire the 13 joystick and button switches directly (no diodes) to 13 input ports.

The program loop would do something like this:
- Read joystick switches and (center) fire button.
- Send simultaneous keystrokes for joystick direction and/or fire.
- Very short delay so these keystrokes don't mix with the keystrokes from the other read/send?
- Read directional fire buttons. (8 outer buttons)
- Send simultaneous keystrokes for directional fire.
- Very short delay so these keystrokes don't mix with the keystrokes from the other read/send?

If you're pressing left on the joystick and the (center) fire button, the first read/send will output "left+fire" and the second read/send will output nothing.

If you're pressing left on the joystick and the top center button, the first read/send will output "left" and the second read/send will output "up+fire".

NOTE: This might cause problems if the program requires continuous button-presses or has problems with the timing.

If that happens, you could add an SPDT switch on a 14th port to toggle between 1 read/send "continuous" (logic high) and 2 read/send "isolated" (logic low) modes.

That program loop would do something like this:
- Read mode switch port and set variable.
- If mode switch variable = high do this section, else skip to next section.
  -- Read all switches.
  -- Send simultaneous keystrokes.
  -- Return to beginning of the loop.
- If mode switch variable = low do this section, else return to beginning of the loop.
  -- Read joystick switches and (center) fire button.
  -- Send simultaneous keystrokes for joystick direction and/or fire.
  -- Very short delay so these keystrokes don't mix with the keystrokes from the other read/send?
  -- Read directional fire buttons. (8 outer buttons)
  -- Send simultaneous keystrokes for directional fire.
  -- Very short delay so these keystrokes don't mix with the keystrokes from the other read/send?
  -- Return to beginning of the loop.


Scott
EDIT: You might want to define the "continuous" and "isolated" code as modules to simplify the program loop.
« Last Edit: February 21, 2020, 07:27:02 pm by PL1 »

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #7 on: February 22, 2020, 09:19:30 am »
Thanks for the write up of how to do it with arduino.  I actually bought a arduino kit that came with a bunch of stuff a while back and definitely want to get into learning it.  This seems like a great starter project.  One of my friends wants to do it with logic gates so we might give that a shot too.  Iíll post whatever solution we come up with. 

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #8 on: February 22, 2020, 10:01:42 am »
Reading this again, could I use an arduino to interface it with commodore?  Or are you just describing how I could interface with a pc? 

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #9 on: February 22, 2020, 03:14:48 pm »
Figured I should document how I do the diode wiring in case it helps someone down the line.  I like to twist the diodes together and put some heat shrink on that and leave a little lead.  Then crimp to whatever connector you need for the button terminal type.  I have some combo crimpers but have found this particular crimper works better.  I highly recommend it if you donít already have a crimper for arcade button terminals and plan to do this sort of thing once in a while.  You have to do two crimps but you can see what you are doing and I always get a nice crimp on the wire and on the heatshrink.  Whatever button will have multiple functions make sure the grey line on the diode faces towards the button terminal. 

Last photos when testing one way will read nothing, the other will read a value, but the multimeter wonít beep.  When I first did this I donít know the continuity beep wouldnít sound so I thought I did something wrong.  So always check the value readout when you use diodes.

This board zooms in on the photos which ruins the last few, so view the actual image file on those.  The zooming ruined what I was trying to show.
« Last Edit: February 22, 2020, 03:18:45 pm by tcleary »

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #10 on: February 22, 2020, 03:29:58 pm »
Some more images.  I cut the diode terminals a bit and solder to my wire.  Heatshrink and test. 


tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #11 on: February 22, 2020, 05:13:37 pm »
Getting a little more tidy with my heatshrink


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7621
  • Last login:Today at 04:15:36 pm
  • Designated spam hunter
Re: Control Wiring Help.
« Reply #12 on: February 22, 2020, 07:16:28 pm »
could I use an arduino to interface it with commodore?  Or are you just describing how I could interface with a pc?
I was thinking about PC/emulators, but instead of sending keystrokes via USB it looks like you could add 5 output ports on the Arduino (U/D/L/R/Fire) connected to Control Port 1 or 2 on a C64.
- Output port logic high = not pressed.
- Output port logic low = pressed.

Double check to be sure how much current your Arduino will draw, but you should be able to power it using the 5v and Ground pins on the Control Port.

https://www.c64-wiki.com/wiki/Control_Port


Scott

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #13 on: February 23, 2020, 11:38:47 pm »
Very cool.  I found a project where someone used an arduino to connect usb controllers to c64 joystick ports. 

My friend who is good with electronics says we can do it using 2 74hc32 chips and a transistor.  I donít quite understand how it will work, but I got the parts and will post here if it works and how to wire it up. 

The basic idea is open the ground connection to the joystick switches if any of the 8 outer buttons are pressed. 

Oh I also did some testing with my fully wired controller using the diodes.  Tested Commodore 64 ninja and moonstone on Amiga.  Both worked well but interestingly sometimes ninja is not as consistent.  Like I hit the up+fire button and sometimes he will punch then jump punch.  Usually it does what I expect and he jump punches.  On moonstone it seemed to pretty much always do exactly what I expected.  Iím assuming something to do with how each machine polls the button presses.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7621
  • Last login:Today at 04:15:36 pm
  • Designated spam hunter
Re: Control Wiring Help.
« Reply #14 on: February 24, 2020, 12:52:43 am »
My friend who is good with electronics says we can do it using 2 74hc32 chips and a transistor.  I donít quite understand how it will work, but I got the parts and will post here if it works and how to wire it up. 

The basic idea is open the ground connection to the joystick switches if any of the 8 outer buttons are pressed. 
It will be interesting to see the schematic for your friend's solution using those Quad 2-input OR gate chips and a transistor.
- It still uses blocking diodes, right?

Sounds like he's using regular ground connections for the buttons, isolating the joystick ground wire daisy-chain, and using the transistor to switch the voltage on that joystick daisy-chain to a logic high when one of the OR gate inputs change state from high to low because a directional-fire button is pushed.


Scott

tcleary

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 164
  • Last login:March 27, 2020, 12:14:42 am
  • I'm a llama!
Re: Control Wiring Help.
« Reply #15 on: March 27, 2020, 12:14:43 am »
I figured out how to do what I want just using the normally closed terminals on the outer buttons.  Hopefully this makes sense.  So I bring c64 ground in on the usual ground terminal on the fire button and daisy that to the left plus fire button.  Then I run the normally closed connection to the usual ground for left + down + fire.  I continue this way around all the multi function buttons not daisy chaining like you usually do but connecting the normally closed to the usual ground on the next button.  So any time one of the outer buttons is pressed it pulls ground up and the remaining buttons on the chain no longer work.  When I get all the way back around to up + left + fire I run the normally closed terminal to the usual grounds for the joystick switches.  So if i press just fire it doe not interrupt the joystick switches.  If I press any of the 8 outer buttons is disables the rest of the buttons in the chain and the joystick switches.  Exactly what I want.  This makes games that use directions plus fire for functions simple to execute exactly what you want.  Iíll probably make a demo video.  My brother was really happy with how it functioned. It works flawlessly with ninja, archon, and yie ar Kung fu.  I plan to test it with Amiga moonstone next because that is the game I really wanted this control setup for.  When I started looking into this I thought the normally closed terminals could do what I wanted, but it took me a while to figure out the wiring.  My ah ha moment came when I looked at the inside workings of the 3 terminal switches.  Cool stuff.  Iíve already made two revisions of the circuit.  One where I heat shrieked diodes to each combo button and another where I put all the diodes on a little board then wired from there.  Funny enough my diode board version looks more complex than the way I did it the first time.  I might get around to designing a little circuit board that will make this clean and simple. 

Here are picture of my first and second wiring.  First picture is the first working wiring.  Second is putting all the diodes on a board instead of putting them near the buttons in the wiring.  Third is final wiring with the diode board and using connectors and labels to make it easy to troubleshoot and easy to take apart.