# how do I use H11L1 correctly to receive MIDI?

I was following this schematics. This is the first result on google images

My Arduino Serial Monitor received nothing. I tried to replace the H11L1 with LED, and it does blink. but as soon as I connected the H11L1 (while keeping the LED in parrarel and not connecting the H11L1 to anything else), the LED stops blinking. Tried with and without resistors, also tried to reverse the cable.
Then I plug out the H11L1, afraid to break my keyboard and the LED blinked again.

EDIT :
I was using Arduino Mega. I put it on reset mode by connecting Reset to GND. then I connected it like above and opened serial monitor. Nothing.
Also I don't use capacitor, so I edited the image a little.

Where do I start troubleshooting?

another edit, here goes my Arduino so far. Sorry for bad soldering.

What I've tried so far :

1. Reading the serial pin as a digital pin, without connecting the H11L1 to anything except the resistors, just like above. Always return 1.
2. Tried to put multimeter on it, still returns 1, expected return is 0. Tried to turn on LED with it, the LED did turn on.

EDIT as of 03/28/2019

I changed Arduino Mega to Wemos D1, and H11L1 to PC900V (some source told me that it is the same IC)

After that, I connected that (still using the same schematics) to D2 instead of RX, and using this code to check it. Still no luck, whatever I did it still only returns 1.

• "It simply doesn't work" is not a valid problem description. What did you measure coming out of the device? The fact that your LED stops blinking when you put the H11L1 in parallel with it is not surprising. – brhans Oct 8 '18 at 22:02
• my Arduino received nothing. I put the Arduino Mega to reset mode by connecting reset to gnd. Then I connected the pin 4 to RX, pin 5 to GND and pin 6 to 5V, just like above. I just don't use capacitor. – Rinaldo Jonathan Oct 8 '18 at 22:04
• I hope you just connected Reset to ground briefly - if you left Reset connected to ground, the microcontroller won't run. – Peter Bennett Oct 8 '18 at 22:22
• If you were holding the Arduino MCU reset, then of course you would not be able to receive data via the serial monitor. What software are you running to receive serial line data? – Jack Creasey Oct 9 '18 at 4:23
• @MichelKeijzers I'm gonna retest everything tonight. Will update later what actually happened. But can you confirm my schematics is correct? – Rinaldo Jonathan Oct 9 '18 at 11:01

You cannot use both serial monitor and the serial input pin. They share the same serial port.

Even not used, TX from MIDI conflicts with TX from PC at the microcontroller RX input which keeps the input to logic "1" . Reading as digital input doesn't change anything.

Use a software UART for MIDI or find some other way to test your program without using the serial monitor.

The software UART can help you fix the design flaw noticed also by @Transistor that the output is inverted by inverting the input in software.

• Upvoted, however I did tests with the software UART for MIDI and it it far from reliable (if you need to be sure not to miss any Note Off commands for example). – Michel Keijzers Aug 10 '19 at 15:06

Figure 1. LED IV curves. Source: LED current-voltage relationship.

Your opto-coupler uses an infrared LED. When you connect this directly in parallel with any other colour LED the voltage across the LEDs drops to that of the lowest one - the infrared in this case. Your schematic shows a 220 Ω resistor in series with the LED. Assuming 5 V logic this will have about 3.5 V dropped across it when the LED is lit so the LED current will be about $$\ I = \frac {V}{R} = \frac {3.5}{220} = 16 \ \text {mA} \$$. Looking at Figure 1 we can see that the infrared voltage at 15 mA is about 1.25 V or so whereas a higher voltage is required for any visible LED.

So that explains why connecting the opto-coupler mutes the visible LED.

Debugging steps:

1. Note that the output is inverted. This is indicated by the Schmitt trigger symbol being low on the right.
2. Disconnect the input. The output should switch high. If it doesn't then

• check the Vcc voltage with respect to ground elsewhere on your circuit.
• check the ground voltage with respect to Vcc somewhere else in your circuit.
• check for short-circuits on the output. (Disconnect everything else other than the pull-up resistor.)
3. If that all looks OK then apply 5 V to the MIDI pin 4 and 5. The output should now switch low. Follow the same procedure as above.

• MIDI uses about 2.5 V across the connector pins. – CL. Oct 9 '18 at 5:59
• tried to digitalRead() the H11L1 without connected to anything, already returned 1. should be right. – Rinaldo Jonathan Oct 9 '18 at 6:27
• tried to connect multimeter to it, still returns 1, which is not right. Tried to turn LED with the multimeter, it did turn on. – Rinaldo Jonathan Oct 9 '18 at 6:33
• "... still returns 1". Are you trying to measure the output of the opto-isolator using the resistance range? You should be measuring voltage. – Transistor Oct 9 '18 at 6:48
• @Transistor no, I'm using the multimeter as 5v input alternative, since I don't have battery backup. that's why I told you that I tried that to turn on the LED using multimeter and it did turn on. – Rinaldo Jonathan Oct 9 '18 at 7:08