Playing Spin Rhythm XD with a Modified DJ Hero Controller

A few weeks ago, a friend of mine introduced me to a new rhythm game. Unlike previous titles such as Guitar Hero or Rock Band that use multiple discrete buttons in order to match different notes, this game used a virtual wheel – an analog input to slide, spin, and tap along with the beat. To top it off the game featured an electronic music tracklist and was a blast to play.

The game is called Spin Rhythm XD, and it was designed to be played with a DJ MIDI controller. Having no such professional DJ-ing equipment handy I decided to do the next best thing: convert my old plastic Wii DJ Hero turntable into a controller for Spin Rhythm XD!

(more…)

FrameVis – Video Visualizer and Movie Barcode Generator

FrameVis is a Python script for creating visualizations from video frames, also known as “movie barcodes” due to their vertical striping. The script uses the OpenCV library to read from a video file, load frames into memory, and then stack them together to make a new image visualizing the entire film. The resulting visualizations are as fascinating as they are beautiful… you can see the flow of the color grading, the pacing of the editing, and if you know the film well enough you can even pick out certain scenes or even shots.

This script works on Windows, Mac, and Linux and is compatible with all OpenCV file types and codecs. You can download it on GitHub.

(more…)

How to Emulate an Xbox Controller with Arduino (XInput)

In my opinion, one of the more novel things you can do with an Arduino is put it to use as a custom game controller for your favorite games. Whether you’re retrofitting a Nerf gun, converting a rhythm controller to play an FPS game, or playing PUBG with a frying pan – using an Arduino makes it quick and easy to build your own custom controller.

In this tutorial, I’m going to show you how to program your own Arduino to emulate an Xbox controller using the ArduinoXInput library.

(more…)

Arduino XInput Library

Recently I’ve been playing around with building various alternative controller projects for games, typically using an Arduino-compatible microcontroller acting as an HID input device of some sort. The Arduino ecosystem makes it easy to set up these projects to act as either a Keyboard, a Mouse, a DirectInput Joystick, or a composite device that’s a combination of the above. Unfortunately back in 2005 DirectInput was supplanted by XInput with the release of the Xbox 360 controllers, and modern games have been weaning off of it ever since.

These days, many mainstream games barely support DirectInput at all. Games like Rocket League and Overwatch won’t even recognize a DirectInput joystick – you have to use XInput controller emulation software that can be tricky to set up and doesn’t work with every game.

Wouldn’t it be great if there was a simple, turnkey way to make your Arduino emulate an Xbox controller and work out of the box with these newer games?

(more…)

Understanding the Xbox 360 Wired Controller’s USB Data

One of my recent projects has been trying to modify some microcontrollers to function as XInput devices, emulating an Xbox controller. The first step in this process is to fetch and then break down the device’s “USB descriptors”. These descriptors are a hierarchy of standardized reports that describe features of the device including who makes it, what version of USB it supports, how it’s powered, and more. By copying the Xbox controller’s descriptors onto my own device, I can convince the computer that my device is also an Xbox controller and will behave like one, and therefore use the Xbox controller’s driver to easily interface with games.

But rather than just copying and pasting the descriptor from one place to another, I want to try and understand exactly what’s going on behind the scenes. I want to understand how the information in these descriptors translates into features of the device’s behavior.

(more…)

Experiment: Wii Nunchuk Controller for CS:GO

Earlier this week I was browsing Reddit and came across this interesting post of someone playing a game of Counter-Strike: Global Offensive (CS:GO) using a Wii Nunchuk to aim. They used a cheap Chinese “Classic Controller to USB” adapter to connect the Nunchuk to their PC, then set up JoyToKey to convert the gamepad inputs into mouse movements.

This was pretty interesting, but I thought I could do one better. You see, I’m currently working on my own project that uses two Nunchuks for a custom controller. So when I ran across that Reddit post, I already had a breadboard on my desk with a Teensy LC, two NXC breakout boards, and two Wii Nunchuks wired and ready to go. Destiny was calling…

(more…)

HID Buttons Library for Arduino

As I keep working on a number of custom controllers using Arduino boards, I noticed that I tended to build the same sort of data structures every time; things to make it easier to write my own code using the built-in Arduino libraries. One of these bits I kept rebuilding was a wrapper class for the keyboard and mouse libraries that kept track of the keys I was using and their associated output states so that I could set them with a single line of code. Now instead of building yet another version of the same thing for my next project, I decided to turn it into a library instead.
(more…)

DIY Media Key Footswitch for PC

I spend a fair amount of time down in my garage working on things, and while I’m doing that I like to listen to music. I set up an old computer that runs Spotify and sends the audio to a pair of bookshelf speakers. This setup works great, but it requires using a keyboard and mouse to control it. Often times my hands will be gloved and coated with something nasty: grease, epoxy resin, paint, you name it. So I wanted to come up with some sort of method to control my music when my hands were unavailable.

This is what I came up with: a two button footswitch controller that connects with USB and handles play / pause, next track, previous track, and volume.
(more…)