# Optocouplers with non-inverting logic

Here is the setup:

I'm using the Arduino Mega's SPI functionality to send signals to multiple DACs. For digital isolation, I am considering the HCPL-2631 or the ACPL-064L. The problem with these two is that output signal is inverted.

One solution is to feed the optocoupler's output signal through a set of inverters.

Could I accomplish the same by inversing the input polarity of the optocoupler?

Also, are there optocouplers with non-inverting logic that are suitable for digital isolation between an Arduino and a DAC?

• This opto has a diode input, so the polarity of the signal will depend on how you drive the diode, you can connect it in an inverting or non-inverting way. How did you intend to drive the diode? Commented Jan 21, 2016 at 18:11
• That's not the only problem. SPI uses totem-pole/tri-state drivers. The HCPL-2631 has open-collector outputs. Commented Jan 21, 2016 at 18:19
• @WhatRoughBeast Right, is that why you think using inverters is my only option? Commented Jan 21, 2016 at 18:23
• @user3720702 - Why in the world do you believe that I think that? What did I say to give you that idea? Commented Jan 21, 2016 at 18:26
• @WhatRoughBeast I assumed that the hcpl-2631 inverts the signal because it has an open-collecter output..? Commented Jan 21, 2016 at 18:47

## 3 Answers

If you connect the LED in the opto from your output drive to Vcc (through a resistor, of course) the signal will not be inverted.

simulate this circuit – Schematic created using CircuitLab

For minimum power consumption and maximum optocoupler life it's better to have the opto spend more time with the LED de-energized and there may be consequence as to what happens when power is removed from the the driving side, so there are more factors at play than just logic inversion.

• Got it. So I am better off with the original setup: inverting the signal(s) with hex-inverters? Commented Jan 21, 2016 at 18:22
• Maybe, maybe not. The factors mentioned in my final paragraph are not part of this question. Since it's just DACs it may not matter much. No matter what you do on the driving (LED) side the output will be high on the other side if power is lost on the driving side. In some cases it might make sense to add an inverter on the other side. Commented Jan 21, 2016 at 19:24
• Understood, thank you. Someone told me that passing the signal from the optocoupler's output into an inverter will "clean" signal. Will it? Commented Jan 21, 2016 at 23:54
• A logic gate with Schmitt trigger inputs (e.g., 74xx14) will indeed generate sharper edges, but only if you have slow optocouplers (your's aren't), and if the receiving chip do not have Schmitt trigger inputs to begin with (many MCUs have them, your DACs probably not).
– CL.
Commented Jan 22, 2016 at 9:25

Making a non-inverting optocoupler from a phototransistor is easy, and you can do it in several ways. First, just do as Spero Pefhany suggested, and drive the input as an active-low device. Second, drive the input as you consider normal, but use a pull-down rather than a pull-up output:

simulate this circuit – Schematic created using CircuitLab In this case, a high input turns on the LED, which causes the phototransistor to turn on, pulling the output high.

A third approach involves Googling "non inverting optocoupler", and the first return I get links to this app note. Note the circuit on page 4: an isolation circuit for use with SPI.

• Perfect. Thanks. I actually did come across the app note you mentioned and the schematic is very similar to the one I started with (before this post), but I was using a pull-up output. What you and Spero Pefhany suggested clarified things for me! I appreciate it. Commented Jan 22, 2016 at 10:02
• @user3720702 - But note that you can only do this (the above schematic) with single optos like the 2601. Duals will have their emitters tied together. This will allow an isolated OR function, but not dual noninverting couplers. Commented Jan 22, 2016 at 15:39
• Yes! Thank you for confirming! I had written and deleted a comment about that earlier because I answered my own question as I was writing it. I'm taking the 'single opto' route for isolation. The last thought I had (curious really).. is this setup as good as the RF-based digital isolator? Commented Jan 22, 2016 at 17:10

If you do not want to invert the logic for driving the LED, you have to use an optocoupler with a non-inverting output.

High-speed optocouplers have separate amplifiers and digital output logic, so there is no technical reason why they couldn't use buffer logic. And indeed HP did this with the HCPL-2200, which was cloned by Everlight, Toshiba, and Vishay. Furthermore, Toshiba has has a long list of non-inverting optocouplers: TLP555/715/2095/2105/2110/2310/2355/2405/2710/2955 (5 Mb/s), TLP2345/2745 (10 Mb/s).

Additionally, (non-optical) digital isolators often are available with both inverting and non-inverting outputs.

• Thanks! I didn't know about the HCPL-2200. Could a 3rd option be: to use the "new" digital isolators? From my understanding they don't invert the signal, or do they? Commented Jan 22, 2016 at 0:20