ERU2 – Winter 2015: Jamie’s Results

By Jamie Beverly

For my ERU2 project, I proposed to program an Arduino uno to be recognized as a MIDI device by my computer and other musical software. I soon learned that this required more than just a new Arduino library, for the Arduino to be recognized as a MIDI device required me to flash a different firmware onto the Arduino’s atmega16u2 chip. The majority of my time spent on this project was spent trying to achieve this. I encountered several difficulties trying to understand what was required to flash new firmware to the Arduino, but eventually developed a sequence of steps:
1) Put the Arduino into DFU-mode by connecting two pins on the Aruduino board.
2) In terminal, with the Arduino connected, issue the Mac Ports command:
sudo dfu-porgrammer atmega16u2 erase
(then enter your computer’s password)
3) Navigate to the directory in your computer that contains the .hex file of MIDI firmware and enter:
sudo dfu-programmer atmega16u2 flash (insert name of firmware hex file)
and then
sudo dfu-programmer atmega16u2 reset
4) Unplug and replug-in the Arduino
And the new firmware should be flashed on!
The Arduino must have the default usb-serial firmware flashed to be able to load sketches, so these four sequences were repeated twice every time the sketch was changed.
Since my last blog post, I’ve primarily been focusing on using the Arduino as a MIDI device in other software. My first test was with SuperCollider, I wrote a simple program that would print the contents of any received MIDI messages, and it worked!
My next test was what I was really excited for, using the Arduino in Serato DJ. However, I soon realized that Serato software (and most other DJ software) only enables certain certified devices to be recognize. I suspect this is because Serato is partnered with companies like Pioneer, which manufacture the hardware that works with their software, and both Serato and Pioneer are in competition with other DJ companies like Native Instruments. So unfortunately I am unable to use the Arduino with Serato.
I still wanted to see if I could get the Arduino to work with other mainstream musical software, so I opened Garageband, and the Arduino instantly started ‘jamming out’ on a hip-hop drum layer I had in the project I opened (I had a very annoying loop sending random MIDI note on messages in my Arduino sketch when I opened up garage band).
My next step was to make some minor tweaks to the sketch and revisit how I could control a synthesizer in SuperCollider with it. I settled for a rather simple design, controlling a frequency-modulo synth with two potentiometers, two push buttons, and a bootleg switch (really just connecting and disconnecting a wire from the bread board).
In retrospect, some of the problems encountered with this project could have been avoided had I done more research before I proposed it. For instance, I could have saved some time trying to figure out how to flash new firmware to the Arduino had I started with the basics of how to update the Arduino’s current firmware. Another problem that probably prolonged the time it took to build the project was the fact that every time I wanted to upload a new sketch, and then test it out, I had to flash the usb-serial firmware, and upload the sketch, and then flash the MIDI firmware back on to test it. This tedious process could have been limited if I was more careful writing my sketches, and relied less on ‘trial and error’ testing code.
So I was able to get the Arduino to function as a real MIDI device and be recognized by commercial music software! I unfortunately couldn’t get it to work with DJ software due to problems with licensing. And I haven’t fully explored potential uses within Garageband or other DAWs, but my current working sketch and breadboard interface work well with SuperCollider, and its nice not to have to rely on any serial-MIDI conversion software!
Posted in Blog, Electronics for the Rest of Us! Tagged with:

Leave a Reply

Your email address will not be published. Required fields are marked *