Solved: Sparkfun Arduino pro midi signal to low

Hi All,

First time post though scouted the forums intensively the last couple of weeks :slight_smile:

I'm currently trying to workout a midi controller project which I had in mind for a couple of years now and decided that using an arduino would be the way to get this jumpstarted. (I looked in to this project a couple of times but building my own microcontroller circuit, with limited knowledge about electronics did burn me out :slight_smile:

So I decided to started my quest with a sparkfun arduino pro (5v, 16Mhz, MEGA328P) and the sparkfun midi shield but experianced problems problems right from the start with sending out midi, or more precise to have the midi interface recognize the midi signal send from the arduino.

The 1st midi interface attached to the arduino (roland um-2ex) didn't recognize the midi signals (midi input led didn't light up) so I hooked the arduino up to the midi in port of my AUDIOFIRE2 external sound card, the result was that it did recognize the midi signal send by the arduino.

Having an issue with problems like these just letting slide by I decided to start delving in to the problem trying to figure out why the Roland UM-2ex didn't recognize the signals, so out shopping I went and bought an Arduino Uno and a new external usb to midi cable (Roland UM-One).

The result:

Arduino Pro + new Roland UM-one midi interface => Still the same, signal doesn't get recognized.
Arduino Uno + Old Roland UM-1ex interface => Working just fine
Arduino Uno + New Roland UM-one midi interface => Working just fine

So it was fair to draw the conclusion that the issue would be with the output signal coming from the Sparkfun Arduino pro ...

Next I hooked up a scope to the TX line of the arduino's to see if there was something wrong with the midi message itself (and to learn how a midi signal looks like :slight_smile: but expected the signals to be the same as my External AudioFire2 was able to interpret the midi message from the beginning.

Result => On the scope both Arduino messages where the same, so no issue with the midi message itself.

My gut was telling me that the midi signal might be to low to drive Roland USB to midi interface but ignored this initially ...

I learned that midi circuits are current driven, so I hooked up my multimeter in line with the +5VCC from the Arduino's while driving the midi 2 USB Cable.

Results:
Arduino Pro => ~ 1,5mA (DC)
Arduino Uno => ~ 2,5mA (DC)

This baffled me a bit as I was expecting something closer to 5mA, as this is wat is being defined in the midi specifications.

So google was my friend again and of searching for microcontrollers and sending midi messages we went. The majority of the results showed my current setup, 220Ohm resistor hooked up to TX line and a 220Ohm resistor hooked up to the +5V line going to the mid din connector (+GND :wink: all directly wired up to the Arduino without any extra components, but having only 1,5mA in this setup made me aware that I'm experiencing a 1 OFF implementation.

I've found a midi wiring diagram where the TX line from the microcontroller was going through a Hex inverter => 10KOhm resistor => 2n222 Transistor, and figured that this might boost the current on the TX line. The page mentioned that the Hex inverter can be omitted in certain cirquits because some microcontrollors have this function already implemented.

Having all components ad hand from previous projects I never started, I give the circuit a try and left out the hex inverted (as I figured that the signal was ok, just to weak).

The result, Arduino pro with the TX line hooked up via the Transistor circuit was able to drive both Roland midi to USB cables. The current measured on the +5V line was now at ~ 2,5mA, the only problem was that the midi message received was wrong and figured that the hexinverter needed to be included in the circuit. So I hooked up a HD74LS04 to the circuit with the VCC line directly attached to the +5V line from the Arduino and the GND directly hooked up to the GND line of the Arduino.

Result => Everything is working as expected now

  • Started Cheering :slight_smile: *

My question now, having no real experiance/knowledge with electronics and being affright of messing things up, is my setup OK ? Am I missing something or doing something horribly wrong?

To summarize:

Issue => Midi signal from Spark fun Arduino Pro is to low (only about 1,5ma)

Solution => Moded the widely spread arduino midi circuit as following:

  • Arduino TX => Hex Inverter (HD74LS04P) => 10KOhm resistor => (Collector) 2n2222 Transistor (Base) => 220Ohm resistor => Midi connector pin 5
  • Arduino GND to Midi pin connector 1 + to transistor emitter feed + GND of the HD74 Hex inverter
  • Arduino +5 via 220Ohm to midi pin 3 + direct to VCC of HD74 Hex inverter

The circuit I've found on MIDI – code, circuits, & construction

Question:

  • Is this correct?
  • Am I missing something?
  • Is there a better way of resolving the low current issue?

As mentioned my knowledge with microcontrollers and electronic circuits is very limited so any help is much appreciated.
I tried to search the forums to see if some one was experiencing something simular but so far didn't find anything, so my apologies if this being discussed in an other thread.

Cheers,
Spooxs

Problem has been identified :slight_smile:

There is a difference on how the TX and RX headers are being exposed on the Pro and the Uno.
The Uno has the header wires directly wired to the Atmega TX and RX ports where as the pro has a 1K resistor sitting in between, the effect is that the signal is to low and adding a 220K resistor in series makes it only worse :wink:

There are multiple workarounds for addressing this issue:

  • Use the TX and RX lines ment for the USB/TTL connector (they are directly wired to the micro controller TX and RX line).
  • Cut the traces of the resistor and bridge the gap. (didn't dare to take such drastic actions :slight_smile:
  • Use the software serial library on the pro for sending/receiving midi on the other digital I/O pins.

The midi shield from sparkfun can't be directly staked on top of the Arduino pro for this reason, a pity though :frowning:

Hope this helps some one.
Thanks for reading.

Cheers,
Spooxs