Ableton live midicontroller with Arduino Uno

Hi,

I'm trying to build my own midicontroller for Ableton live with the Arduino Uno. I'm new with the Arduino, though not with electronics.
I wanted to start out very simple to make sure i understand everything.
I've got a potentiometer and hooked it up to the arduino according to this:

I also hooked up the midi-jack as described above (and as described on the arduino site itself). I altered the code for one potmeter instead of two (just deleted the coding for the second one).
When i connect the arduino and the jack with a USB-MIDI adapter and the regular USB cable to my computer, the adapter says im sending midi in (or at least, the midi in light is blinking). Now when i open up ableton (live8.2.7) , the usb device is recognized in preferences and everything is switched on, but im not receiving midi (that is, the midi in indicator doesnt flash when i twist the pot).

Does anyone know what i'm doing wrong? Pls let me know.

Greets,

By the sounds of it, there is a problem between youe USB cable and your software.

Can you use a different MIDI source such as a music keyboard to see if Ableton works with that?

Are you using one of those cheap USB2MIDI cables? I never had luck with them, instead I'm using LoopBe software together with Serial2Midi converter and everything works fine.

If you are using this software:-

Serial.print(MESSAGE);
   Serial.print(CONTROL);
   Serial.print(VALUE);

you need to change it to:-

Serial.write(MESSAGE);
   Serial.write(CONTROL);
   Serial.write(VALUE);

Have you set that MIDI port ON inside Ableton?
You can check (or turn it ON) if in Ableton you go to: LIVE ---> Preferences ---> MIDI

So, I changed the code to Serial.write, but that doesn't seem to work either. I have a KORG nanoKONTROL that works just fine, so this should work as well. Furthermore, MIDI IN is turned on in Ableton; that's not the problem either.
I am using a "cheap USB2MIDI cable" but as far as i know this works with a lot of people, so i don't see why it wouldn't work for me...

Anyone more ideas? Is there for instance a way i can check what signal my arduino is sending (it does send MIDI, the MIDI IN led blinks)??

I changed the code to Serial.write, but that doesn't seem to work either

That means there is something wrong as well, don't change it back.

does send MIDI, the MIDI IN led blinks

No you can't say that. The blinking MIDI IN LED means that some serial data has been received it does not mean it is in the MIDI format. There are lots of things that could be going wrong with it.

Get yourself a copy of a MIDI Monitor program and see what you are receiving.

I downloaded MIDI OX and connected the nanoKONTROL. Of course, after selecting it as input device the input log shows information when i turn knobs like it should.
Then i connected the arduino, the USB MIDI hardware was found, but upon turning the potmeter no input was shown.
However when i uploaded a program that plays notes (see: http://arduino.cc/en/Tutorial/Midi) the log showed input (it's what i would expect); i attached a screenshot.
What's interesting is that some weeks ago i managed to get ableton to receive the notes played by that program. It showed them when i hit the MIDI button for assignments. Right now, ableton doesn't receive the notes anymore. It's probably because i messed something up while rebuilding the circuit...

So, what does this mean??

i am really new in this electronic thing, so take my opinion for what it counts...

i would think the problem is not with your circuit if you manage that it works when you upload to Arduino some other code.
If it doesn't work when you upload your code, then i would think the problem is there.

i am also trying to build a MIDI instrument to play with Ableton. (you can take a look to the thread and see if there is somethings useful there for you. i also had some trouble getting the midi working over serial. the thread is here: http://arduino.cc/forum/index.php/topic,98177.0.html )

One idea...
When you upload your code to the Arduino what do you get when you run the Arduino's Serial Monitor? Any signs of life?

It looks like you have got the MIDI socket wired up wrong.
Swap over pins 4 & 5

Often people don't say if a diagram like that is looking at the front of the socket or the back.
Pin 2 should not be connected to anything but hopefully your MIDI lead will take care of that, as that shouldn't have anything wired to it either.

When i swap 4 and 5 the MIDI IN led stops blinking and i still get no readings for the 'midicontroller coding' in midi monitor when i twist the potmeter. I still get some readings for the 'note coding' but not as many as before.

So this is what i get when i don't swap the connections on the midi socket.
When i use the 'note coding' both midi monitor as serial monitor show signals, so i guess that means it's sending midi. However i don't understand why ableton (it recognizes the USB MIDI device) doesn't pick these up (it did a while ago).
As for the 'midi controller coding', the midi monitor shows nothing, but the serial monitor show signals/signs that change when i twist the potmeter.

probably a good thing to post the exact code i'm using....

int val = 0;


void setup()
{
   Serial.begin(31250);       					// Default speed of MIDI serial port
}

void loop()
{
   val = analogRead(1)/8;    				  // Divide by 8 to get range of 0-127 for midi
   MIDI_TX(176,1,val);       				  // 176 = CC command, 1 = Which Control, val = value read from Potentionmeter
   delay(10);
}

void MIDI_TX(unsigned char MESSAGE, unsigned char CONTROL, unsigned char VALUE) //pass values out through standard Midi Command
{
   Serial.write(MESSAGE);
   Serial.write(CONTROL);
   Serial.write(VALUE);
}

So i had a little breakthrough. I messed around a lot with the whole thing not really knowing what to look for. Uploading programms on the arduino, checking MIDI OX for any signs of life. Then, out of what seemed nowhere, i got readings in MIDI OX. Repeated the actions i had done a couple of times with the same result. Looking back to what i had done, i think a few things i didn't do before turned out to be the problem. For others with the same problems i had, you probably should:

  1. Change serial.print to serial.write
  2. Check whether pin 4 and 5 are connected the right way and make sure pin 2 is not connected to anything
  3. (Stupid enough, this turned out to be a major part of the problem) Make sure you start the programms the right way. First upload your programm on the arduino, then connect the USB MIDI cable and then start up ableton or MIDI OX or whatever programm you want to receive your MIDI.

I still have a question though. In ableton, i noticed that the midi indicator (this is it's actual name) didn't flash but was turned on continuously. I guess this means that ableton is receiving midi data continuously and that is consistent with what i see in MIDI OX ( a constant data stream that changes when i twist the pot). This results in that when i try to assign the pot to a certain function (e.g. a volume fader), i dont have to twist the pot to assign the knob, but i only have to click on it. I was wondering if this causes problems if you expand your design with more knobs; like that ableton assigns every function to the same knob, while you want to assign different knobs... Any ideas??

Greets.

This is because with that code you are constantly sending data. In a practical setup you should only send MIDI data when the value you read from the analogue input actually changes. If it stays the same then don't send it.

This is because with that code you are constantly sending data

lol, should have know that...

Anyways, for who has the same problem, use this code:

void setup()
{
   Serial.begin(31250);       // Default speed of MIDI serial port
   pinMode(13, OUTPUT);       // Light LED on pin 13 to notify of readynes
   digitalWrite(13, HIGH);
}

int iAn0Val, iAn1Val;

void loop()
{
   //Slider X
   int iAn0ValPrev = iAn0Val; //Get the previous value of slider X
   iAn0Val = analogRead(0)/8;
   analogPinMidiTX(1,iAn0Val,iAn0ValPrev); //TX the value of slider X
   
   //Slider Y
   int iAn1ValPrev = iAn1Val; //Get the previous value of slider Y
   iAn1Val = analogRead(1)/8;
   analogPinMidiTX(2,iAn1Val,iAn1ValPrev); //TX the value of slider Y
}

void analogPinMidiTX(int iChan, int iVal, int iValPrev)
{  
  //only TX the value over midi if it is changed, as to prevent spamming the midi port and thus confusing the receiving application in learning mode
  if(iValPrev != iVal)
  {
    MidiTX(176,iChan,iVal);
  }
}

void MidiTX(unsigned char MESSAGE, unsigned char CONTROL, unsigned char VALUE) //pass values out through standard Midi Command
{
   Serial.write(MESSAGE);
   Serial.write(CONTROL);
   Serial.write(VALUE);
}