Opto-isolated Serial connection

I'm trying to make a fully isolated circuit, and am having a problem with the communications. I intend to use Serial as communication at 9600 bps (slow but fast enough and easy to implement), and am trying to get this to work across optocouplers. Not much luck so far using this circuit:

schematic.png

I'm using PC817 optocouplers, rise/fall times said to be 3-4 µs, and the data sheet shows that 10 kHz should be no problem. I've tried the latter with my scope, and it kinda works but I'm not getting anything near a clean 10 kHz block wave out. So I strongly suspect my optos are too slow for this. I know there are super fast optocouplers out there that can do 100 kHz I2C signals, but they're really expensive.

Any recommendations on common, inexpensive optocouplers that work in this application?

I think you have proven that optocouplers invert the logic.

Paul

Hello Wvmarle,

I've just done exactly what you are trying to do. I used TLP2962 opto isolators and they seem to transmit 9600 baud serial flawlessly.

Data in to the opto isolator
330 ohm resistor from +5V to pin 2.
Serial TX into pin 3.

Data out of the opto isolator
0V to pin 5
10K resistor from +5V to pin 6
Output from pin 6
+5V to pin 8
Other pins no connection

Note that the TX and RX sides are fed from seperate, isolated power supplies. I used a 5V to 5V isolated DC DC converter to achieve this.

1 Like

Paul_KD7HB:
I think you have proven that optocouplers invert the logic.

Which is why I wired them in a way that if the input goes low, the LED goes on and pulls the output low as well.

PerryBebbington:
I've just done exactly what you are trying to do. I used TLP2962 opto isolators and they seem to transmit 9600 baud serial flawlessly.

Thanks, I'll check them out.
The final project will use an NME5050 isolated power supply - similar to the one you tried to link to.

Some scoping later and indeed the rise time (opto switching off) is far too low to follow a 10 kHz block wave applied to the input. About halfway the 50 µs high time of the input the output starts to follow... then takes another 15 µs or so to reach 3V (Vcc = 3.3V). The 2k2 resistor worked best for the values that I tried (680Ω and 10k both performed worse, output not even reaching Vcc). No wonder 9600 bps serial doesn't work.

Fall time (opto switching on) is sufficiently fast, otoh. A few µs after the input goes low the output is low.

Circuit as such works as expected, output signal is NOT reversed, just it turns out that this particular opto is too slow.

wvmarle:
I'm using PC817 optocouplers, rise/fall times said to be 3-4 µs

No, far far slower than that with 2k2 load. Those are exceedingly slow devices!
With 1k load they are 20us or so average, perhaps 50--100us worst case.

They are only rated for about 7us at 100 ohm load resistance, worst case 20us. With
2k2 load you're hopelessly slow basically.

Choose a fast optocoupler, solve your problem. Logic speed opto couplers are
available, as are logic-speed galvanic isolators.

I learned a bit more about optocouplers now :slight_smile: Thanks for the reactions.
I've decided to go for the 6N137 (edited) - unfortunately twice the size (DIP-8) but it looks like it will do the job just fine, as long as I make sure there's a 5 mA drive through the LED.

I learned a bit more about optocouplers now

Me too! I went through the same learning curve. I am actually quite surprised how slow some opto couplers are, but never mind. I don't know the 6N139, I had to read a lot of data sheets before deciding on the TLP2962.

Sorry, that should be the 6N137 - a logic gate based optocoupler, seems to be quite similar in general design to the TLP2962. One major difference is that the 6N137 has a NAND gate and comes with an enable pin, while the TLP2962 has a NOT gate.

The 6N139 is a darlington based optocoupler.

6N137 are fast and good. I use them to isolate DMX512 from MCU controllers and DMX is 250000 baud.

PerryBebbington:
I am actually quite surprised how slow some opto couplers are

Its due to the semiconductor physics - optimum light sensitivity is not the same as optimum speed.
The first would like slow recombination times so the charge carriers actually get to be used for
transistor action before they recombine, the latter fast recombination so they go away once the light stops.

Simple photo-transistor based opto couplers are aiming for the transistor action gain to make up for
the substantial losses in the IR LED and the optic pathway, so they tend to go for highly sensitive
(slow) phototransistor.

Logic opto couplers use active circuitry and a photodiode to get high speed performance.

Mark T thank you! That's what I love about this forum, I keep learning new stuff.
++Karma

After using optos, for a while I switched over to using those bi-directional fellows.

Different purpose. I'm using those level shifters as well (with a BSS138 MOSFET). Much cheaper than the optocoupler, by about 10 times or so, and much less board space needed.

This optocoupler solution is to galvanically isolate two circuits. The voltages on both sides indeed happen to be different as well but that's not why I'm using it.

PerryBebbington:
Mark T thank you! That's what I love about this forum, I keep learning new stuff.
++Karma

Here .. here.. this thread has just helped two aspects of a project that is on my books for future consideration.
Tom.... :slight_smile:

1 Like