DIY 6N138/6N139 coupler

ACME

Active member
Hi everybody! (Hi Paul)

I'm looking for a "emergency solution" because I have no 6N138 here. My question is, can I do it with PC817 and two BC547 like a Darlington?

6nxxx.jpg


It's for MIDI IN on Teensy 4.1 with Audio-Shield Rev. D


Many thanks in advance
John
 
Really nobody who wants answering my question? Or do you guys feels kidding by my question because it's already a Darlington circuit?
Yes, of course it is, but with external Transistors and my question actually is, does it also work with the both BC547 in this constellation?
Sure, I can take the Datatasheets and have a look. But in practice will it work without frying my 4.1 ? Then I prefer to ask the Experts here in the Forum before I start something stupid with the board.


I don't want to complain, but... you know?
Certain "well known mebers" here already wrote with me in the past, but, I declared (a couple days ago) that I have some bad problems due my diseases, and - maybe I missinterpreted some answers. Could it perhaps the reason why none of you is answering to my question(s)? (The core of it is, that I have some times good understanding of your interpretings and some times less good, depending on my shape of the day) I'm also just an meat popsicle ;)

Perhaps I'm too inpatient though, I don't know - I can remember that questions onced has been answered more quickly in spite of it's kind of question.

One more time: If I did any stupid or said something stupid - I apologize if I got something wrong here and gave the wrong reaction to it of course I apologize much more.

I would like something to know and was waiting for an answer. Meanwhile I ordered a couple 6N138, 1N4148 and 0.1uF Ceramic's.
And will build the circuit as it is described in the schematic. Meantime my Question has become almost senseless now due there was quite no answer until now and I have already all needed parts ordered.

I don't want to smoke up my 4.1 - This 4.1 is like "my first born son" you know? :) What will happen, if the wrong Voltage comes into PIN zero?

Paul, on your schematic for the 4.x you'd explained that an optocoupler is forced to be used. Okay, as far so good. But, do I need really a 5V rail to push the Base Gate or can I use just directly the 3.3Volt to pull it up against Ground with 470 Ohms? (and let the Transistors out of the schematic) I mean, the 3.3V will yet drop, nor?

I made it, on MIDI-IN to let lit shortly up the LED behind the Optocoupler if I push any Note (and releases again) or pressing Play for any Rhytm. So that works fine using 3.3V directly to the LED with resistor and it seems that it generates and transmitting the needed bits by flickering of the LED. And if I start a Rhytm, then the LED starts to flicker permanently as used to be and at the same time to glimm barely between the PWM's. The Voltages changes up to 0.7 Volts during the process which means to me: It pulses from 0-255.

Sorry for the long Text, but I tought to explain my personal situation and was a little bit frustrated 'cuz nobody reacts.

regards
 
Relax, it is summer, at least in europe and north america. As hobbyists here, we have other activities, family, hollydays,...
 
Why using 5V on collector of Q1 ? Use 3.3V and you would be sure your Teensy will not fry.
What the use of VB ?? Only for measurement ? Or it is the inverted VO ?? If you need it as a digital output, you need to insert a resistor on the Q2 base.
 
Why using 5V on collector of Q1 ? Use 3.3V and you would be sure your Teensy will not fry.
What the use of VB ?? Only for measurement ? Or it is the inverted VO ?? If you need it as a digital output, you need to insert a resistor on the Q2 base.
Hi and tanks

Uhm, VB has actually No Connection as it is mentioned by Paul's schematic - but as an testpoint definitely useable. So, I let it also an NC.
PJRC Site - Stoffregen's MIDI IN/OUT Schematic

And the same is all about the 5V Question. In my opinion 5V is not needed at all, but in Paul's circuit it's declared - I don't know why. As far I know, 3.3V is enough. Perhaps due the Darlington schema itself? I mean, within the Coupler housing is an internal Transistor Array which change the main conditions of the circuit by it's value on it's output. In my case (and my opinion): Without a Darlington circuit it will work also fine by supplying 3.3V and drain over 470 ohm Resitor, right?

At first I was unsure to take fig. 1 (half in the shape of Paul's circuit, because here I took the 5V from MIDI PIN 5 as Source) but now
I'm sure fig. 2 will absolutely okay for this purposes...

fig.jpg
 
Figure 1 is all wrong.
Figure 2 should be ok. R4 could be 3k, to lower current in the phototransistor, and have Vo to max 0.2V.
 
A thausand thanks to you both.

@Angelo, that's what I assumed but wasn't sure about. I want to do it like that.

BTW: Fig.1 works anyway (V0 shouldn't exist in this circuit), then it's a simple MIDI-IN LED control light (lit up and off by pressing keys or on automation/beats). I tested this yesterday because of my curiosity about the 5 volt signal from PIN 5 and the branching of the voltage to both sides of the coupler. Yet the Optocoupler actually already have +5V on it's Anode PIN due PIN 4 and gets in spite on it's Cathode PIN another +5V, and because of the fact that there's no negative pole in this dc circuit, I was wondering that this work anyway...

@jmarsh I believe that I'd read anywhere about this thing making the digital PIN 0 to an INPUT_PULLUP could disturb or influence the RX Input Signal to this PIN because of low Voltage ramping. But I'm not sure right now, maybe it was in a another relation. What is the minimum Voltage for digital PINs to measure a 0 or 1? (yes - normally I should study the Datasheets, I know)
:cool:
 
The circuit in figure 2 is correct. But you might reconsider choosing PC817. It may be on the slow side for 31250 baud. Normally H11L1 is used. This PC817 part is much slower.

1722424292666.png
 
In fig 1, the the LED and resistors are wrongly connected to the photo-transistor. In this schematic, the led could not emmit light.
But you probably soldered your prototype the right way.
 
Uhh... Ups, my bad :sleep:
Yep, it was twisted in fig. 1.

fig1b.jpg


That's the right one.


@Paul
I didn't knew that before. I have been never in touch with this kind of Optocouplers - Hence, that's Gold, so thank you so much for that info. Without your mention I would never have noticed that and later I may regret or be would wondering why the transmissions are slow or stuck. I will order immediately H11L1. That I understand it correct, you don't mean the ones with M behind, right? I get in the Product site (on Farnell and RS) ISOCOM DIL-6 Optocoupler only. And - wow - it's a DC-In-Schmitt-Trigger out! Okay... woohoo... Explains so many.

Here (RS Website)

But for now (testing and play around MIDI In/Out) I can use the fig. 2 in Post #5, right?
 
Yes, figure 2 in msg #5 is ok for experimenting. It may not work reliably due to the slow optocoupler or resistor choice, but at least is should not risk damage to Teensy or other hardware. If you do use PC817, I would recommend changing R4 to a resistor between 1.2K to 1.6K, because PC817 has a current transfer ratio spec of 50% and the MIDI input current should be ~5mA. That ought to give you the best chance of it actually working. But keep in mind PC817 specs are (maybe) just barely fast enough. Even if it works, communication might be unreliable long-term or at different temperature.

Many MIDI products have a "Thru" output, which is a buffered copy of the input signal. You absolutely should not use a slow optocoupler for MIDI Thru.

The figure 1b circuit in msg #12 should not be used for connection to Teensy! If your only goal with this circuit is to light the D2 LED, but not actually connect data, you could probably omit the optocoupler completely and just connect the LED where the optocoupler's LED is. Red LEDs usually have 1.8V drop, where optocouplers have an infrared LED inside with 1.2V to 1.3V drop. So perhaps reduce R2 to 100 ohms or less. The main point is if you only want to light a LED, you probably don't need an optocoupler. MIDI is a current loop protocol, You can just pass the current through a LED and adjust the resistor as needed. Best to use a red LED that's close to infrared, rather than a blue LED which needs more voltage.
 
Last edited:
For the most purposes I always use red LED's. Don't worry about figure 1b, I won't use that, it was just an example for @Angelo ;)

Even if it works, communication might be unreliable long-term or at different temperature.
Yes this is my worry about long-term use, the temperatures might be strong vary in my enviroment. I move upcomming Month in a single fam. House and my area will be the attic. I need to insulate the whole roof first otherwise it will result high fluctuations in the room. There's no yet wool or foil upstairs.

For best results I will take the 6N138 as it's shown in your circuit and will keeping in mind that I also can take the H11L1 if a 6N138 isn't available.
 
Back
Top