Exergaming Emulation I: Power Pad (NES)
by arpruss in Circuits > Microcontrollers
1858 Views, 6 Favorites, 0 Comments
Exergaming Emulation I: Power Pad (NES)
This is the first in a series of posts on how to do pre-Wii retro exergaming under emulation, using newer and easier to obtain controllers, but still aiming to preserve the intended level of challenge. The next post is here.
The Power Pad was a mat-based controller for the NES, also marketed as the Family Trainer, rather like the later Dance Dance Revolution (DDR), but in a 4x3 rectangular configuration. The most famous game for it was the bundled World Class Track Meet. I will tell how to play Power Pad games in emulation with the bleeding edge FCEumm libretro core (I added Power Pad support code to it in January 2023) on RetroPie (in my case on a Raspberry PI 3B+) using more easily available mat controllers like DDR or Wii Outdoor Challenge mats.
All the mat controllers that I have at home are for the Wii and use GameCube connectors. So I will say a little about how to make use one of the cheap (now about $3) STM32F103C8T6 (or clone) blue pills and an Arduino sketch to make a USB adapter for these, specialized for mat controllers. You may be able to avoid making an adapter if you buy USB-based DDR mats, but I don't know how they work. There may also be a way of doing it with Wii DDR controllers and the ubiquitous GameCube controller to Wii U / Switch adapters, as long as your computer supports these adapters.
The basic idea is that you can overlap a pair of DDR mats to make one complete Power Pad, while the Outdoor Adventure mat can be used as half of a Power Pad for single-player Track Meet or as all of a Power Pad for games that use side A of the Power Pad.
You could also just buy a Power Pad on ebay and make a USB adapter. It's probably pretty easy, but I don't know how well the old pads still work, and due to space and money considerations, I want to minimize the number of bulky mat controllers at home. Moreover, the two DDR pad configuration is about 25% wider than the Power Pad, and hence should work better for two adult-sized players side-by-side.
Supplies
- Two DDR mats for full Power Pad emulation
- Or One Wii Outdoor Challenge mat for full Side A Power Pad emulation and half of Power Pad Side B emulation
- STM32F103C8T6 (it may work with the cheaper and lower spec'ed C6T6) blue pill development board, two 1K resistors and two GameCube controller sockets (console side) if you need to make a GameCube to USB adapter
- RetroPie
Layouts
The Power Pad is flippable and has two sides (see pictures). Side B is said to be more commonly used and has three rows of four buttons large enough to step on. Side A removes the corner buttons, leaving eight buttons. I have two NES games ripped from cartridges that are easy to buy online: World Class Track Meet (bundled with Duck Hunt and Super Mario) which uses Side B and Athletic World which uses Side A.
The Wii Outdoor Adventure mat provides an exact match for Side A (and adds - and + buttons), which is perfect for Athletic World (no surprise, since Outdoor Adventure is a Wii version of Athletic World). You can also use the middle two columns of the mat to emulate the left two columns of Side B of the Power Pad, which is enough for single-player Track Meet.
DDR mats are trickier, because the ones I have don't have a button in the middle. However, turning two of them on their sides facing away from each other and overlapping the bottom two rows aligns the down button of each pad with the empty center space of the other, producing three rows of four buttons. And there is no difficulty in triggering the resistive controls of one mat through the other in my testing.
The current code for the FCEumm libretro core has support I added to allow the qwer/asdf/zxcv keys to work like a Power Pad. We'll need to remap the pads to fit with that.
Update FCEumm
You need to build the latest FCEumm libretro core from source to use my Power Pad support code. On my Rasperry PI this can be done automatically by running
sudo ./retropie-setup.sh
in your RetroPie download directory.
Then choose Manage Packages and Manage main packages, and scroll down to lr-fceumm. Choose Update from source. If all goes well, you will get a ton of compilation stuff scrolling, and then you'll have an lr-fceumm core that supports the Power Pad.
Do You Need to Make an Adapter?
If you are using USB DDR mats, or have a GameCube controller to USB adapter that works with the DDR mats you want to use and can recognize all combinations of simultaneous presses, and all of these show up as joystick buttons on the computer you are using for emulation, you can skip this step. But note that a GameCube controller to USB adapter is unlikely to work with the Outdoor Challenge mat which uses non-standard button mapping, and there is a possibility that some adapters may not recognize simultaneous presses of opposed DDR mat arrows.
Blue Pill GameCube Controller to USB Adapter
You will need an STM32F103C8T6 blue pill board, two GameCube controller sockets (the kind that are on the console side) and two 1K resistors, as well as a USB TTL serial adapter (you can also use an Arduino board instead of the serial adapter). I actually 3D printed my own controller sockets (instructions and files here), because it'll take a while for the ones I ordered from Aliexpress to come, but I don't recommend it--it's too finicky to make and may not be reliable in the long run.
Upload the firmware to the blue pill as follows. First, get the .bin file from the releases in my github project (you can also build the project yourself using source code and a bootloader and my Arduino setup instructions for an older version of this project) On Windows, I've used the Flash Loader Demonstrator. Make the following connections:
- Blue pill A9 to serial adapter RX
- Blue pill A10 to serial bridge TX
- Blue pill ground to serial bridge ground
(Actually, I am lazy and usually just plug both the blue pill and the serial adapter to the the same computer, and the grounds are close enough that I don't bother with the direct ground connection.)
On the blue pill, there are two sets of jumpers, each on a trio of pins. Make the first jumper (B0) join the center pin with the right pin (center to B0+ or center to 1, depending on labeling). Make the second jumper (B1) join the center pin with the left pin (center to B1- or center to 0, depending on labeling).
Power up the blue pill via its USB port (if you connect it to the computer, the computer will likely complain about an unrecognized USB device; ignore that). Start the Flash Loader Demonstrator. Choose the COM port for your serial adapter (the Windows Device Manager can help there). Choose "Remove protection" if available. Choose a 64kb rather than 128kb flash version. And download the firmware binary file into the device. Unpower everything and then move the first jumper left+center. Plug into PC and make sure that Windows Device Manager shows a new HID device (keyboard).
Disconnect and wire it up. The wiring is straightforward. See the attached socket diagram. On each controller socket, and make these connections:
- pins 3 and 4 to blue pill ground (pin 4 is likely enough; on my DDR pads, pin 3 is not connected)
- pin 1 to a blue pill 3.3V pin
- pin 2 (data) on the first socket (left mat) to A6 on blue pill
- pin 2 (data) on the second socket (right mat) to B9 on blue pill
- 1K resistor between A6 and 3.3V
- 1K resistor between B9 and 3.3V.
You can do it on a breadboard, but I just soldered wires to the blue pill.
Connect pads to sockets, board to computer USB, and see if the pads work like a keyboard.
If things don't work well, add 10uF and 100nF capacitors between 3.3v and ground. I had to do that with an original STM blue pill in my older project, but not with the clones that I am now using.
You can make a case. My 3D printed case probably won't work for you as it has cutouts for my homemade controller sockets, but in case you want to adapt it, the files are here.
Configure Controls With Blue Pill GameCube Controller Adapter
Let's suppose you're using my blue pill GameCube controller adapter. If you're using two DDR mats, overlap them as shown, and join them with binder clips along the edges, making sure not to pinch any internal wiring or the buttons (sometimes the detection surface goes quite close to the edge).
For all the games, you will also need a standard Player 1 controller that works with NES games. I will assume that this is already configured.
The next thing you should do is modify your RetroArch settings to make the qwer/asdf/zxcv keys do nothing. To do that, either edit the global retroarch.cfg file and comment out (by putting a # at the start) or change any line that assigns q/w/e/r/a/s/d/f/z/x/c/v to anything, etc., or just edit the retroarch.cfg file for NES emulation and add overrides for all these settings. For instance, my global retroarch.cfg had
input_toggle_fullscreen = f
That would interfere with the mat adapter's generating f for button 8 of Side B. So, one can change it globally to:
# input_toggle_fullscreen = f
to disable fullscreen toggle (which doesn't work on my RetroPie anyway), or one can change the f to some free key, or one can add an override like
input_toggle_fullscreen = "nul"
before including the global retroarch.cfg in the NES retroarch.cfg file. On my RetroPie setup, the NES retroarch.cfg file is at /opt/retropie/configs/nes/retroarch.cfg and the global one is at /opt/retropie/configs/all/retroarch.cfg.
Next, start up some NES game that uses the Power Pad (the allpads-nes controller tester is handy), open the RetroArch quick menu (with whatever hotkey you have assigned to it), choose Controls, and set User 2 Device Type to Power Pad A or B, depending on which side the game uses.
You may need to reset the game for it to recognize the Power Pad. For initial testing, I recommend using an ordinary keyboard. Once you know it works fine, choose Save Game Remap File in the Controls menu.
Now, you need to configure the blue pill adapter for the game. The blue pill adapter has four modes, selected by pressing + and - and up/down/left/right all at the same time on the mat (on the Outdoor Challenge mat, both up keys count as up, and both down keys count as down; on a standard Gamecube game controller, use START for +, Z for - and the dpad for up/down/left/right). These modes are:
- +-left: Power Pad (default)
- +-right: Alternate mode Power Pad
- +-up: XBox 360 controllers emulation
- +-down: Joystick where the axes are inactive and all the mat buttons go to joystick buttons.
For our purposes, the first two modes are what matters: these are the modes that remap mat buttons to qwer/asdf/zxcv. (The Xbox mode might be nice for using GameCube controllers with some games. The joystick mode might be handy for DDR-style games like Stepmania or Project Outfox.) I recommend just sticking to the default +-left mode for Power Pad purposes. This mode works as follows:
- With two DDR mats plugged in and overlapped as in the diagram, generate full qwer/asdf/zxcv matrix for Power Pad Side A or B, assuming the mats are overlapped like in the photo. The + and - buttons generate + and - (left mat) and [ and ] (right mat).
- With one Outdoor Challenge mat plugged in, generate we/asdf/xc for full Power Pad Side A emulation by default; if the Scroll Lock "light" is on, the middle two columns of the Outdoor Challenge mat generate qw/as/zx which is the left half of Power Pad Side B, and allows single-player World Class Track Meet. The + and - buttons generate + and -.
Currently, in alternate mode Power Pad, the only difference is that Power Pad Side B left half emulation is the default for the Outdoor Challenge mat, and Scroll Lock activates Side A emulation. You can control Scroll Lock with an additional keyboard plugged into your computer or, if you're using a Raspberry PI, you can activate Scroll Lock from the commandline with:
xset led named "Scroll Lock"
and disable it with
xset -led named "Scroll Lock"
I use these in scripts that launch games to automatically switch the controller to the right setting.
Using USB Dance Mats
I don't have any USB dance mats, so this section is speculative. Tell me in the comments if it works for you, or, if not, why not.
Your USB dance mats need to have left, left-up, up, right-up, right, and down buttons, and generate joystick button presses from them. Then you can overlap them just like the Wii DDR mats I'm using. Make sure that RetroArch can see both of these mats. You should use Emulation Station or edit .cfg files to map the left, left-up, up, right-up, right and down buttons on the mats to something you will remember, e.g., A, B, X, Y, L and R, respectively.
Then go to the Controls menu in RetroArch just like in Step 5, but now set both Player 2 and Player 3 as Power Pad A or both as Power Pad B (they need to both be the same). Make sure that Player 2's controller is your left USB dance mat and Player 3's controller is your right USB dance mat. Exit the RetroArch in-game menu and go back to it to make RetroArch register all the settings. Now map the Player 2 and Player 3 controls to generate keys that match the positions of the buttons when you overlap them to make the 4x3 Power Pad. E.g., if you mapped left-up to B, then on the left mat, left-up will correspond to Power Pad B9, which in the FCEumm keyboard mapping is z, so map Player 2's B button to Keyboard z. On the other hand, Player 3's left-up will correspond to Power Pad B4, so it Player 3's B button should be mapped to Keyboard r. Make sure you save your remap settings for this game (and you can then later copy the .rmp file to another game). See the screenshot for an example of Player 2's setup using the mat mapping from the previous paragraph.
Test all this with allpads-nes.