This past weekend, I got my Wii Guitar Hero guitar talking to my Arduino prototyping board. There is a decent amount of information on the net on how to accomplish this with the Wii Nunchuk (specifically, here and here) but as far as I could tell, none for the Wii guitar. So, here’s the rundown…
The Wii guitar has the same connector as the Nunchuk, which normally plugs into the Wii Remote during gameplay. Since I have one of Tod Kurt’s awesome little WiiChuck adapters, connecting the Arduino and guitar didn’t require cutting off the guitar’s connector in order to expose the four wires inside. This is good, seeing as how those guitar controllers sell for about $70 and the WiiChuck adapters are $4 apiece, shipped. I also put together a makeshift 3-foot cable to connect the WiiChuck adapter and Arduino by twisting four wires together and soldering a female connection header to the end. This way, I could sit with the guitar in my lap and leave the Arduino/breadboard mess on the table in front of me while testing. Extension cable or not, you’ll need to make sure each of your pins/wires are properly connected. The clock pin on the WiiChuck should go to analog input pin 5 on the Arduino, the WiiChuck’s data pin goes to analog input 4, the power pin goes to the Arduino’s 3.3v power supply, and the ground pin goes to any of the board’s grounds.
The Arduino software comes with the Wire library, which I used to read directly from the guitar controller. The two articles I linked above go into detail about what gets passed back and forth between the two devices, but suffice it to say that everything we are interested in is contained within a 6-byte buffer we will repeatedly request from the guitar. All of the guitar controller’s button state information fits into these 6 bytes as follows (obtained from some fine button-mashing on my part):
Byte 0: Joystick x-axis
Byte 1: Joystick y-axis
Byte 2: Not used (?)
Byte 3: Whammy bar (bits 0-3)
Byte 4: Plus (+) button (bit 2), Minus (-) button (bit 4), Downward strum (bit 6)
Byte 5: Upward strum (bit 0), Yellow button (bit 3), Green button (bit 4), Blue button (bit 5), Red button (bit 6), Orange button (bit 7)
Using this information, I wrote a function library (based off of Windmeadow Labs’ and Tod Kurt’s code) that will allow you to easily get button states and whammy bar/joystick info for use in Arduino sketches. The library is here.
Also, here’s a simple Arduino sketch that demonstrates most of the library’s functionality by toggling/fading LEDs associated with the guitar’s controls.