bushrat
Posts: 69
Joined: Mon Mar 05, 2012 8:35 pm

MAME Button Circuit

Sun Mar 10, 2013 12:08 pm

Ok, so using PiKeyd I've managed to setup a single switch that acts as the coin slot in MAME. To do this I just made a simple circuit and hooked it up to the GPIO. Like so:
https://www.dropbox.com/s/2ts9be5etrugp ... am%202.jpg

I would like to transfer this same diagram to all 17 pins and have created a new larger circuit (forgive for the bad lighting and all round low quality):
https://www.dropbox.com/s/uf3lbmkxwg1iiv0/Diagram.jpg

Before I commit to buying things, does anyone here have any suggestions, or notice any blatant mistakes that could cause damage to me/pi?

Thanks on advance :)

PhillyNJ
Posts: 112
Joined: Sat Dec 29, 2012 4:07 am

Re: MAME Button Circuit

Sun Mar 10, 2013 11:38 pm

Your first circuit looks fine. I would suggest the following; only using a 1k pull-up resistor. Someone may correct me if I'm wrong. 1k is plenty. Also I would wire up your controls on a breadboard using some micro switches first. If all goes well start to plan the actual control PCB.

bushrat
Posts: 69
Joined: Mon Mar 05, 2012 8:35 pm

Re: MAME Button Circuit

Mon Mar 11, 2013 12:43 am

Thanks for the reply, so you think I should replace the 10K resistor in the second larger circuit with a 1K resistor. And yes, I will most definitely try this out on a breadboard first. :)

PhillyNJ
Posts: 112
Joined: Sat Dec 29, 2012 4:07 am

Re: MAME Button Circuit

Mon Mar 11, 2013 1:32 am

See below example. In the example I use a 10k, but I have a 1k in my circuit and I haven't had a problem.

Image

mmoller2k
Posts: 31
Joined: Fri Dec 28, 2012 2:52 pm

Re: MAME Button Circuit

Tue Mar 12, 2013 9:57 am

bushrat, that expanded circuit of yours is not quite right. If you look closely you'll see that all your GPIO pins are simply wired together at your common pull-up line. One switch will pull all the pins low.
Each switch/pin pair needs its own pull-up resistor. You cannot use only one pull-up resistor for all the switches. If you really want to save on resistors and you have good quality isolated switches that you know are not going to conduct static discharge from fingers to GPIO pins, you can omit the 1K series resistors, but the pull-ups are not optional.
PhiliNJ, you want to make the pull-up resistor as large as possible to reduce the current draw, and impact on your power supply when you close the switch. At 1K, each closed switch will draw 3.3mA. 10 kOhm is really one of the lowest values you should use. You could go to 100k with no problem, and I suspect that 1 MOhm will also be fine.
swcon.png
swcon.png (4.9 KiB) Viewed 1794 times

atvdude01
Posts: 23
Joined: Wed Oct 03, 2012 8:01 pm

Re: MAME Button Circuit

Tue Mar 12, 2013 10:16 am

Well if you have a MCP23008 or MCP23017 handy (8/16 i2c iso expander from adafruit) then it could simplify your circuit greatly. i made an entire mame joystick and used a 16 io expander and a program made by mmoller2k (*hint* the one post above me). the i/o chip has built in pull ups so all u do is wire a switch from the chip to ground. heres my post on it http://www.raspberrypi.org/phpBB3/viewtopic.php?t=33148 and on mmoller2k's program (awesome for simulating any key press!!!) http://www.raspberrypi.org/phpBB3/viewt ... 78&t=29962. in his program there is a wiring diagram also that i basically used. you dont need the 5V though running to the chip. it should be fine with 3.3 all the way. if u dont have a expander chip and dont want to take up all your gpio i suggest buyign one there $2.50 at adafruit i think for 16 io one and $1.50 for 8. good luck!

Return to “Gaming”