[MSF] FightStick (TeensyLC XINPUT Controller)

Introduction to the Project

The idea for this project came up when discussing the release of Mortal Kombat X. The guys at Mechanical Squid Factory (our gaming group) decided they wanted to branch out into the competitive fighting game scene. We started doing research into fighting games and that brought us to a forum called Shoryuken. The realization that a regular gamepad might not provide the best experience quickly set in. We decided that a fight stick would be just too expensive and thought keyboard would work out. The entire team played through the story of MKX and thought our fingers would never function again after contorting them to the keyboard. Soon enough we couldn’t take it anymore and pieced together fight sticks. Most of our parts were ordered from FocusAttack and the cases from Art at Tek-Innovations. As you can tell, the cases are laser cut by Art and they do have a 2 week turn around time. However, they really are beautiful when assembled. We then opted for a DIY solution to a controller board. This could save us $40-$50 since we only planned on using these on the PC anyways.

I began scouring through development boards. I had to meet just a few criteria but they were strict. I needed it to be small, support USB, and most of all, be CHEAP. Many of the boards just didn’t provide enough cost benefit over an existing solution. Finally I found an awesome little ARM cortex development board called the TeensyLC. It met all the criteria with flying colors and it had an ARM on it, which was an awesome bonus. What I did not know is the frustration that would follow after receiving these boards. There was nothing wrong with the TeensyLC, it was the bundling with arduino that caused most of the headaches. I am strong in my hate against arduino. I feel that it definitely has a place, but it has recently crept into places it does not belong. In the beginning, however, the arduino integration was actually a plus. I needed a joystick that plugged into a PC. It is pretty common for a device to have a HID joystick example if it supports HID USB. I went ahead and ordered 3 of them for the group.

What happened next is what I guess you could call scope creep. The project was finished and it was working great. Standard HID USB Joystick and it showed up with our name on it. Then someone uses it in a portion of the game that doesn’t just use the DPAD. Shouldn’t be an issue right? Wrong! The character continued to just look up constantly. I tried adding extra axes and setting them to center to fix it. I even tried changing all the bit lengths for the axes to the same that the XBOX uses, but nothing would work. We then started loading up other joystick games and realizing that most of them just didn’t work or if they did, you just constantly looked up or spun in a specific direction. With a little bit of google-fu I quickly learned that I had created a joystick compatible with Dinput and that was no longer a thing unfortunately. The industry was all about Xinput, which is a real bummer for hobbyist. That’s when the scope expanded and my struggles with adjusting my work flow to the Arduino IDE began.

I just wanted to say thanks for this. I took the plastic shell of an old Mayflash Arcade Stick, replaced the buttons and joystick with Sanwas, and wired it up with a TeensyLC exactly to your guidelines. It worked perfectly the first try.

I am not a USB driver guy, I followed along with the code but could never replicate it. That said, I would be very interested if you wind up adding PS3/4 support or external LED support. The start and select button buttons I purchased have LED lights in them already, but I haven’t hooked them up yet. I was going to wire them directly to 3.3V, but didn’t know what effect that would have sharing ground with the buttons. Do you know if that would be an issue?

You will be alright sharing the ground with the buttons. You should look into trying to find a datasheet on the LEDs in the buttons though. Or at least look at average values for the color LED they are. Even if they have a forward voltage of 3.3v you should still put in some sort of current limiting resistor. I think the teensylc caps at like 25mA.

I am really glad you enjoyed the project though! I would love to add PS3 support, but if it ever comes it will have to be way down the road and probably won’t work with the teensy.

Hey there! I’m wondering which version of the Arduino IDEs you did this project with. I’ve taken your GitHub stuff and tried to use it, but I had to do some weird stuff to get it to compile, and once it’s loaded, it causes Windows 10 to bluescreen in a spectacular fashion.