Floor Mat Game Controller

Written by: admin@makezilla

Picture of Floor Mat Game Controller


This project details the creation of a game controller floor mat that can be used in place of a four switch joy stick. The floor mat controller lets the user control the game play by stepping on switches to control the direction that would otherwise be determined by a joystick.

While the instructions presented here focus on the creation of a mat for use with a classic Atari 2600 game system, the approach described here could be applied to other game systems, depending on the construction of the joystick or other controllers that they use.

Step 1: Operation of a Common Four Switch Joystick

Picture of Operation of a Common Four Switch JoystickFire_Button_01.JPG

The simple joystick for the Atari 2600 system consists of only 4 normally open SPST (single pole, single throw) push button switches. The stick will cause one or more of them to be pressed, depending on which direction it is moved.

Internally, all the switches share one common connection, which is usually the PCB ground of the game system. The other terminal of each switch is a separate connection in the wiring of the joystick. Internal to the game system console, the input lines from the joystick connect via a resistor to a positive voltage. The voltage on each of the lines is at a logic high state when the switch is not pressed. When it is pressed, the line is shorted to ground and reads as a logic low. This level is input to a microprocessor or other logic in the game system console, which then responds accordingly.

The four switches correspond to the up, down, left, and right directions. To move in a diagonal fashion, two switches are closed. For example, to move diagonally up and to the right, the up and right switches are closed. The wiring of the joystick switches are shown in the diagram.

This simple interface can also be found in other game systems. The connector used on the joysticks for the Atari 2600 system are 9 pin female D-sub connectors, as shown in the picture. If any of the circuits described are to be used with another game system or application, the user will need to determine the proper connector pin out for that system.

The pinout for the D-sub connector on the Atari 2600 joystick is:

8=COMMON (game system ground)

The red “fire” button is also a momentary switch to ground. The “fire” button is not controlled by the floor mat, as that would be too cumbersome for game play. The fire button is instead controlled by a push button switch held by the user. I assembled a “wand” with a pushbutton that the user can hold for the fire button. In this setup, the fire button is just directly connected to pin 6 and pin 8 of the 9 pin D-sub connector.

Step 2: Problems encountered when using a four switch arrangement on the floor mat

Picture of Problems encountered when using a four switch arrangement on the floor mat

If you set up the floor mat controller with only 4 switches in the same arrangement as that of the joystick, then the user will have to step on two switches at a time to move in one of the diagonal directions. When you are using a joystick, the two buttons are pressed automatically, and the user doesn’t have to give it any additional thought. But with only 4 switches on the floor, this becomes cumbersome when the user wants to move in a diagonal direction.

One way to improve upon this limitation of the four switch approach is to use eight switches, with one switch for each of the 8 directions. Now each of the 8 possible directions can be selected by pressing on a single switch.

Implementing an Eight Switch Controller

An eight switch implementation can be made as shown in the diagram. The eight switch approach adds four more switches to the existing four, one for each of the diagonal directions. As mentioned earlier, to move in a diagonal manner, two switches are closed. For example, to move up and to the right, the up and right switches are closed at the same time. So, each of the additional switches for the four diagonal directions must pull the corresponding two lines low.

To isolate the extra four switches from the existing four, diodes must be used as shown in the diagram to connect to the four wires of the joystick interface. With this arrangement, moving diagonally can be accomplished in the normal way using two switches, or by pressing a diagonal switch.

Step 3: Optional: Microprocessor Circuit

I observed that one game system I have that uses a four switch joystick would simply lock up and do nothing while an invalid combination of switches was pressed. For example, if both the left and right switches were pressed simultaneously, the game would respond as if none of the switches were pressed. This caused a pause in the response of the game if you stepped on an invalid combination while playing.

This situation is not physically possible with the normal joystick, as it can’t moved into two opposite directions at once. But with the mat controller, as user can press any combination of two switches with their feet, including the invalid combinations.

To eliminate the problems cause by possible invalid switch input states, a microprocessor circuit can be used. The purpose of the microprocessor circuit is to read the switches, and determine if the state is a valid state or not. If the state is valid, the microprocessor essentially drives its outputs to send that state on to the game system unchanged. If the state of the switches is determined to be invalid, the microprocessor keeps its outputs in the previous valid state. With this approach, the game play will not be interrupted if the user steps on an invalid combination of switches. The microprocessor will not allow an invalid state to be output, regardless of the state of the inputs.

Step 4: Optional:Detailed Description of the Microprocessor Circuit

Picture of Optional:Detailed Description of the Microprocessor Circuit

Circuit Description

The schematic for the microprocessor based approach is shown below.

Microprocessor and Switch Inputs
U1 is the microprocessor. It performs the conversion from the 8 switch input to the four switch output. It also filters out invalid switch inputs. When an invalid switch input is read by the processor, the 4 outputs retain their last valid state. C1 is a decoupling capacitor for U1.

Resistors R1-R8 pull the eight inputs to the microprocessor up to +5 volts when the switches are not being pressed. The switch inputs are processed by a PIC microcontroller, to address the issue of invalid switch combinations being rejected by the game, and to convert the 8 switch setup into an output that can drive a game with a four switch interface. The microcontroller reads the 8 switches, and generates four outputs to mimic the 4 switch interface. If the 8 inputs are an invalid switch combination, then the microprocessor outputs the last valid pattern.

Note that since the microprocessor reads each of the eight switches on a separate line, it is not necessary to use the isolation diodes that are required for the passive implementation described earlier.

The PIC circuit and software can be used with a four switch arrangement also. The inputs to the processor which connect to the four unused diagonal direction switches must still be pulled high to VDD,  to keep the inputs held high so that they are not read by the processor as an invalid switch input.

Game System Interface and Optical Isolation
To ensure that the game system would never be damaged by the processor circuit, the two circuits are electrically isolated from one another. To electrically isolate the PIC circuit from the gaming system, a four channel optoisolator is used between the microprocessor outputs and the game system console inputs. Each of the optical isolator channels has an LED on the input side. This LED is turned on by the outputs of the microprocessor. The outputs of each of the optical isolators (on the game system side), are NPN transistors. The emitters of all the transistors are connected together, and connected to game system ground. The collectors of each transistor are connected to its corresponding line on the game system. When the processor drives a line high, it turns on the LED on the one side of the isolator, and the corresponding transistor on the game system side is turned on, pulling that line on the game system low. This mimics the action of the joystick, where the closed switch pulls the game system input line low.

R9-R12 are used to limit the current from the microprocessor outputs driving the IR LEDs inside the optoisolator. OPTO1 is a 4 channel optoisolator, with NPN transistor outputs. The collector of each output transistor is connected to one of the 4 inputs on the game controller. The emitters of the output transistors are all tied together and connected to the game system ground.

Power Input and Regulator
D1 protects the circuit from damage if the power supply is connected with the wrong polarity.  C2 and C3 are filtering on the input to voltage regulator VR1.  VR1 is a +5 volt regulator. C4 is a filter capacitor on the output of VR1.  J2 is where the power supply is connected,  A DC input of at least 8 volts must be applied here.

On the Atari 2600 system, the four direction switches are connected to pins 1, 2, 3, and 4 of a 9 pin D-sub connector. Pin 8 on the D-sub is the game system ground. Pin 6 is where the “fire” button is connected. The single “fire” button used on the Atari 2600 game system is not controlled by the floor mat, as that would be too cumbersome for game play. The fire button is instead controlled by a push button switch held by the user. In this setup, the fire button is just directly connected to pin 6 and pin 8, as it does not need to be input to the processor.


The source code and assembled *.hex file for programming the PIC microprocessor are attached here if you want to use this approach.




Step 5: Construction of the Mat Switches

Picture of Construction of the Mat SwitchesSwitch_Stackup2.gifSwitch_Stackup1.gif

The mat controller will use normally open pushbutton switches, designed to operate via the user stepping on them. They need to be reliable and rugged, to withstand vigorous game play.

I have seen mat switches made from aluminum foil and cardboard. While this will certainly work, the builders have reported challenges in attaching the foil and keeping it from becoming wrinkled with use, resulting in a switch that sticks closed.

For the switches in this design, aluminum roof flashing is used as the metal contacts. This material is relatively inexpensive, and can be purchased at most hardware stores. The material is typically sold as a long sheet (about 0.008” thick) that is rolled up. It can easily be cut by scoring with a utility knife, by laying a straight edge along the line to cut. It can also be cut with heavy duty scissors.
The switches consist of an upper and a lower contact assembly. Each of the contact assemblies are constructed using 1/16” thick polyethylene sheets and aluminum as shown in the diagrams. A metal contact made of roof flashing is attached to each of the two polyethylene sheets. I found that double- sided carpet tape worked well for attaching the aluminum to the poly sheet. It is important that the aluminum be securely attached to the poly sheet, so that it doesn’t come loose and hang down, contacting the aluminum plate on the other switch contact assembly.

Around the base plate a border is created using a non conductive material like cardboard or plastic. This material serves to separate the two plates so that they do not touch when no pressure is present. The material should be only about 1/16” to 1/8” thick, as the upper plate must be able to flex down to contact the lower plate without requiring the user to apply excessive force.
The upper contact assembly is constructed similarly to the base, again securing the aluminum to the non conductive backing with double faced tape. The backing material, be it polyethylene, particle board, or whatever, must be flexible enough to allow the plate to flex down when stepped on, and then flex up when the pressure is removed. So, a rigid material will not work well for the upper plate backing.

The upper contact is assembled on top of the lower contact, with the spacer material in between. Refer to the diagram showing how the layers stack up. Lastly, the whole assembly is held together by wrapping tape around it in both directions. The completed switch assembly is shown in one of the pictures below.

Note that each of the metal contacts has a small tab which protrudes outside of the polyethylene sheets. This tab is used for making connection to the wire leads. The leads cannot be soldered to the tabs, as aluminum cannot be soldered to. To make a reliable electrical connection, I stripped a few inches of the wire, and taped the stripped portion down to the connection tabs on each of the plates. The idea behind stripping a longer length of wire is to provide more surface area of the wire in contact with the aluminum plate.

Step 6: Assembling the Game Controller Mat

Picture of Assembling the Game Controller Mat

The switches are arranged underneath the mat as shown in the diagram. A 36 inch by 48 inch floor mat was used to cover the switches. Each switch is held in place to the underside of the floor mat using duct tape.

The picture shows the actual mat, with arrows indicating the location of each switch.

If the mat is going to be moved often for storage or other reasons, then a more robust assembly may be required.  If the switches are simply taped to the underside of the mat as described above, then they may work loose and fall off if the mat is picked up and turned over.  A more robust construction would be to place a sheet of rigid material like plywood or heavy cardboard beneath the switches, and then attach the switches to that.

Step 7: Use with other Game Systems and Applications

Picture of Use with other Game Systems and Applicationsmatrix switches.gif

If you were to disassemble many game system controllers, you would find that the portion that controls the direction of motion is really just four switches, actuated via the round pad which is moved by the users thumb. The switches themselves may be surface mounted onto the game controller PCB, or they may be traces on the PCB which are shorted together via a conductive material that sometimes resembles a small piece of black rubber.

Any system that uses a 4 switch up-down-left-right arrangement as described earlier could potentially be modified to use this type of mat controller. The exact implementation and wiring required will depend on how the particular controller is designed.

The picture below shows a self contained game controller that includes four classic arcade games. This device attaches to audio and video inputs of your TV, and all the game circuitry is contained in the base of the unit. This system uses a four button joystick, with the switches sharing a common ground, just like the Atari 2600 system. I added an external 9 pin D-sub connector that breaks out the internal switch connections, so that I can play the game as-is or connect an external controller like the mat controller or a standard Atari joy stick.

Use with Game Systems Where the Switches are Connected as a Matrix

As described earlier, the Atari system joystick has each of the four switches was connected to a separate game system console input and to a common ground. However, modern game system controllers may likely use a matrix type of configuration for reading the switches. In this type of arrangement, there are inputs to the microprocessor or logic circuitry inside the controller which are configured as a matrix. The inputs correspond to rows and columns of a matrix. Each switch shorts together one of the row inputs and one of the column inputs when it is pressed.  The diagram below shows an example of switches arranged in a matrix.

The advantage of using a matrix arrangement comes when there are many switches to be read, as each switch does not have its own individual I/O line, as it is with the 4 switch interface. For example, to read 16 switches in a matrix configuration would require only 8 I/O lines, four for the rows and four for the columns. If each switch had its own I/O line, then 16 I/O lines would be required.

To interface a switch mat to a system has the switches arranged in a matrix, a controller will have to be modified so as to bring the row and column connections out so that they can be connected to the switches in the mat. In the diagram below, the red lines show  where to connect wires to allow an external switch to be used in place of the normal switch in the matrix arrangement.  The external switch is essentially in parallel with the existing switche.

 If wires can carefully be soldered to the row and column connections on the normal controller PCB and brought outside the controller housing to a separate connector, then the controller can continue to be used as normal. The switch mat would then connect to the PCB inside the controller via the new connector. Note that none of the switches in a matrix configuration connects to a common ground, as they did on the Atari 2600 interface.

Some PC based games use the up, down, left, and right switches of the keyboard to control the movement in the game. Keyboards for PCs read the keys via a matrix arrangement, which is read by circuitry inside the keyboard which in turn communicates back to the PC via the PS2 or USB connection.

It is common for people who build their own arcade cabinets to modify a keyboard to interface to a four button joystick, by connecting the four joystick switches across the appropriate row and column connections on the keyboard PCB. This allows the keyboard to be plugged into the PC, and the PC then recognizes it just like any other keyboard. This type of modification is often called the “keyboard hack” among those who build their own arcade cabinets from scratch. The same principles would apply if you wanted to control any keyboard input via a switch mat or other external switches.

Step 8: Use, and Effects on Game Play

Using the mat controller instead of the joystick takes some getting used to. Users may find it to be unsuitable for some games.

It takes some time to get used to coordinating your feet to control the movements. While I can’t say that this would ever replace the good old standard joystick, it could provide a way to bring new life and enjoyment to some old games.

At the very least, it can get you off the couch and burn some more calories when playing your games.