# Using an optocoupler to separate a 4-20 mA loop

I have a PLC that is powered with 3.3 V and a sensor powered with 12 V that outputs a 4-20 mA signal. In order to allow the signal to be readable by my PLC while isolating the current in the 12 V loop from the 3.3 V loop I need to use an opto-isolator which I have never used before. I am hoping for some help figuring out the appropriate circuit.

The isolator I am looking at is the HCNR201.

In the datasheet there is a bunch of rather confusing wiring diagram examples that are not clear about where the optocoupler is in the diagram.

I am wondering how I could hook it up in reality so that the circuit connected to my PLC is producing the same current as is going through the LED on the 12 V side. My thinking is that the LED would be driven by my 4-20 mA, 12 V loop (pins 1 and 2) and pins 5 and 6 I would connect to a 3.3 V source that runs through the optocoupler and is then connected to a resistor with an ADC measuring the voltage drop across as seen in my diagram below:

Does my thinking make sense? It seems overly simple compared to the example circuits I was looking at in the datasheet and I am thinking I may need to use an op-amp with the 4-20 mA loop to even turn on the LED and then down-regulate it back to 4-20 mA on the other side before passing it through the resistor.

• Cool part! You're supposed to use an op-amp on the input side. The output of the op-amp drives the LED, and the feedback to the op-amp comes from one of the two photodiodes. In this way, you ensure that the photo-current through the input-side photo diode is directly proportional to your signal. Then, since the two photo-diodes supposedly are matched, the photo-current on the output-side photo-diode also should be directly proportional to your signal. Sep 16, 2022 at 20:16
• Part A of Figure 16 (p. 13) of the data sheet seems to show exactly the circuit that you want.* The input-side is powered by the 4-20mA loop. The output is a voltage that varies in proportion to the loop current. Note: Ignore Figure 16 B. That's for the case where you want to send a 4-20mA signal. [* Only catch being, that you'll have to figure out the appropriate values for the three resistors yourself.] Sep 16, 2022 at 20:21
• Great thank you for explaining that helped me understand whats going on in the diagram! I'm going to do some calculations and spice modeling and see what I come up with.
– Jman
Sep 16, 2022 at 20:25
• Don't forget to include some means of adjustment, given the +/-5% to +/-15% gain accuracy of those parts. Sep 16, 2022 at 20:47

The isolator I am looking at is the hcnr201 datasheet here

In the datasheet it gives a bunch of rather confusing wiring diagram examples that are not clear about where the optocoupler is in the diagram.

For this, see HCNR201 Datasheet’s Fig.16:

As you see, if your transmitter (“sensor” + 4-20mA conversion) can be powered by a 12V Power Supply (but better if a bit higher, as 18V), the 4-20mA current loop (+Iin & -Iin) powers the Receiver-side of the linear optocoupling circuit (top left).
The other part (top right) would be powered by the PLC side. These two Op Amps are not galvanically connected, of course.
The good linearity comes from the optical feedback the PhotoDiode PD1 does on the Left side that corrects intrinsic opto non-linearities, while the PD2 on the right side gets this linearized signal, amplified by its Op Amp.

In your schematic, you also plotted another 4-20mA on the PLC side, using a 3.3V rail.
It does not work like in your schematic, starting from a higher voltage needed by the Right-OpAmp and PD2.
Indeed, Figure 22 of same datasheet shows a more practical circuit (not just the concept in Fig.16) that uses at least 5V on either side of the assembled circuit. As you see, the output at right is a voltage, not a current loop. And for this, the OpAmp as LM158 (as LM358) is used because of its capability to operate from single supply, as low as 3V, then 5V has a good headroom for this application. Observe just One OpAmp is used per PD side, exactly to have galvanic isolation.
See highlighted parts in red:

More of a question than an actual answer because I am not a EE. (Somebody please delete if this is not appropriate.)

Are you certain you need isolation? What if you just did this?

simulate this circuit – Schematic created using CircuitLab

• That could very well be a solution. However, the inherent danger in such a design is the lack of over-voltage protection to the input of the PLC, say for instance, if R1 becomes open-circuit (or accidentally off by factors of 10, or other calamities). Sep 16, 2022 at 20:52
• Yeah, I was thinking, "What could possibly go wrong?" and I thought maybe somebody would accidentally short out the sensor. Seems like maybe more resistance in the loop and a zener diode might help with that problem. Sep 16, 2022 at 21:25
• Also, the Original Post is looking for a circuit with a galvanic isolation, on the Analog Input port. Your circuit is useful and works, but ground loop can induce unwanted noise and make the analog input useless, even if the electronics is protected from voltage overload.
– EJE
Sep 16, 2022 at 21:38
• @EJE, This "answer" was not meant to be an answer. It asks a question. It should have been a "comment," but the site doesn't let me draw schematics in comments. I wondered whether OP might be presenting an XY problem. Maybe their need for isolation was real, or maybe they only thought they needed it because they did not imagine any simpler way to interface a 4-20 loop to a 3.3V analog input. I wanted to show that in principle, isolation was not necessary, even though there might be practical reasons why you still would want it. Sep 17, 2022 at 13:44