Introduction: Wireless MIDI for Rock Band Keytar
I've had a Rock Band keytar controller on the shelf in my dungeon for a while that I found for a few bucks at a furniture outlet of all places. For some reason, it puts out regular MIDI in addition to being a game controller - just connect a cord from the 5-pin DIN plug to your favorite sound module, synth, or computer and rock out. I like the feel of the keybed, and it's got octave and program change buttons, and the touch slider does pitch bend and modulation (pro tip: cover the entire width of the slider when you touch it). It communicates wirelessly with a Wii, but that's only as a game controller. I have a couple XBees from when I followed Lady Ada's very good MidiBee tutorial back when I started all this soldering nonsense in earnest. I decided to crack open the controller and stick an XBee inside, and put the other into a quick and dirty USB MIDI interface made out of a hacked cheap USB MIDI cable and give myself a wireless MIDI keytar controller to rock out on. What should I call it - Witar? KeyBee? Beetar?
Things you need:
- Rock Band Keytar Controller (mine's for Wii, but PS and XBox ones look similar and probably work too)
- XBee Series 1 (2)
- XBee Adapter (2) - protects XBee from USB's 5V and has good buffering to prevent data loss
- FTDI Cable (1) - for talking to XBees
- USB MIDI Cable - cheaper the better since we're tearing it open
- Optocoupler (1) - 6N138 or equivalent
- Hex inverter (1)
- 220 Ohm resistor (4)
- 470 Ohm resistor (1)
- 1 kOhm resistor (1)
- your fave color LED (1) - because blinkylights
- 5-pin DIN jack (1) - MIDI!
- USB type B jack (1)
- a small project box (1)
- flush trimmers
- rotary tool
- wires, solder, tools, too much free time, etc.
Step 1: Set Up XBees for MIDI
The XBees have to be configured to communicate at 31,250 baud, the standard MIDI communication rate. To do this, you will connect to them using the FTDI cable and a serial terminal program (such as RealTerm on Windows) and send some commands.
Plug each XBee into its adapter shield. Connect one of the XBees to a USB port on your computer using the FTDI cable. Drivers should automatically download and install (on Windows at least). You'll need to figure out which COM port the FTDI cable is using - on Windows this can be accomplished by opening Device Manager and looking in the 'Ports' section for something like a 'USB Serial Device'. Start your terminal program and open this port at 9600 baud, with 8 data bits, no parity, and 1 stop bit (9600 8N1 for crotchety BBS geeks). Type '+++' (without the quotes) quickly and you should get 'OK' as a response. If not, try the other standard baud rates (2400, 38400, 57600, etc.) - the XBee uses 9600 by default but may have been reconfigured to another baud rate.
Type 'AT' followed by [Enter] and receive 'OK' to confirm you are in programming mode. Programming mode ends after a period of inactivity - you can send '+++' to get back into it. Now send the following commands (all programming commands are followed by [Enter]):
- Send 'ATBD 7A12' and get 'OK' to set the baud rate (7A12 in hex = 31250)
- send 'ATBD' and get '7A12' to confirm the right value is set
- send 'ATWR' and get 'OK' to write the value to the XBee
The whole exchange should look something like the image. Do the same for both XBee radios.
Step 2: Hack the Keytar
The plan is to build a MIDI IN circuit as described in the MIDI specification, wire an XBee up to its output, stick it inside the keytar, and run wires from the back of the keytar's MIDI OUT port to the input of our MIDI IN circuit. In this step we'll open up the keytar and splice into some convenient power wires and solder wires onto the back of the MIDI port.
Remove all the screws on the back of the controller's case. There are four that are shorter than the others that screw into the back of the keybed - keep track of these and where they go. Flip the controller over, separate the two halves of the case a tiny bit, then slide the top half forward and around the front of the keys, then tip it back and clamshell the whole thing open as shown in the image.
We'll use the VDD1 and GND lines running to the touch sensor to power our circuit - we can get to them easily without taking the whole controller apart (although check out the teardown in the appendix if you're curious), and there's some free space nearby where we can stick the XBee. I clipped my multimeter probes onto these wires, and they seem to carry a nice, steady 3.3V no matter what I do on the keytar. This might affect the range of the XBee a bit, but since power is provided by 3 AA's (3 × 1.5V = 4.5V max), it's my guess that everything inside the controller runs on a regulated 3.3V so that the voltage stays steady. So, that's probably as good as we'll get, but hey, low power is the new something something.
You can see which lines are +3.3V (VDD1) and GND by reading the silkscreen (see image). Use a razor/knife to slice about a 6cm length of these two free of the plastic ribbon joining the five wires running to the touch sensor PCB. Then snip them in the middle and strip the free ends. Slip a bit of heat shrink onto one of the wires, then solder a new wire to each pair of wires you cut. Slide the heat shrink over the bare wires and shrink it down to keep things from shorting.
Now for the MIDI port. Solder a couple of long wires to pins 4 and 5 (the pins on either side of the middle pin, see image). The wires should be long enough to reach around the top of the keybed and down to where the XBee/MIDI IN circuit is going to sit, just next to the touch sensor. I recommend lots of solder and a hot iron to get a good bond, and then securing the two wires to the PCB just behind the port with a bit of electrician's tape, to reduce strain on the solder joints and keep them from popping free.
Step 3: MIDI IN Circuit
Cut a piece of perfboard down so it will fit into the little space between the screw post and keybed as shown in the image. I usually use a box cutter with a ruler as a straight edge to cut through perf - a few (careful) swipes and I can bend it and get a clean break. Side trimmers or a rotary tool can be used to fine tune the shape. Stick your components in the board (without soldering) and put it in place in the controller to make sure everything fits.
Whack together the circuit shown in the schematic on your perfboard. I always have a crazy difficult time keeping the pins on MIDI ports straight, since they depend on whether you're looking at the front or back of the port, and the things are freaking symmetrical. Refer to the helpfully numbered image if you share my issues.
Once you have everything wired up to power and the MIDI port but before you screw the thing back together, turn on the keytar. The green LED on the XBee should start blinking if you have power. The indicators on the front of the keytar will blink a few times, then one will glow steadily to indicate a device is plugged into the MIDI port, which will now always be the case. If the indicators keep blinking, there's an oops in your circuit. You might want to also power up the other XBee (plugging it back into a USB port with the FTDI cable would work) to make sure you have them both programmed correctly. The red LEDs on both XBees should light up as the midi sense data from the keytar is sent between the two XBees.
I found that my XBee/MIDI IN circuit fit nice and snugly in its spot, and when I tucked the wires in and closed up the case I couldn't get it to rattle by shaking, so I decided friction fitting was fine and to not potentially mess things up permanently by hot gluing the circuit into place or trying to secure it some other way. Results might vary depending on what shape your little circuit ends up being, so test and use your judgement. Once you're satisfied with how your circuit fits in place, close up the controller and replace all the screws.
Step 4: MIDI Receiver and USB Interface
Now we will build a small box housing the other XBee, a MIDI OUT circuit, and a USB interface that we'll cannibalize from a cheap USB-MIDI interface cable. We can plug it into a computer via the USB port and play sounds in a DAW, or power it with a 5V adapter and plug a synth/sampler or sound module into the MIDI port.
There are a lot of cheap (~$6) MIDI to USB interface cables floating around out there that seem to lack some important components on the MIDI side- particularly the optocoupler we used in our MIDI IN circuit. You can see its outline on the silkscreen in the two example images. Who knows why it's not there, maybe they still work sometimes. What does work (and is probably hiding under that black blob) is the class-compliant USB MIDI interface. We just send the serial data coming out of the XBee to this, and when we plug it into a computer it will appear as a MIDI device. We'll also send the serial data to a MIDI OUT circuit so we can send notes to legacy devices on the 5-pin connector - feel free to omit this if you've decided DIN is dead.
Crack open your cheap USB MIDI cable and check out the circuit board inside. Find the silkscreen outline where the optocoupler ought to be, and the pads where the USB cable is soldered on. There should be silkscreen indicating which pads are 5V (red), GND (black), data+ (green), and data- (white). You may have to trust the wire colors if it's not there. Serial MIDI data (TX from the XBee) should go into the pad located where pin 4 of the optocoupler should be - I've circled it in yellow in the images. The pads in mine were big enough that I could drill holes through the PCB and solder header pins in place. This made it easier to fit into perfboard, but might not work if yours is manufactured differently, in which case solder wires directly onto the pads.
Build the circuit shown in the schematic on perfboard. Again, size your board so it fits snugly in the box. As you can see in the images, I had to have the XBee sit on top of the cheap MIDI cable PCB to get things to fit in the box. I used some electrical tape on the bottom of the XBee adapter to make sure nothing shorted. The required arrangement of components made my under-the-board wiring into a bit of a hatchet job, but perfboard doesn't have to be pretty. Attach the LED with flying wires so you can position it to stick out the top of the box. Cut holes in your box for the ports/LED (a rotary tool is very useful for this) and fit everything in. I found that by sizing the board to fit tightly in the box, there was enough support that plugging in cables didn't move the proto board around or stress the solder joints for the ports. The components fit snugly enough that I again didn't see the need to secure it with hot glue or standoffs.
Screw the box together, write "BeeTar" on the side, plug it in to your computer's USB port, fire up Ableton Live or something, plant one foot on the monitors and start rocking out wireless style!
Step 5: Appendix - Madcatz Keytar Controller Teardown
I went a little overboard tearing open the keytar controller to figure out where to attach things. Here are some images of that for those who like to see the inside of things. You weirdos.
We have a be nice policy.
Please be positive and constructive.