Nostalgia-Tron, Part 11: Not electrocuting yourself

Posted in Articles, Raspberry Pi, Tutorials

A while back you might remember that I was about to tell you how to synchronize the on/off states of your Pi, your monitor, and your marquee light. It involved an Arduino wired to two relay modules, which themselves were wired to an outlet of my own construction.

I stopped because I realized that there was probably a better solution out there than “wire your own outlet and hope you got it right.” And there is. So that’s how we’ll end this eleven‐part series.

A refresher

Here’s where we are:

  • We’ve got an arcade cabinet with a two‐gang outlet box inside, giving us four outlets to work with.
  • Plugged into that box are a Raspberry Pi, a monitor, and a power brick that supplies 12V DC power to a strip of LEDs for lighting up our marquee.
  • We’ve hooked up to a Mausberry circuit so that we can safely power up or power down the Pi with the press of a button.
  • But we want the monitor and marquee to get in on this action, too. When the Pi is on, they should both be on. When it’s off, they should both be off.
  • There are other things that need power in the cabinet, like a USB hub, but they can remain on all the time.

The device

Easier than building your own.

Get an IoT relay. I found mine on Amazon, but Adafruit also has them. Or go with a Powerswitch if you can manage to find one. The goal is to find something already built that allows you to toggle an outlet based on a logic signal. (Europeans will need to find something rated for 230V AC; sorry.)

The hookup

Let’s refer back to our dear friend pinout.xyz. You need one ground and one pin for logic — when set high, it’ll turn the outlet on, and when set low it’ll turn the outlet off.

The ideal solution is one of the 5V power pins — physical pin 2 or 4 — plus the ground at physical pin 6. Adjacent pins are always simpler. But physical pin 1 or 17 — the 3.3V pins — will also work, as will any other ground pin. The logic voltage can be as low as 3V.

The green module on the side of the relay can be removed. Pull it out. It’s a terminal block! Take two jumper wires, cut and strip one end of each, and put the stripped end into the terminal block and screw it down. One of those wires plugs into your voltage pin and the other plugs into your ground pin; note the + and symbols printed on top of the relay near where the terminal block plugs in.

IoT relay hookup
Using the adjacent 5V and ground pins is the simplest approach.

Plug the relay directly into the outlet box, then plug the monitor and marquee light into the two “normally OFF” outlets on the relay.

You are done

That’s it. That’s all you should need. This is the setup that’s running in my cabinet, having replaced the thing I kludged together. It’s simpler than what I had built and costs far less than what you’d pay for an Arduino Nano, two relay modules, an outlet, an outlet cover, and two free‐standing receptacles to hold everything.

When your Pi is on, so should the other devices be, and when the Pi ends shutdown and kills its own power, the other devices should get their power cut as well. Look for the LED in the middle of the relay, too; it should light up when the Pi is on. If it’s not working, check all your connections and make sure you’re using the right GPIO pins on the Pi.

What’s next?

Having done all this, you might find yourself where I am right now: looking at ways to augment the cabinet you’ve already got. If, as I did, you want to make your cabinet play Dragon’s Lair and Space Ace, you can install Daphne; there’s a fine guide for that.

I’m not sure what to do next. My instinct is to add guns in order to open up a whole new genre of arcade gaming. But the technology behind light‐gun games requires a CRT monitor. MAME lets you use a mouse (or mouse‐like device) to replicate the process of aiming and shooting, and devices like the AimTrak leverage this approach.

But I’ve monkeyed around with an AimTrak for a few hours and I’m afraid it’s just not the same. The on‐screen reticle is too twitchy for light‐gun games like Area 51 and Police Trainer, and fixed gun games like Terminator 2 or Revolution X expect more precision than you can muster with a hand‐held gun. I’m punting on gun games for now; hopefully I’ll revisit the issue in a year or so and find that someone smart has found ways around these problems.

Aside from this, the main item on my wish list is better support for some of the more demanding arcade games of the late 90s. Killer Instinct was hugely popular when I was growing up, and my cabinet feels naked without it, but it doesn’t run at a playable frame rate even on a Pi 3. Same with NFL Blitz. Somewhat heretically, my favorite arcade basketball game is not NBA Jam but rather the much later NBA Showtime — which MAME doesn’t even emulate yet. For these I’ll have to wait for the next model of Pi — or for a giant step forward in MAME performance on the Pi — and perhaps longer than that.

Meanwhile, if I had infinite time and money, and if my girlfriend had infinite patience, I’d probably be building myself a Crazy Taxi cabinet. But I’ll quit while I’m ahead.

Comments

Leave a comment

(Huh?)
What's allowed? Markdown syntax, with these caveats…
GitHub-Flavored Markdown

A couple aspects of GFM are supported:

  • Three backticks (```) above and below a section of code mark a code block. Begin a JavaScript block with ```js, Ruby with ```ruby, Python with ```python, or HTML with ```html.
  • Underscores in the middle of words (cool_method_name) will not be interpreted as emphasis.
HTML tags/attributes allowed

Whether you're writing HTML or Markdown, the resulting markup will be sanitized to remove anything not on this list.

<a href="" title="" class=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class=""> <del datetime=""> <em> <i> <li> <ol> <pre> <q cite=""> <s> <strike> <strong> <ul>

Now what? Subscribe to this entry's comment feed to follow the discussion.