Introduction: Wireless 4 Player Family Game Controller

About: I write software and do other stuff too.

This is a wireless arcade style controller that 4 people can game on at once. It's wireless so that you don't have to tether your pc to a controller being used by 5 year olds. They fall all the time and I don't want them destroying all my toys when they inevitable trip on a wire.

We recently bought a new computer monitor and it came in a super sturdy box with really dense styrofoam inside. Like something from a sitcom, I was arguing with my wife continually about keeping the box. To me it seemed to be begging to be turned into something whereas to her it was ugly junk. Then, out of the blue, Instructables ran a speed contest based on cardboard. And so in an afternoon the argument was settled and this project was born.

We used odds end ends we had around the house to bring the project to life. The idea was just to use what we already had sitting around to do something cool - luckily we had a set of arcade buttons and a raspberry pi we bought ages ago to make an arcade cabinet. For cutting we used a saw and my trusty old pocket knife.

Supplies

1. Cardboard box
2. Styrofoam or other dense filler
3. Arcade buttons from Ali Express or Amazon
4. Raspberry Pi 3B+
5. Some other computer + screen.
6. Knife or something to cut holes in cardboard
7. Masking tape
8. Spray Paint

Step 1: The Construction

We quickly drew up a sketch of what we wanted the thing to look like, then used a knife and wood saw to cut the cardboard and styrofoam to the right size. We marked up the cardboard with a good button/joystick layout and cut the holes carefully with a knife. This was a great exercise in basic math for the kids.

Once the carboard was cut we painted it and then put all the buttons in place.

The main interesting thing we did was glue three layers of cardboard for the top of the controller to give it more rigidity. This made it somewhat difficult to cut through but worked perfectly for making the top almost as solid as wood.


The Raspberry Pi 3B+ has four usb ports. We have a family of four and 4 sets of arcade buttons! This was predestination.

Step 2: The Programming

The code for this project is simple and buggy. It can all be found here:

https://github.com/melvyniandrag/SuperTuxJunkKart

The 4 controllers are connected via usb to a raspberry pi. On the Raspberry pi, there is a small python script running. I used the Python inputs library to get the signals from the buttons and joysticks. The program then transforms the signal to a short ASCII code and sends it via a TCP socket over wifi to a PC running a game ( I'll refer to this as the game server ). For example, when player 0 moves the joystick left, the characters '0XL' are sent over the TCP socket to the game server.

For testing I ran SuperTuxKart on my thinkpad. A small server application runs on the thinkpad and listens on the TCP socket. The codes that come from the raspberry pi over wifi are translated into button presses on the keyboard via the pyautogui library. So, when player 0 on the cardboard controller moves the joystick left and the controller emits 'OXL', the server running the game thinks the player hit the '1' button on the keyboard. The game must be configured to recognize these keyboard presses as can be shown in the options screen here.

This game runs fine with one or two players, but when 4 people play SuperTuxKart aggressively the server starts missing some data from the controller. I'm not sure if this is an error:

1. On the client ( controller ) side
2. On the server ( thinkpad ) side
3. Built in Linux functionality. Maybe my Ubuntu laptop can't recognize a large number of simultaneous keypresses. So if player 0, 1, and 2 are all steering up and left, that means 2 * 3 = 6 buttons are being pressed at once. I'm not sure if my computer ( or any computer ) is designed to handle that. Usually hot keys are 3 or less buttons e.g. CTRL + ALT + DEL.

In the future I'm going to try starting up 4 tcp sockets, one for each controller, and then on the server side creating a virtual game pad. Haven't had time to see how to do that yet between parenting, working and cutting cardboard boxes up.

Step 3: The Future

This was a simple Proof of Concept. In the future, the code needs to be better. I'd like to code the connection up as a bluetooth HID device, but bluez5 on Linux is a bit of a time sink to work on - that's why I went with a TCP socket + Python.

Also - let's face it - the controller looks like heck. With more time I'd invest a bit more energy into cutting more carefully. Then I'd put more supports -the sides of the box are starting to warp a bit.

For what it is and what it cost though, this thing looks good enough. I'll continue to tinker on it while we watch movies in the evening.

Cardboard Speed Challenge

Participated in the
Cardboard Speed Challenge