Go Down

Topic: USB MIDI driver working for UNO. Turn your UNO into a MIDI device. (Read 3 times) previous topic - next topic

dhunt

I've got a USB MIDI device driver working for the UNO's atmega8u2.  Just flash it onto the atmega8u2 using dfu-programmer or flip and your UNO becomes a USB MIDI device.  I've tested it with GarageBand and it seems to be working well.

Details, firmware hex files, source, and an example sketch are available from http://hunt.net.nz/users/darran/.

Cheers,
Darran.

robtillaart

You are doing great work here. Can I do this with the normal IDE to or do I need special tools (I'm on win 7 )

Do you also intend to implement an USB printer? 
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

WilliamK Govinda

That's great news, thank you so much, check my sig for the project I'm working on.  :smiley-mr-green:

Wk

dhunt

Wow that's an awesome project!  Looks like you're close to having the first PCB-based version up and running.  Really impressive.

dhunt


You are doing great work here. Can I do this with the normal IDE to or do I need special tools (I'm on win 7 )

Do you also intend to implement an USB printer? 



You should be able to use flip to load the firmware in windows: http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3886
You'll need to put the UNO into DFU mode and then use flip.  You can put it into DFU mode just by connecting two wires as seen here: http://arduino.cc/forum/index.php/topic,52447.msg374201.html#msg374201; hold wire 1 on the pad, touch wire 2 to the left side of the capacitor for a second or so, remove wire 2, remove wire 1 and the UNO will be in DFU mode ready to upload new firmware. Unplug the USB cable and plug it back in and the UNO will appear as a MIDI device. Note that you can't load sketches when the MIDI firmware is loaded, you have to go through the process again and upload Arduino-usbserial.hex before loading you sketch with the Arduino IDE.

Regarding a USB printer driver, I have a feeling that the firmware would be too large for the 4KB of flash space that's available on the atmega8u2.  I'm curious as to what you would do with your Arduino if it could be a printer device?

dhunt

I've updated the MIDI driver to be bi-directional so now it can also receive MIDI messages from the host.  The new firmware, source, and demo sketch is available from Arduino hacking.

lobj10



What Im doing wrong? 

Scenario 1: If I use arduinos MIDI lib , I get "pitchbend" 8/16 - 16/16 as a result in ableton
Scenario 2: if I dont use MIDI lib I get "CC notes" from 1-127 i ableton

(If I have any HEX outside "0xB0 - 0xBF" neither of scenerios works)






#include <usbDevices.h>

#define numPots 6  // numer of pots
#define b 1        // this is the delta needed in

unsigned int currentPot[6] = {0,0,0,0,0,0};   
unsigned int pot[6] = {0,0,0,0,0,0};
byte controlChange = 0xBC; //0xB0 or 176

void setup() {
usb.init(midi);
// MIDI.begin();
//Serial.begin(31250);
}                         
void loop() {
  for(unsigned char i=0; i<numPots; i++) {
    currentPot = analogRead(i) / 8;   
    if(abs(currentPot-pot) > b) {
      sendMidi(controlChange, i+1, currentPot);
      pot = currentPot;
    }
  }
}

void sendMidi(byte controlChange, unsigned int controlNum, int val) {
//MIDI.sendControlChange(controlNum, val);

Serial.write(controlChange);
Serial.write(controlNum);
Serial.write(val);
  // Serial.write(unsigned char(controlChange));
  //   Serial.write(unsigned char(controlNum));
  //     Serial.write(unsigned char(val));
  }
 
 

 
 



eried

My website: http://ried.cl

lobj10

Well I know it look redic now,   I took it from this forum somewere and rewrote it some.
regarding all the unsigned ints and stuff i just tested out everything because i cant get it to work.
Im pretty new to coding so I really need help :) 
can you help?

Go Up