Sunday, 13 November 2011

Installing wireless MIDI into the Korg Monotribe

I used the following parts in building this upgrade

XRF Wireless RF Radio UART x 2  at £11.88 each
0.1uf Miniature electrolytic capacitor x 1 at 10p each
FTDI XRF USB interface x 1 at £19.50 each (it comes in a nice box)
XRF break out board x 1 at £2 each
Micro mini JST 2.0 PH 6-pin connector x 1 at 36p each

Total cost is around £46, less if you don't buy a USB programing interface in a nice box.  The connectors came with cables attached and I had to buy 10 at once. This project can be completed for what some people are asking for a single Xbee module on eBay.

What are these XRF modules? they are an amazing little device that enables us to give them serial data and they will transmit it to another module very easily. The plan? to take the serial connection on the Monotribe and plumb it into the module thereby making  a wireless serial link with our PC for sending and receiving MIDI data.

I would recommend you go ahead and install the drivers I mentioned earlier in my blog. Make sure you install the MIDIfied version of the FTDI drivers  Then I shall explain a little about how I used them and set things up on my own PC. Put one of the XRF modules into the programming board and connect to your PC.  Windows will look for a driver, again I recommend following the instructions HERE at Xbee Radios website.

Lets start by programming our modules for the MIDI baud rate etc.  Once done you won't ever need to touch them again, unless that is you want to tweak any settings like alter power output for example.

The XRF module is the small blue square plugged into the green board.  Isn't it a thing of beauty? Plug in a mini USB cable and if you followed the instructions for installing the tweaked FTDI drivers you should have a USB serial port in your device settings. The modules come programmed to run at the standard Windows 9600 Baud rate, we are going to change that.

I'm duplicating some of what is included on the Xbee Radios website, however they used AT commands and I found that a bit of a faff as the module goes to sleep after a few seconds. I would recommend using the excellent XRF Config Manager.

Click search and the software will scan com ports until it finds the module. Then you need to click Download Config. That will load into the manager the settings of your module.
Click the box next to Baud Rate(ATBD) and enter 7A12, this is 31250 in hexadecimal and is the baud rate that MIDI runs at.
Click Upload Config followed by Write Config
Unplug the USB cable and reinsert it, this resets the module.

WARNING this is the single most confusing part the programming because you have to have made sure you had installed the MIDIfied version of the FTDI drivers, otherwise you wont be able to talk to the module anymore.

Open the XRF config software and change the Baud rate to 38400. Thanks to the drivers Windows doesn't know that you are really using 31250 Baud! Click search and it will find your module again.

Notice how although we have set the config software to 38400 Baud the module is actually running at 31250 Baud.

The next part is optional, but I decided to lower the output power from the modules as they can in theory transmit line of sight 3 kilometers! thats a lot more than we need in a studio lol

Click advanced and change Power Level(ATPL) to 0 dbm
This will drop the output considerably and should hopefully prevent your new toy from interfering with other electronics. With the added benefit of using less battery power. If you find that it's not up to the job you can always up the power again. Until you are more confident with what you are doing I would recommend that you leave all the other settings well alone. Click Upload Config followed by Write Config

That's one module done.  In theory it is possible to only program one module and leave the XRF protocol to figure everything out. I would recommend programming both modules as this will prevent putting the wrong one inside the Monotribe and it will in fact not matter as they will both have been set up the same.

You should now have two XRF modules set up at 31250 Baud and are ready to install one of them inside the Monotribe.

You will need for next bit;
XRF breakout board
XRF module(programmed at 31250 baud)
wired Serial connector
0.1uf electrolytic capacitor
some very thin solder, I used 0.7mm
a small wattage soldering iron with a small tip
Philips head screwdriver
side snips
some sellotape
A comfortable and well lit area to work and a bit of patience

Begin by building the breakout board, some come ready built, mine had to be assembled by soldering on the two black strips the pins from the XRF module will go into. If you buy the same cables as me, the following colours match these connections.

Red - DOUT(TX)
White - DIN(RX)
Yellow - 3.3 Volts(3V3)
Orange - Ground(GND)

There is only these four connections needed, so if your cable has different coloured wires or in a different order then make sure you familiarise yourself with how they connect at the Monotribe serial connector.
The serial connector on the left side of the board is a white socket and the pin connections as you look at it are;

1 - N/A
2 - RX
3 - TX
4 - 3.3 Volts
5 - Ground
6 - N/A

Remember that TX on the Monotribe has to go to RX on the XRF module breakout board and likewise RX on the Montribe needs to connect to TX on the breakout board.  To keep this neat I used sidesnips to remove the unneeded wires at the serial connector end.

I found it easiest to secure the small circuit board on a large blob of  blue-tack.  Push the electrolytic capacitors legs into the board in the holes marked 3V3 and GND making sure that the Negative leg is through GND. Bend it slightly forwards. This will stabalise the capacitor and prevent it from flopping about.  Solder the wires one at a time to the corresponding connections.

When finished turn the board over and use side snips to remove and long bits of wire or solder to neaten things up. Thats all there is to do with the board.

Install the XRF module into the pin connections being careful to make sure its the correct way round. You want the ariel end the same as the wires.

This is how it should look.
Now we are going to install the module inside the Monotribe.  Place the 'tribe face down onto a towel or a microfibre cloth to stop it getting scratched or damaged, then remove the rubber feet by teasing them away from the outside edge inwards.  They are only held on by double sided tape and come away quite easily.
Remove the four case screws from the base with the philips head screwdriver.

Turn the Monotribe over with the power button and other connections towards you. Lift the the top case away from you and let it rest on it's side

I have highlighted the power connector, gently tease this out of the socket.

Remove the four silver screws from the power strip .

There is a space to the right of the battery compartment that fit the module and breakout board perfectly.  Install the module there on it's side and run the cable under where the power strip goes.  Secure the power strip again with the four screws being careful not to snag the cable.  Then tape the ariel to the back of the battery compartment, use the following pictures for reference.
Replace the power connector and plug the serial connector from our new cable into the board of the monotribe where it says Serial.

Close the case and replace the screws and rubber feet.  The upgrade is done and hopefully when you turn on your Monotribe it will spring into life giving no hint of what is inside.
If it does nothing at all check that you screwed down the connections on the power strip correctly and everything is plugged in okay.

Lets do a simple test to make sure everything is working as it should be.

Make sure you have the USB programmer with the other XRF module connected to your PC then open XRF Config.  Click the tab for serial monitor and change word wrap to 80 columns.

Switch on your Monotribe and after a second or so you should see stuff filling the screen.  If you do nothing it'll fill up with question marks.  Try running your finger up and down the keyboard on the 'tribe and press play for it to play whatever you have in there. The screen will fill with odd looking ASCII characters.  This is the MIDI data being received as serial data on the PC.

This means that, at least everything is working just fine receiving from the monotribe.  To test sending MIDI data I recommend the serial to MIDI driver by Korg.

As a precaution I changed the output of the USB com port to 38400, the same as we used to connect through the XRF configuration software.

Change the preferences in Windows Audio to use the Korg output for MIDI then load a MIDI file into Windows Media Player and see what happens.
I can guarantee it wont sound pretty, but if your Monotribe makes a noise, it's getting MIDI.

That's everything working, go experiment.  I use the most excellent rtpMIDI to connect my iPad to the Monotribe over a WiFi/wireless link.  Of course, you can use whatever MIDI keyboard you like connected to your PC as long as you route it to the Korg MIDI output connection.