Q about 6N135 Optocoupler

Discussion in 'General Electronics Chat' started by prometei, Jun 7, 2013.

  1. prometei

    Thread Starter Well-Known Member

    Apr 13, 2008
    55
    0
    greets

    I'm trying to use a 6N135 opto for a midi input module.

    Can you guys take a look at the data sheet and tell me if an input current of 16mA is the minimum current needed to switch transistor on?

    [​IMG]

    http://www.fairchildsemi.com/ds/6N/6N136.pdf

    I've used the following schematic but with a 6N135 instead of a 6N138.

    [​IMG]

    I did some testing by connecting a LED between pin 6 and ground. It's on while the input LED is off.
    The only way I can get it to go off is if I pulse the input LED (pins 2&3) with a battery pack (ca. 3.5V). If I however I hook it up to a midi output of a midi interface and play some midi files, nothing happens, the test LED stays on.

    I've tried many different resistor value but it did not help. I don't know if the 6N135 was a bad choice for this or if I'm overlooking something.

    Your help is appreciated
    thanks
     
  2. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    According to this, the MIDI interface is a 5mA current loop. This means you don't need any resistor in series with the opto input.

    Since the 6N135 has a minimum current transfer ratio of 7%, that means the worst-case output current would be only 0.35mA. The minimum load resistor (R2) value is thus 5V/0.35mA = 14.3kΩ. This may be too large a resistor value to get the frequency response you need. If so you may need to find an opto coupler with a higher transfer ratio and/or frequency response.
     
  3. LDC3

    Active Member

    Apr 27, 2013
    920
    160
    Is it an analogue or digital signal going into the arduino?
     
  4. prometei

    Thread Starter Well-Known Member

    Apr 13, 2008
    55
    0
    Digital of course, MIDI is digital.
     
  5. prometei

    Thread Starter Well-Known Member

    Apr 13, 2008
    55
    0
    thanks for the info, I'll try it, perhaps it will work.

    MIDI runs at 32500 baud rate.
     
  6. tubeguy

    Well-Known Member

    Nov 3, 2012
    1,157
    197
    Take a look at this:
    MIDI Hardware.PNG

    Diode might be backwards.

    ooops' my bad - never mind :rolleyes:
     
  7. prometei

    Thread Starter Well-Known Member

    Apr 13, 2008
    55
    0
    I started from scratch today, rewired everything on the breadboard, inserted a 2.2K resistor between pins 6 an 8, changed R3 from 220 Ohms to 100 Ohms and it works, at least in the direction Arduino TX - 6n135 - MidiMan (Input). The Midiman USB interface recognizes midi notes sent from the Arduino.

    I'll try it 2morro the other way around, Midiman (Output) - 6n135 - Arduino RX.



    ---

    p.s. forgot to mention that R1 between pins 7 and 5 (10kOhm) needs to be removed, otherwise this setup wont function, at least in my case.
     
  8. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    6N138 used darlington pair inside the opto while 6N135 uses a single transistor so the gain may be lower.

    Allen
     
  9. prometei

    Thread Starter Well-Known Member

    Apr 13, 2008
    55
    0
    do you guys know how I could include a signaling LED on the right side of the opto (i.e. use pins 5-8)? I want it to blink whenever there is an incoming message. I've tried different combinations with a NPN transistor and a resistor and cant get a functioning circuit, i.e. if the led blinks then there is no signal going to RX, or vice versa RX is receiving data but the LED is either fully on or fully off.

    [​IMG]

    [​IMG]

    ---

    btw, I tried removing the 3K3 resistor between pin 6 and 8 and the circuit continued to work, data was going through to the RX pin. What's the reason for that 3K3 resistor being there?
     
  10. LDC3

    Active Member

    Apr 27, 2013
    920
    160
    The resistor is a pull-up resistor to give the high level for the next stage (especially if it doesn't have a high impedance input).
     
  11. LDC3

    Active Member

    Apr 27, 2013
    920
    160
    You could try this to add an LED.
     
  12. prometei

    Thread Starter Well-Known Member

    Apr 13, 2008
    55
    0
    That's also what I thought, so I was expecting RX to go LOW and stay there when I removed the resistor. I guess I still have a lot to learn :)
     
  13. LDC3

    Active Member

    Apr 27, 2013
    920
    160
    I believe that the MCU has an internal pull-up. Check the datasheet.
     
Loading...