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 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.
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.
The final Circuit in my mind would be something like below:
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.