The Arduino I/O board is becoming the board of choice for building DIY electronics projects cheaply and easily. It’s affordable, it’s flexible, it’s open source (and has a growing community to help you out), and evolving nicely. Naturally, one of the first things we want to do with it is build some cool music electronics projects. Todbot has been doing a terrific series of tutorials for his “Spooky Arduino” class, and in the latest installment, turns to drum triggers and MIDI:

Spooky Arduino Projects #4 – Musical Arduino [todbot blog]
Be sure to check out the full class notes and PDFs; they’r really helpful if you’re getting started with Arduino (in addition to what’s on the Arduino site, of course)

Now, before a bunch of CDM readers chime in, I know we have some true connoisseurs of drum triggers, so let’s assume this is a beginner DIY project rather than a way to make a full-featured drum project. (As such, though, it looks like a great way to get started.)

But what’s also nice here is that the tutorial explains how to use the Arduino as a MIDI interface, with links to further resources. You need physical MIDI DIN connectors, and you need to format your messages properly (remembering that MIDI really is a serial protocol):

… to implement a MIDI interface, all you really need is the ability to send serial data at 31,250 bps. This is easily done with â€Å“Serial.begin(31250)â€Å“. Once that is done, a complete three-byte MIDI note-on message can be sent with three â€Å“Serial.print(val,BYTE)â€Â? commands.

I still like the MIDIsense as a plug-and-play DIY MIDI solution, especially with new Windows software and more I/O on the way. But the Arduino works well for MIDI in situations when boards like the MIDIsense won’t do. (And if you’ve got a few projects going, you might wind up with both on your workbench.)

MIDI Over USB?

Andy Bennett, aka SteamSHIFT wonders if it’s possible to send MIDI messages over USB, as you would with another MIDI device. Certainly, you can send the messages; see the example above. The problem as I see it is that the current Arduino drivers map the board as a serial port, and most music software doesn’t recognize serial device inputs as MIDI devices without additional drivers. It seems like you might have to write a USB MIDI driver for the board. But I’m not sure; I haven’t done anything like this. Anyone with some insight? (Here is the point where I expect someone to correct me on something I said that turns out to be wrong.)

  • Floor_

    Couldn't you theoretically use the Yamaha CBX serial driver with this? Most older Yamaha tone generators such as the QY series have a TO HOST port on them that connects directly to a PC serial port. I suppose if the TO HOST connector sends plain serial data it would be fairly easy to adapt the driver for use with the Arduino board?

    I saw the link to Todbot's project site on makezine earlier today, so I've been drawing up board layouts for a drum trigger box. I'm not sure how many inputs the MIDIsense board has, but with 6 analog inputs and a bunch of digital ins, as well as being dirt cheap to build, the Arduino board should serve my needs well enough.

  • Floor_

    Oops. That giant link was supposed to say "Yamaha CBX serial driver" or some such. As you can tell, I don't leave comments on blogs too often.

  • http://todbot.com/ Tod E. Kurt

    Hi Peter, thanks for the mention.

    You are correct, the current Arduino cannot do MIDI over USB using its built-in USB port because it is using a USB-to-serial chip (it's the FTDI FT232RL if anyone is interested).

    However, it's entirely possible for the microcontroller chip that is the heart of Arduino to do USB directly and to act like a USB MIDI interface if so programmed. The AVR-USB project shows how to do this for USB HID devices (keyboard,mice,etc.). AVR-USB can be reconfigured to act like a USB MIDI interface.

    I've been occasionally working on this very thing, but haven't had much time to focus on it. If anyone else out there is, please speak up.

  • http://jonbro.tk/blog Jonathan Brodsky

    I am currently working on an arduino based music project, and I am using processing's 'serial' library to parse the data into a more digestible format (osc or midi). I initially had the arduino speaking directly to puredata's comport object, but I was having difficulty with the data parsing portion of the project, and decided to shift away from the visual programming metaphore.

    eventually, I would like to get the processing serial->osc sending to one of the monome patches hosted in max/msp

    some pictures are here: http://flickr.com/photos/jonbro/284102154/

  • http://blog.steamshift.com SteamSHIFT

    In the end, I used the Arduino to create MIDI data (so that I could optionally attach a midi out port directly to the Arduino), and then piped the MIDI data over the serial port into a little Processing applet which read the MIDI in and pushed it out as real MIDI data. Does the trick. Means I don't have to carry around a MIDI interface, but could do MIDI out if I wanted to.

  • Pingback: » Blog Archive » Je eigen digitale drumkit bouwen.

  • http://web.mac.com/doug.theriault/iWeb/Site/Home.html doug theriault

    I use Steims Junxion software to convert usb or osc into midi signals. It is the most powerful software to map midi. Highly recommended…

  • Paralelauta

    In linux, a posible solution is configure a serial port as a midi port:

    http://crystal.apana.org.au/ghansper/MidiAxis.htm

  • i+w+z

    Could just use something similar to this (http://www.zzounds.com/item–EMUXMIDI1X1), if the Arduino can output directly to MIDI.

  • http://shiftmore.blogspot.com shiftmore

    I was having a similar issue and decided it was easier to just rip apart a $6 midi-usb converter and embed the whole thing inside my controller.. kind of feels like cheating, but it works like a charm. Plus, the whole thing is powered off the USB as well..

    I wrote about one of the controllers I built that uses this here. I'll put a more in-depth explanation of the midi-usb portion soon..

  • http://shiftmore.blogspot.com shiftmore

    Here's the post about hooking up that cheapo midi-usb converter to an arduino: http://shiftmore.blogspot.com/2010/01/quick-and-d…, in case people are interested.

  • Pingback: Towards an Electronic Music Instrument « Spillikins.com

  • rob

    hi all…is there a way to trigger drums without an expensive module..i have a midi keyboard and an old sr16…

    basically i want to replicate the way a midi key works into pedals to play kick drums…..even if i have to solder to the inside of the keys…

    any ideads ..cheers rob.

  • http://www.groovemonkee.com/ Groove Monkee

    MIDI is a serial protocol that operates at 31,250 bits per second. The Arduino's built-in serial port (all of them on the Mega as well) can send data at that rate.