Midignusbuino
The Midignusbuino is a plug-n-play USB-MIDI device that can be used to build MIDI controllers. Most operating systems have built in MIDI support, so no drivers are needed, and almost any music software understands MIDI… It is built on the Gnusbuino platform, is more or less compatible with the Arduino environment and can be programmed through the Arduino IDE
Building / Installing
Hardware schematics and source code are in the SV repository at http://gnusb.svn.sourceforge.net/viewvc/gnusb/branches/gnusbuino/
You can either download the two folders and add their contents to the corresponding folders in your Arduino working directory, or you can pull the latest version directly through svn.
- cd "the/path/to/Arduino/" (for me on a Mac it is cd ~/Users/me/Documents/Arduino) - svn co https://gnusb.svn.sourceforge.net/svnroot/gnusb/branches/gnusbuino/hardware - svn co https://gnusb.svn.sourceforge.net/svnroot/gnusb/branches/gnusbuino/libraries
later on, you can always update to the latest version by typing
- svn update
Some notes on etching and building the circuit
PCB layout and Eagle files are in harware/gnusbuino/pcb/
- USB resistors should be 68 Ohms and 1k6 Ohms, the other resistor values are not critical
- Zeners should be 3.3-3.6V
- Electrolytic capacitor max 10uF (as per USB spec)
Burning the bootloader
The Gnusbuino board does not have a SPI interface connector (as you'd only need it once for burning the bootloader - afterwards you can program it directly over USB). So it is a good idea to burn the bootloader BEFORE you solder the chip on. Reopen the Arduino Application and you should see the Midignusbuino in the board menu:
Use your favorite AVR programmer and chose "Burn Bootloader" from the Tools menu. I normally use a Gnusb-Prog, a modified gnusb to flash AVR chips, see here: http://www.anyma.ch/blogs/research/2011/08/19/gnusb-procreation/
Programming the Midignusbuino
Plug in the Midignusbuino and press the reset button. The yellow LED lights up, indicating that we are in bootloader mode. When the Gnusbuino is in bootloader mode, it will call itself "USBasp" in the USB devices list. In fact, the bootloader mimics the popular USBasp AVR programmer, but it does not program another chip but itself… Because of this, you don't have to chose a serial interface in the Tools menu
Write your Arduino sketch and hit upload as with any normal Arduino. When the upload is finished, both LEDs light up for a short time, then the yellow led goes out and the green one stays on. This means the Gnusbuino has successfully enumerated as a standard MIDI-USB device and is ready to use. On the Mac, you can use the "System Profiler" application (in /Application/Utilities/ ) to check if the gnusb is really there:
The MIDI library
The Midignusbuino comes with a small library (aptly called MIDI) to help building MIDI controllers and interfaces.
Please note that this library will not work on other Arduinos - it s tightly integrated with the Gnusbuino core to communicate through the V-USB virtual USB driver (though with some tweaks it could maybe be made to allow for standard old-school MIDI on DIN jacks through the serial interface on Arduinos…)
You have to include this library at the top of your sketch to be able to use it
- #include "MIDI.h"
Main functions of the MIDI class (library)
MIDI.write()
MIDI.write(command,key,value);
Sends a MIDI Message back to the host computer. Does not return anything.
MIDI.read()
result = MIDI.read(&MidiMessage)
Receives MIDI data from host computer and puts it into the variable MidiMessage Returns 1 if there is new data or 0 if no MIDI data is present.
Examples
The library includes various examples to help getting started with sending/receiving MIDI over USB. You can access these examples through the File->Examples menu: