So, I was talking to someone about my arcade and they asked if I had Qbert. I said “Of course,” and he then asked if it knocked when Qbert died like the original machine…. Challenge. Accepted.
Before you proceed remember: WORKING WITH ELECTRICAL EQUIPMENT CAN KILL YOU. DO NOT TAKE ON THIS PROJECT IF YOU ARE NOT ABLE TO WORK WITH ELECTRONICS SAFELY. (If you get shocked, don’t blame me.)
You need to have soldering and wire connection skills to complete this project. I will not give specifics on how or where to solder and use electrical tape. If you can’t figure that out, again, do not take on this project.
I could not have done this project without my friend Paul who helped me keep safe and gave me a thorough schooling on electronics. Paul designed the circuit and helped me buy the right parts. He helped me understand electrical current measurements with a simple analogy: “Think of a soccer field and a team trying to score a goal. Volts are how many players you have on the field. Amps are how hard they all kick. Watts are just a formula of ‘Volts x Amps.’” The reason all of this matters is that the knocker mechanism is based on an old-school pinball knocker. It is a solenoid, so it needs a decent amount of volts and amps to make it kick….more than a regular video game or PC supplies.
Step 1 – Modify Mame Cabinet Hardware
I added a 45 degree angled joystick to my panel (which Q*bert uses); that was pretty easy as I just connected it to the closest existing joystick switches, matching each switch on the joysticks and creating a new ground daisy chain. Regardless of whether the knocker worked, I wanted the off-axis joystick on the panel. The best place to reach it easily and not have it interfere with other controls is where you see it in the picture below.
Step 2 – Q*Bert and Output commands
Q*bert’s emulator, like many MAME games, has been coded to send output events for items like the knocker. In the case of Q*Bert, the command to trigger the mechanical knocker is knocker() There are 2 things which you need to do with this command. 1) capture it so that you can see when it changes state from Knocker0 to Knocker1 AND 2) use that information to trigger mechanisms outside of the MAME machine.
The general idea is that MAME outputs events which are captured by MAMEHOOKER and then Mamehooker can control the PacDrive Board (which can power a light, relay or other devices, but, only low voltage, which is why we added a relay).
Step 3 – Install PacDrive Board
Hook up the PACDrive to your MAME machine via USB. Hook up the LED bulb to the PACDrive +5V and port 1 so you can test the PACDrive Board and commands it receives, regardless of powering the solenoid (covered in later steps).
The PACDrive should be installed first so MAMEHooker can recognize it.
Step 4 – Assuming MAME is already installed, Install MAMEHooker
The cabinet runs on Windows 10 Pro 64bit. After doing a lot of research, I couldn’t find anything native in MAME that would send a knocker signal to a solenoid. I found a great little app called MAMEHooker: http://dragonking.arcadecontrols.com/simplephp/ccount/click.php?id=77. After installing MAMEHooker, you need to register an ActiveX file to make it work. You need to be using MAME 0.190 or higher or MAMEhooker will cause memory problems that freeze some emulation.
To register RICHTX32.OCX, download and extract RICHTX32.OCX to your c:\windows\system32 directory. The file is contained in a compressed file here: https://support.microsoft.com/en-us/kb/957924. You should be able to figure out how to extract the file if you are smart enough to have installed MAME. Run a command prompt as administrator. Then type: “Regsvr32 c:\windows\system32\richtx32.ocx”. The syntax is Regsvr32 [/u] [/s]
Step 5 – Working with MAMEHooker
When the MAME machine starts, MAMEHooker should be set so that it auto starts as well. Put MAMEHooker in your Windows Startup folder and configure it to run minimized, and possibly Run as Administrator, depending on how you configured your system. I have MAME and MAMEHooker running on a standard account, not an Administrator account.
MAMEHooker will be listening for events from MAME when both are running. When it recognizes a new game in MAME, it will create a text file in the MAMEHooker home folder for each game. On the drivers page, you should see that MAMEHOOKER recognizes the PACDrive board.
In the MAMEHooker debugging window you will see it capture data similar to the following:
MameStart=uls 1 1 0
MameStop=uls 1 1 0
MameStart=uls 1 1 0
MameStop=uls 1 1 0
If you see text similar to this, you can now test the capture from MAME in windowed mode so that you can play Q*bert and see the MAMEHooker debug screen. Play Q*bert and kill him off by dropping him off the edge. In a fraction of a second, you should see Knocker(0) change to Knocker(1) and then back again. If you see this, you’re in fantastic shape and the rest of the project is pretty mindless and easy.
Step 6 – Setting MAMEHooker to output to the PACDrive Board
What you’re going to do here is somewhere between programming and using a pop-up menu with a list. It’s easier to do than to explain.
Basically, you’re telling MAME Hooker to run a few small commands. It modifies the .ini file once it is saved.
Using the scripting, I configured MAMEHooker for qbert.ini with the following parameters:
MameStart=uls 1 1 0
MameStop=uls 1 1 0
knocker0=uls 1 1 1,wat 50,uls 1 1 0
Although those knocker commands look complicated, what it is really saying is when knocker0 changes state in MAME, turn on PACDrive Port 1, Wait 50ms, Turn off PACDrive Port 1. MAMEHooker lets you set those settings in plain English and modifies the .ini so that it looks like that.
At this point, you should hook up an LED to the PACDRIVE Board and test the functionality. You can use MAMEHooker to send a test command to turn on the LED, AND you can test MAME’s ability to run the whole process and light the LED. You can ignore the parts of the command which wait and turn off the LED if you’re testing because what you really care about first is that the LED lights at all. If you can’t get MAMEHooker to work with the PACDrive and LED bulb, then stop now. No point spending any more time, money or effort until this part is functional.
Step 7 – Building the Solenoid Circuit
Note: solenoids are reasonably high dc voltage. Between 30v and 50v. You need to be more cautious at this step because that voltage can sting, or worse, if you make a major mistake. DO NOT do this step unless you have safe electrical skills and know what you are doing.
This is also why we want to use a relay to isolate the solenoid circuit from the rest of the MAME machine. Solenoids (and motors for that matter) have weird power curves that cause a lot of stress on an electrical circuit if they aren’t working properly. Think of a ceiling fan buzzing because its jammed and wont spin….That buzz in the fan will ruin the motor…same thing with solenoid coils.
The solenoid I used was a The TwistyWrist Arcade Q*bert assembly which includes an A-5195 solenoid and 250V 1A Slow Blow fuse. It comes all as one unit. Reading the solenoid markings and doing the electrical math, we figured out we were using a 30V 2AMP solenoid. More powerful solenoids were available, but this had one purpose: to be a pinball knocker. If a more powerful one was used, the sound might be distracting. You can modify the solenoid power a little with a different voltage power supply, but it is not really worth the time or the cost. I ended up getting a 24V 2A power supply and changed the fuse to a 2A slow blow.
The relay I used was an Arduino relay off of eBay. You could buy a simple relay from Radio Shack or an auto parts store and solder right to it, but I wanted to be able to easily disconnect and replace a broken leg of the circuit, so I bought a relay on a PCB. This made it a bit more complicated. PCB Relays these days all seem to be designed to take trigger mechanisms from Arduino computers. So, if there is no “trigger,” the relay won’t click and do its thing.
There is an easy way to work with this problem. When the relay is looking for a trigger, it is really just looking for about 5V. On a PCB, it is considered as 1s and 0s, but really, it is the same as saying voltage or no voltage. As you look at the picture of the relay, you will see that not only did I put the 5v line from the PACDrive to the 5v port on the relay, I jumpered it to the trigger port as well. I also used the other jumper on the relay board to tell the trigger to look for HIGH, which is the same as 1s, which is the same as 5v.
The first power supply I used was an old HP Printer power supply I got off of eBay for $12. Why pay $200 for something when you can get it for less? The 1A fuses kept blowing and I switched to a 2A fuse. That ended up burning out the solenoid. Switching down to 24V 2A power and a 2A slow blow fuse seem to have fixed the burning out problem.
As a note, the wiring order of a solenoid circuit is a little counter intuitive. First, test the wires of the power supply to know which has voltage and which is the ground. The counter intuitive part is the location of the relay (switch) in the circuit. Normally, you would put a switch on the hot line before the load. With a solenoid, the relay (switch) goes after the relay on the return path ground to the power supply. This has to do with electrical theory and the power curve of copper coils. It is counterintuitive, but it is the right way.
Note the jumper on the output of the relay.
I used electrical tape to keep some wires together, not because they were soldered or connected, but because it was neater.
I used molex connectors everywhere possible to make future replacements easy.
I originall mounted the knocker right under the control panel over the coin door, but it was hard to get at it when a fix was needed. I moved it to the side of the cabinet, near the front, so I could reach it easily from the coin door.
The only problem I’m trying to fix is that Q*bert knocks when the game boots, when I hit the Pause button, and when I hit the Exit button.
I placed the relay in a metal electrical junction box inside the cabinet. I plugged the power supply into a switched outlet on the SmartStrip so there is no power at all to this when the arcade is off.
Note the molex connectors are outside of the box to make connections easy.
Here is the PACDrive inside the control panel. When testing, hook the LED bulb up to these two connection points instead of the wires. I had to tin the wires to get them to sit securely.Here is the final project, working.