midi-out produce strange signals

hi all, i`m new here and hope someone could help me:
i just want to match a poti on analogIn to a midi out control change message.
i think i can be sure the hardware is ok, i used two different arduinos pro minis and the problem is the same.
Monitoring with MIDI-OX i get changing midi messages while turning the knob like "Note of", "Song Position Ptr", "MTC Quarter Frame" .....

But i only want to see a contol change event like it does when i connect my commercial hardware controller.

my code is from tubedogg:

// by Tubedogg 12/2006; fabian at tubedogg.de

//This program reads up to 6 analog sensors / potentiometers ans converts the data to Midi-Controller messages
// define Switchpin:
#define switchPin 10
// define LED:
#define LEDpin 13

// Variables

// define variables for the controller data
int AnalogValue[6] = {0,0,0,0,0,0};

// define the "lastValue" variables
int lastAnalogValue[6] = {0,0,0,0,0,0};

// select the midi Controller Number for each input
int midiCCselect[6] = {1,2,3,4,5,6};

// select threshold for each analog input
int thresh[6] = {1,1,1,1,1,1};

// select number of desired analog inputs (max 6)
int input_no = 6;

void setup() {
// set the states of the I/O pins:
pinMode(switchPin, INPUT);
pinMode(LEDpin, OUTPUT);
// Set MIDI baud rate:


// main program loop
void loop() {

for(int i=0;i<input_no;i++){

AnalogValue = (analogRead(i))/8; // read the value from the analog input and divide by 8 for range 0-127

  • // check if value is greater than defined threshold (good for resistive touchpads etc)*
    if ( AnalogValue >thresh ) {
    * // check if analog input has changed*
    if ( AnalogValue != lastAnalogValue ) {
    * //send control change on cc#i*
    midiCC(0xB0, midiCCselect_, AnalogValue*);
    // update lastAnalogValue variable*

    lastAnalogValue = AnalogValue*;*
    * //End if*
    * }
    //End if*

    * }*_

//End for
//End Loop
// This function sends a Midi CC.
void midiCC(char CC_data, char c_num, char c_val){
Serial.print(CC_data, BYTE);
Serial.print(c_num, BYTE);
Serial.print(c_val, BYTE);
and i tried a lot of other codes but my problem is the same:
e.g. ***://itp.nyu.edu/physcomp/Labs/MIDIOutput
my hardware: Arduino mini pro (5V) with FTDI Basic (5V) by Sparksfun
can anyone help me???
thanks rens

Hi Some advice,
post code between the brackets that come up when you hit th hash icon in the reply box.

But i only want to see a contol change event like it does when i connect my commercial hardware controller.

What does that mean? It sounds like your system is actually working.

thanks for the hash advice, i`ll use it next time.

so if i use my
nord modular > midisport 4x4 > laptop (winxp) > MidiOx
i get correct control change messages when turning a knob on the nord modular.

if i use the
analogIn> arduino mini pro > midisport 4x4 > laptop (winxp) > midiOx
and turn the knob i get these weird changing midi messages.

i compared and tried several codes and cant find a fault. about one or two years ago i got this done (with arduino mini) but i cant remember : (

Can you post a list of a few 'correct' messages and also what you are getting. because the code you posted looks OK and as you are getting messages it would appear the hardware is working.

I can only think you are sending different control messages than you want to send, but not knowing what you want to send makes it a bit difficult to see what you need to change in the software.

first, thanks for your help!

i made two screenshots at the following links. the nice one is the control change from my nord modular, the weird from my selfmade arduino midi out.

and if i want to use my arduino with ableton live for example, it hangs up when getting the midi messages.

OK thanks.
It looks like you are getting lots of system exclusive messages.

  1. Was that screen dump produced by the code you posted?
    If so please check that the signal you have driving the MIDI output is the right way round. Sometimes people can get the two MIDI lines swapped over by mistaking the connection diagram socket front and back.

To simplify matters just have a main loop that sends a fixed message then a delay, something like:-
void loop(){
midiCC(0xB0, 0x55, 0xAA);
Monitor this and see if it comes out right. 0x55 is alternating zeros and ones and 0xAA is the logic inverse of this. If you get something like 0x0F, 0xAA, 0x55 then it is upside down.
by the way 0x just means "what follows is a hex number" you will not see it in your MIDI monitor.

i got it done!
i used the wrong preset in the upload software.

because i have an arduino pro mini (5V) i thought i should use the preset for the arduino pro mini (3.3V), and because i got a good message ("Done uploading") i didn`t thought there might be the fault...

with the preset for Duemilanove Atmega 328 it works.
very nice, very good.

thanks a lot to you grumpy_mike for helping me the last days, thanks a lot!