SpiffMAME Power Relay

This page describes how I have implemented a power-relay for my MAME cabinet. The relay (actually two of them) can be controlled from the parallel port. One relay controls the sound system (old computer-speakers including subwoofer) as well as the marquee backlight. Basically this relay could just as well run directly of the PC power supply, which would mean that the sound system and marquee backlight would be turned on whenever the PC is.

The second relay plays a more important role, since it controls the power to the arcade monitor (I have a Hantarex MTC/9000). The monitor only accepts low frequency sync signals, and since it is connected directly to the graphics adapter, it is crucial that the monitor is not turned on until the graphics adapter has switched to a suitable mode.

I use AdvanceMAME on my cabinet with AdvanceMENU as a frontend. Both these programs have superior support for generating appropriate video-modes for use with arcade monitors (or TVs). My cabinet used to run DOS, allowing me to use the AdvanceCAB-utilities. This includes utilities to set a low-res mode during bootup (from config.sys), displaying a 320x200 bootup logo, as well as setting bits on the parallel port, to turn on the monitor.

At some point I upgraded the motherboard in my cabinet, and there were no DOS sound drivers for the onboard sound (and no ISA slots for my old Sound Blaster). I therefore decided to run Linux on my cabinet (since I already use Linux on several other computers). Using a Matrox G400 and the matroxfb framebuffer driver it is possible to get a console up and running in a mode that can actually be displayed on the arcade monitor. After a lot of experiments (and new software versions) I have also succeded in getting Gentoo's bootsplash up and running on my cabinet, so I get a nice progress-bar during startup and shutdown of the cabinet. I will try to write up a description of how I did this in the near future. If you are interrested, please let me know, since this might just be the motivation I need to get it done.

Back to the monitor and power relays. As I mentioned earlier, it is important that the monitor is not turned on while the graphics card runs at normal frequencies. When the computer boots up, the POST (power on self test) will run in this mode. There are special graphics adapters available, or external circuitry such as the J-PAC which can handle the "dangerous" signals. There are also two do-it-yourself solutions to this problem, both involving a little bit of electronics knowledge. The basic concept is either to avoid turning on the monitor until a suitable mode has been set, or to block the signals going to the monitor. Blocking the signals can be achieved with a 4066 quad analog switch. I chose the other approach, and use a relay to switch on and off the power to the monitor.

Several circuits exist to solve this task. For the do-it-yourself solution it is easiest to use the parallel port. A circuit for the parallel port is the PC2JAMMA Cabinet/Monitor switch. This system uses the strobe signal of the parallel port (pin 1). The strobe signal is normally used to let the printer know it should read the data on the port (and send an acknowledge).

During the POST, the motherboard (BIOS) may switch some of the data-bits on the parallel port. To avoid the monitor flickering on and of during this period, using the strobe-signal is a good idea. However, sending data to the port requires some other software, and I don't think it is possible to use the portio-utility from AdvanceCAB, nor the scripting in AdvanceMAME to turn on this circuit.

The other solution, which I have chosen, is to use some more data-bits as enable-signals, to avoid unwanted power-on during POST. I use one bit to control the monitor (bit 2), and one to control the marquee backlight and sound (bit 3). Additionally, I have two bits (0 and 1) used as enable signals, of which one must be low, and the other high. To turn on the different modules, I use the following values:

All off0b000000000
Monitor on0b000001015
Marquee and sound on0b000010019
All on0b0000110113

Basically, all I do is to set the correct output-bits on the parallel port during startup (as soon as the appropriate mode has been set). Doing this under Linux is accomplished with a small program written in C (source code for parport.c). This is basically exactly the same as portio.exe from the AdvanceCAB utilities, except that this is for Linux (and the output port is hard-coded to 0x378). If you want to use this, you should compile it with gcc -o parport parport.c. Remember that this program needs to run as root in order for the ioperm-call to succeed. If you need to run it as another user, you could setuid it with chown root:root parport ; chmod u+s parport.

Finally, let's have a look at the circuit:

SpiffMAME power relay circuit

The three NAND-gates are used to create the enable-signal. The circuit (ICs) must be powered by 5V, and the relays I used need a 12V supply. 5V, 12V and ground is connected to the PC power supply using a regular hard-drive power connector. The transistors I have used can only deliver 100mA, so make sure the relay coils do not need more than this (or use a different transistor).

The switch s2 is mounted inside the coin door, and allows the monitor to be turned off (when connecting a different monitor for debugging etc).

The circuit was made on prototyping board and mounted in the cabinet:

The finished board mounted in the cabinet

The image above shows the board with the interface circuit. You can see how it connects to the parallel port of the motherboard. Just below the circuit board are the outlets for the marquee backlight and sound system (only the subwoofer is plugged in).

The power relays are mounted in a black plastic box

This image shows the box containing the actual relays. The gray thing on the left is a can for storing the cable when the machine is not plugged in. The gray cable goes to the box, where a switch accessible from the bottom side of the cabinet acts as the main switch. If this switch is on, the computer is powered through the upper right (black) cable. The two relays control power to the bottom left black cable (supplying the isolation transformer for the monitor), and the bottom right white cable, going to the power-strip for the subwoofer, speakers and marquee backlight.

Last updated: 2005.04.30