Mapping Out a Guitar Controller

An image of a guitar-shaped game controller
Image of a guitar-shaped game controller.

The Rock Band guitar-controller is a form of Human Interface Device (HID). Many USB game controllers follow an HID-compliant standard. This standard allows us to read digital and analog inputs easily from any program.

My past work with this guitar-shaped controller was back in 2014 when I drove a robot around using the buttons on this controller.

I mapped out the indices associated with each input before programming a robot to be controlled by this guitar-controller. I’ve written a small Python program that can connect to a controller and display the state of all inputs. Pressing a button on any connected USB controller changes the state of the corresponding index in this program. Likewise with analog inputs.

It’s a simple program that consists of setting up the gui and checking each input ~30 times a seconds. Link to the source repository.

Gif of program used to detect inputs.

The controls on this guitar-controller are as follows:

Digital Inputs

Digital index 0: Upper Blue Button

Digital index 1: Upper Green Button

Digital index 2: Upper Red Button

Digital index 3: Upper Yellow Button

Digital index 4: Upper Orange Button

Digital index 5: Tilt (Detailed Below)

Digital index 6: Lower Neck Modifier (Detailed Below)

Digital index 7: Unused

Digital index 8: Minus Button

Digital index 9: Plus Button

Digital index 10: Unused

Digital index 11: Unused

Digital index 12: Connection Button

Analog Inputs

Analog index 0: Unused

Analog index 1: Unused

Analog index 2: Whammy Bar

Analog index 3: Effects Switch

Hat Inputs

Hat index 0: D-pad & Strumming (Detailed Below)

Image of guitar buttons.
Image of guitar body.

Interesting Notes

The neck of the guitar features two sets of colored buttons. The buttons higher up on the neck trigger one digital input each.

The set of colored buttons lower down on the neck, when pressed, will trigger both the digital index triggered by the corresponding button higher on the neck and the Lower Neck Modifier digital input.

Image or lower buttons.
Image of upper buttons.

Pressing the upper green button would trigger digital input index 1. Pressing the lower green button would trigger digital input index 1 and index 6 at the same time.

Pressing the upper red button triggers digital input index 2 and pressing the lower red button triggers index 2 and index 6

The strumming of the guitar was detected by two digital hall effect sensors and communicated through hat input index 0. This input is shared with the d-pad, meaning that with this controller we cannot differentiate between strumming and some input states of the d-pad.

I first suspected an issue with the components within the controller, but saw no issue when I unscrewed it and looked inside. The controller board had its inputs labeled nicely, and tracing the wires showed no problem.

Image of guitar electronics.

I have since done some searching online and found claims from other users that the strumming is paired with the d-pad on some models of this controller, so this appears to be intentional.

The guitar controller has a sensor that detects when it’s tilted, and the game goes into Overdrive Mode. Whenever I’ve worked with angular sensors, I’m always working with a sensor that returns analog values based on the pitch/yaw/roll of the sensor, so I was surprised when I saw that a digital input was triggered when tilting the guitar as if to enter Overdrive Mode.

By opening up the guitar I can see a digital tilt switch wired to the board, labeled tilt.

Image of tilt-switch.

The guitar needs to sense when to enter Overdrive Mode. The guitar does not need to sense the numeric angle of tilt at any time. This means that an easier to implement digital switch gives us the sensing we need.

Note: The index for each button/axis may vary. If using a guitar-controller for your own purposes, do not assume these indices are the same on your controller.

My controller was made for the Nintendo Wii. A programmer I worked with brought in an almost identical guitar-controller that was made for a Sony PlayStation game system which used different indices.

Similar methods for mapping out controllers can be used with other controllers. During my time as a volunteer robotics mentor, I helped students program a robot to be controlled by a dance pad.

I worked on this controller at the same time as I worked on a robotics team.

Kim is a self-taught programmer in the Minnesota area. Kim currently works as a full-stack developer while working on various crafts. Kim always has time to make a couple of loaves of bread.