Monday, 4 December 2017

arduino - I cannot get opto-coupler H11L1 to work as MIDI Input


I received my H11L1 opto isolators (yeah) to use for my MIDI input(s).


However, I cannot receive anything (and tried various circuits).


According to the H11L1 (see datasheet) an example circuit is:


Example The red box is the part I expect I made a mistake.


According to the MIDI spec an input should look like enter image description here


The red part is again the similar part I expect problems with.



The following is a screenshot of my circuit (note I replaced the ferrite beads by cables since I do not have them yet). enter image description here The two cables on the right go to pin 4 and 5 of the MIDI cable (I also switched them so that is not the problem).


I use 270 ohm and 220 ohm resistors as advised.


Does anybody have an idea what can be wrong?


Update: It's improved if I put an Hex inverter (74HC14) after Vo (open collector output). The test LED (not in circuit is now shining more whenever MIDI input is received, the Arduino still doesn't get correct data, probably the signal is too much disturbed somehow).


My sketch:


#include 

#define LED 13

MIDI_CREATE_DEFAULT_INSTANCE();


void setup()
{
pinMode (LED, OUTPUT);
MIDI.begin(MIDI_CHANNEL_OMNI);
MIDI.setHandleNoteOn(MyHandleNoteOn);
MIDI.setHandleNoteOff(MyHandleNoteOff);
}

void loop()

{
MIDI.read();
delay(1000);
}

void MyHandleNoteOn(byte channel, byte pitch, byte velocity)
{
digitalWrite(LED, HIGH);
delay(1000);
}


void MyHandleNoteOff(byte channel, byte pitch, byte velocity)
{
digitalWrite(LED, LOW);
delay(1000);
}

Update:


It seems the opto coupler is probably working correctly, but the Arduino does not pick up the signal correctly. I made a new question on that stack exchange:


Arduino question about H11L1




Answer




  1. Remove the opto-isolator from the breadboard. Replace it with an LED. That should blink when you transmit from the MIDI source device.

  2. If that's OK then put the opto-isolator back in. Put the LED in series with the pull-up resistor. Repeat the test and you should see the LED blink.


schematic


simulate this circuit – Schematic created using CircuitLab


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...