MIDI IN - Circuit Testing Trouble

Hi there,

I have thoroughly researched the MIDI IN/THRU circuits for use in a project to build a small MIDI THRU box that takes 5PIN MIDI in and has TRS and 5PIN MIDI THRU ports as outputs for the control of guitar effects pedals.

This project does not directly involve an Arduino, however, I am trying to use an UNO to test my MIDI IN circuit before proceeding to connect my guitar pedals together.

I cannot seem to get the Arduino to read the patch change message from my MIDI controller. The controller is set on channel 1 with program change 7 for a random test.

The circuit I have built is attached. The power input circuit is not relevant to the MIDI IN circuit and its only purpose is to supply 5V to the circuit from my 9V guitar pedal supply.

The Optocoupler being used is a 6N138. I have connected an LED in place of the optocoupler and in series with the resistor between 5V and the output pin of the optocoupler to ensure that the signal is being passed through. The LED did blink when the MIDI command was sent in both cases, however it was quite dim.

I am using the following test code provided by the MIDI Library documentation to check for a program change from my MIDI Controller. The LED on the Arduino does not blink when the command is sent in this case.

#include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

// -----------------------------------------------------------------------------

// This example shows the old way of checking for input messages.
// It's simpler to use the callbacks now, check out the dedicated example.

#define LED 13 // LED pin on Arduino Uno

// -----------------------------------------------------------------------------

void BlinkLed(byte num) // Basic blink function
{
for (byte i=0;i<num;i++)
{
digitalWrite(LED,HIGH);
delay(50);
digitalWrite(LED,LOW);
delay(50);
}
}

// -----------------------------------------------------------------------------

void setup()
{
pinMode(LED, OUTPUT);
MIDI.begin(); // Launch MIDI, by default listening to channel 1.
}

void loop()
{
if (MIDI.read()) // Is there a MIDI message incoming ?
{
switch(MIDI.getType()) // Get the type of the message we caught
{
case midi::ProgramChange: // If it is a Program Change,
BlinkLed(MIDI.getData1()); // blink the LED a number of times
// correponding to the program number
// (0 to 127, it can last a while..)
break;
// See the online reference for other message types
default:
break;
}
}
}

Thanks,
Jadon

I don't see a connection between the Arduino GND pins and any of the the components on the breadboard.

You need at least two wires from the breadboard to the Arduino to make a circuit.

Haha, I can't believe I overlooked this.

I was fooling with the circuit before connecting it to the Arduino and completely blanked on the ground connection. Very stupid. Thanks for your help it is working as intended.