Go Down

Topic: Mega 2560 MIDI controller issue (Read 3216 times) previous topic - next topic


Hello all,

I am very new to both the arduino and MIDI, so please if you think this is a relatively simple issue it likely is.

My arduino mega 2560 is currently powered by usb, with a midi-to-usb cable attached to the TX pin (midi) and com port 4 (usb). I have uploaded the midi example and the following was spit out by MIDI-OX:

example code: for(int note = 0x1E; note < 0x5A, note++ ... )

001014C7   1   1     B3    36    00    4  ---  Control Change   
0010158F   1   1     93    56    01    4  D  6 Note On         
00101658   1   1     FF    --    --   --  ---  System Reset     
00101658   1   1     93    32    00    4  D  3 Note Off         
00101720   1   1     93    73    56    4  G  8 Note On         
001017E8   1   1     93    01    2E    4  C#-1 Note On         
001017E9   1   1     FF    --    --   --  ---  System Reset     
001018B1   1   1     93    00    53    4  C -1 Note On         
001018B1   1   1     93    56    01    4  D  6 Note On         
0010197A   1   1     FF    --    --   --  ---  System Reset     
0010197B   1   1     93    2A    00    4  F# 2 Note Off         
00101A42   1   1     93    33    56    4  Eb 3 Note On         
00101B0A   1   1     93    01    26    4  C#-1 Note On         
00101B0B   1   1     FF    --    --   --  ---  System Reset     
00101BD3   1   1     93    00    13    4  C -1 Note On         
00101BD5   1   1     93    56    01    4  D  6 Note On         
00101C9D   1   1     FF    --    --   --  ---  System Reset     
00101C9F   1   1     93    22    00    4  Bb 1 Note Off         

To clarify, these notes only play about once every 7 seconds. The rest of the scrolling midi code is: key aftertouch, pitch bend (occasionally), and channel aft. I am very confused. I have ready in a separate post that having the arduino powered by the usb cable can cause issues ... is this the case here?

Could it also be a baud rate rate issue? I have the arduino code baud rate set to 31,250 of course, but the usb port is still set to 9600... I am under the impression that the midi-to-usb cable handles this issue as I have seen in other arduino midi builds but I am uncertain.

Any suggestions? Again, I am a noob at this sort of thing, though I have to admit I love the arduino so far ... I can see its potential use in future projects of mine. Any help would be greatly appreciated!! And I apologize for posting something like this if I was not supposed to, honestly this is the first "post" I have ever made ... as I said, total noob lol.

WilliamK Govinda

Maybe I'm just tired and can't picture this, but how are you doing the connections again? Midi-to-USB cable? You can't just plug a MIDI wire to the Midi Input of your computer, it just won't work. Maybe take a picture and show to us?

Usually you need some extra hardware in order to use the Arduino's UART (Serial Input/Output) as a MIDI device. For output is easy, just a resistor usually do the trick. But for Input is a bit more complicated.



Thanks for the reply WilliamK!!

Currently I have a MIDI connector wired to the arduino mega 2560 in the typical fashion, see the following:


My wiring is identical to this. It should be noted that I am only interested in sending MIDI data, not receiving. Then, connected to the MIDI connector, I have a MIDI-to-USB (eMedia) cable:


This cable is connected to com port 3 on my laptop through the USB. The LED built into the cable blinks according to the delay I have coded into the MIDI program. I was under the impression that the MIDI-to-USB cable took care of the conversion/baud rate issues, but then again that's an assumption. Though I have connected this device to a CTK-601 using a MIDI-to-MIDI cable with no avail .... frustrating.

As for the project itself ... ultimately I want to construct a laser harp with a series of photoresistors connected to the analog inputs. When the beam is broken, play a note, simple ... or so it would seem.

Does that help? Ask me to design a dye laser pumped Ti:sapphire laser and it would be a piece of cake ... ask me to code MIDI, well, you've probably guessed that it would be difficult for me. Thanks again, I really appreciate the feedback!


Hmmm, I'm not sure where things are going wrong. I've done this many times.

Be careful of the wiring of the midi cable. The diagram shows a female connector, but it's easy to confuse this and get things backwards if you are using a male connector.

Can you test your MIDI->USB to make sure it is working correctly?

Can you use a program like midiOX to monitor in the input of the midi port? If you have the midi traffic indicator light going (as you do) you must be close.

-Dr. Speed

Go Up