I'm trying to make a circuit that converts UART signals to 20 mA current loop signals. I tried this circuit to switch the signals.

I used this circuit to switch

I am not much experienced in optocouplers I had just two types to test, TLP251 and 4N25. The below pictures show voltage of Node1 on oscilloscope. The input signal on TXD is a 20 KHz sqaure wave.

Node1 on 4N25

Node1 on TLP251

What is a good choice for optocoupler which is capable of transferring signals up to the 1M Baudrate of the uart?

This is what I got with 6N137.

Output with 6N137

The final Circuit in my mind would be something like below:

enter image description here

I need the logic to be the same not inverted which mean 5V on TXD makes 20 mA on current loop and 0V makes 0 mA.

  • 1
    \$\begingroup\$ 6N137 and its derivatives. \$\endgroup\$ Aug 29, 2017 at 7:15
  • \$\begingroup\$ @Marko Buršič I tried this opto but the result is not what I expected I edited my post with the picture of 6N137 output on 20KHz. \$\endgroup\$
    – Masoud
    Aug 29, 2017 at 8:02
  • \$\begingroup\$ +1 That was fast. Do you have optocouplers lying everywhere? \$\endgroup\$ Aug 29, 2017 at 8:04
  • \$\begingroup\$ @Marko Buršič haha. That was a chance I asked my friend nearby! \$\endgroup\$
    – Masoud
    Aug 29, 2017 at 8:07
  • \$\begingroup\$ But the whole circuit is maybe wrong. What is the final goal, where do you expect 20mA? You will probably need a current source. \$\endgroup\$ Aug 29, 2017 at 8:09

1 Answer 1


A simple current source with mirror. Google to find the calculation for correct resistance. The Q1 needs to conduct the N-th current of parallel transistors, where N is the number of mirror's parallel transistors.

Why current source? Because the current loop is to be used on long distance cables and low speed. The current source will compensate for the long cable resistance.


simulate this circuit – Schematic created using CircuitLab

Try this:


simulate this circuit

The S5 PLC already has two current sources for that purpose.

  • \$\begingroup\$ I need this converter to connect to a PLC. The converter is going to be mounted on top of the PLC so the loop distance is not long. Sorry Marko I couldn't get the circuit so much. where does the TXD should be applied? What type of pnp should I use for Q1-4? What does that darlington pair do? \$\endgroup\$
    – Masoud
    Aug 29, 2017 at 10:47
  • \$\begingroup\$ Which PLC? You need to TX and RX for use with PLC. \$\endgroup\$ Aug 29, 2017 at 11:44
  • \$\begingroup\$ Siemens S5. It's just the TX part i will design RX later. \$\endgroup\$
    – Masoud
    Aug 29, 2017 at 13:19
  • \$\begingroup\$ I have one working S5 converter DIY, I will search for the schematics. \$\endgroup\$ Aug 29, 2017 at 14:17
  • \$\begingroup\$ Mine is dirty cheap using MAX232, 2 optos 4N25 one NPN transistor and two LEDs. I can't find the schematics. But is similar to this one: horter.de/doku/v24-tty_db.pdf \$\endgroup\$ Aug 29, 2017 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.