Category Archives: Electronics

GP-Wiz40 MAX USB and RetroPie

Since I’m going to all the trouble to build a big screen movie setup in the backyard, I figured — games! And since I’m not a great fan of current games, I wanted retro.

With lucky happenstance, I ran across a Linux build for the Raspberry Pi (the $35 computer) that is designed for retro gaming in mind. Horray! It’s called RetroPie (and yes, there are others).

The current build is quite nice, with everything installed. But how to control it? I got some cheapie USB controllers (SNES style) that will work, but I wanted heavy duty. And what about MAME? That app, for all it’s greatness, is so bound to a keyboard. And I don’t want a keyboard on my back porch.

For past projects (not completed) I had purchased a couple of interface boards from GroovyGameGear. Their GP-Wiz 40 — a device that is seen as a game controller, and connects via USB. That would work great for controllers. (Again, from past projects, I have arcade quality sticks and buttons on hand, from X-Arcade.)

The other product I have of theirs is their KeyWiz — which emulates a keyboard. It’s a great product with a fatal flaw (in the case of the Raspberry Pi) — it uses a PS/2 port. No PS/2 port on the Pi. And that port is, unfortunately, as rare as hens teeth on current PCs.

KeyWiz would be perfect for MAME, since it acts like a keyboard, not a gamepad/joystick. However, the port limitation means I can’t use it.

So, back to the GP-Wiz 40. Good news: The EmulationStation front-end to the emulators pick it up fine. But what about the emulators themselves?

You really go down the rabbit hole with this stuff.  Here’s how it works:

  • EmulationStation is a pretty front end to start the emulators and games. It does not actually do the emulation. It’s your “TV GUI”.
  • RetroArch is a middle layer. It gets called from ES and handles the calling of the individual emulators. Why a middle layer? Well, for one, it makes coding front-ends easier. ES just has to interface with RA, not a bunch of individual emulators. And, you can choose to config controllers once — in RetroArch — and it passes those configs down to the emulators.
  • The emulators themselves. These are custom builds for the PI to take advantage of its meager resources. Keep “custom builds” in mind — because of the heartache these will cause (below).

I mapped the GP-Wiz 40 inputs to various controls in RetroArch. For example, Linux Joystick Button 4 = “A”, Button 5 = “B”, Button 16=”Select” and so on. For NES and SNES I needed 8 inputs (U/D/L/R/A/B/X/Y) for the usual controls, plus 2 more — for Select and Start.

That all worked fine. I got NES, SNES, and Atari 2600 working fine. Good progress. But what about MAME — for the arcade games?

Well, this was (and still is) a bear. For one, the mappings I setup in RetroArch didn’t seem to translate to the MAME emulator (MAME4ALL). Well, there are worse things, I guess. I can manually do the mappings within MAME.

Couple of issues:

  1. The config stuff is read-only. So if you change settings, they don’t stick after a MAME restart. Saw this with RetroArch, too. This is fixed by changing the ownership of the config files to the “pi” user. Something like “sudo chown pi retroarch.cfg” (sudo=act as admin, chown=change owner, pi=new owner, retroarch.cfg=file you want owner changed on).
  2. I could not, for the life of me, get MAME to recognize the joystick ports (analog, but can be used as digital). So, I had to go with pure digital.
  3. I could not get MAME to recognize all of the digital ports on the GP-Wiz 40. This really, really sucked.

Why did #3 suck so bad? Because MAME uses all those damn “insert coin” and “player one start” stuff to start a game. So, in addition to the regular buttons, I needed ports for that (remember, I don’t want a keyboard outside).

The GP-Wiz 40 has plenty of ports — so why didn’t MAME recognize them? Well, after seeing nothing in the documentation, I came across this is a change log: “Updated code to support 16 buttons”.

Shit.

Player 1: U/D/L/R/A/B/X/Y = 8 + Player 2 is another 8 — 16. I’m maxed out, because this custom build limited buttons.

So, I could get game controls in MAME, but can’t actually start a game. And so it stands right now. Either I have to figure out how to get the joystick analogs to work, freeing up 4 digitals for each user, or come up with some sort of magic hotkey. (In the SNES and NES emulators, since they can see more than 16 buttons, I have dedicated digital lines for Select and Start — and pressing them together exits the emulator.)

So, if you are wanting to use the GP-Wiz 40 for two players in RetroPie, keep this in mind: SNES and NES and Atari 2600 (the ones I tested and have games for) work fine. I’m using digital for the joystick, but since I have plenty of ports, no problem. MAME is the problem, with it’s limitation. Like I said, I’m still working on it, and I’ll post again if I come up with a solution.

 

e-Textiles. Or: Clothes With Lights

One of the more interesting DIY technologies to come out in the last couple of years are the e-Textiles. A very cool combination of electronics and sewing. Using surface mount LEDs, easy to program microcontrollers, and conductive thread, you can make clothes that glow.

The LilyPad is probably the gold standard for this stuff. Arduino compatible, well made, and nicely modular.

The folks over at SparkFun have a complete design kit, if you are interested in getting into it. Check it out here: LilyPad Design Kit

 

DIY Cat Laser Toy

I’ve had this project sitting around for ages now. An automated way for the cats to have their laser fun without having to sit there with the laser pointer. (We get tired before they do, and by “we” I mean Evelyn.)

I got one of those DART laser toys, and they are pretty good. But have one huge drawback (besides sucking up batteries) — while their motion is random, they only draw the laser in a circle. The cats, of course, figure this out VERY quickly. So, being the lazy kids that they are, end up sitting around the DART and just pawing as the laser goes by. So much for exercise!

I was originally going to attach mirrors to two servos, then shoot a laser at them. One X, one Y, so you’d be able to “draw” with the laser beam. But you get a lot of power loss when you bounce off my cheapo mirrors (didn’t have any front surface mirrors on hand, and they are expensive and easy to damage).

So, I went searching again and found a design where the laser is mounted directly to one servo (to provide X) and the servo/laser combo is then attached to a bigger servo (to provide Y). Think how those robot welding arms work, and you get the idea.

This Instructable shows you what I mean: CatBot

Here is my work in progress.:

DSCN3877 (Large)

Toward the upper right, you see the laser module I scavenged from a dollar store laser pointer. It’s hot glued to a little servo. That little servo is zip tied and hot glued to a piece of erector set. The bottom piece of erector is screwed to the bigger servo (which is, for testing purposes, clamped in a vise).

I originally was trying to drive the laser using a 3.3V regulated supply. But, there are no specs on the laser, and I blew up two by over driving the current. This is why I use dollar store lasers. So, I went the hillbilly route and used a 3V coin cell. I call it hillbilly because you can see my header pin kludge to hold the cell. I tossed a switch on there so I can manually shut the laser beam on/off.

Toward the left is my go-to board for Arduino development. The Evil Mad Science Target Board. Because these servos don’t take too much current, I’m driving them directly off the Arduino pins. PWM (pins 9 and 10) handle the yellow/white signal line. I use the servo library to drive the code, so that’s pretty simple.

Now Evelyn is laser cutting a box to put the big servo and control board into. This will then get mounted on the ceiling, with the laser moving all over the house.