View Full Version : RS-232 to Current Loop Interface

April 23rd, 2015, 03:41 PM
I've discussed building a vintage computer compatible current loop converter with a few of you. Since I have a little free time at work this week, I've been looking into it. Preliminary specs:

* 100% optoisolated 20 mA loop
* Proper isolated loop supply for passive devices (higher voltage than usually provided)
* MAX232 for RS-232 end
* Single +5V power supply (wall wart, +5 on aux DB25 pins, et c)
* DB25 for direct plugging into old stuff


* How many people would be interested in a kit?
* Does anyone care about 60 mA current loop?
* What kind of current loop devices would you like documented?
* Interest in a case?

April 23rd, 2015, 04:12 PM
A USB serial to 20mA current loop would be even nicer.

DEC serial consoles used to connect to an ASR33 TTY. The serial console interface has the normal 20mA in/out for the TTY, and it had an additional 20mA for the reader run magnet for the paper tape reader. We connect the reader run signal to the RS-232 CTS signal so it can be used for flow control.

April 23rd, 2015, 04:15 PM
A USB serial to 20mA current loop would be even nicer.

I'm planning on a speed converter as well, for using old 110 baud interfaces with devices that don't go down to 110 baud (USB converters, et c.)

April 23rd, 2015, 04:23 PM
I'm planning on a speed converter as well, for using old 110 baud interfaces with devices that don't go down to 110 baud (USB converters, et c.)

I hacked a simple one together which has been tested and working with an Intel Intellec 4 MOD 40 (and 8 MOD 80) from an Arduino, a couple of optoisolators and resistors, and a hacked version of the software serial library to get down to 110 baud. It works, though!


April 24th, 2015, 06:59 AM
With the help of a few people here to debug an issue or two, I have an optoisolated adapter that works amazingly well.


Not seen on the schematic was a jumper to add or remove local power to the loop, and two more jumpers that I could use to to make the adapter operate as a loopback for the computer or current loop, plus as a crossover so you would never need a null modem cable.
It's very small and a great candidate for having proper PCB's etched. It also cost approximately $25 to build (The optoisolators were $10 each, the MAX232 was basically $2 and the other odds and ends were $3)

April 24th, 2015, 10:40 AM
That's pretty close to the design I have laid out, except I'm using a transformer-isolated switchmode supply for the loop current, and taking regulated 5V input from either pins 9+10 of the DB25 (this is a sort-of standard) or a micro USB receptacle (so you can use a cheap, common cell phone charger). My design uses 4N33 darlington optoisolators because that's what I had in my components supply, and they're cheap.

My loop supply is also jumper/switch selectable, since some of my equipment is active, some is passive, and some is active on one side while passive on the other!

April 24th, 2015, 11:32 AM
Since MIDI is basically a current-loop interface, I wonder if one could modify a (cheap Chinese) USB-to-MIDI adapter to create a USB-to-TTY adapter from one?

In the old days, one could take an IBM Async adapter card, set if for current loop interface and change the crystal and end up with a cheap MIDI adapter for the PC.

April 24th, 2015, 01:56 PM
In the old days, one could take...

Are you saying you are old?

April 24th, 2015, 08:17 PM
Are you saying you are old?

I enjoy the benefits of Medicare.

April 25th, 2015, 04:51 PM
* How many people would be interested in a kit?
* Does anyone care about 60 mA current loop?
* What kind of current loop devices would you like documented?

I'd be very interested in a 60 mA version, since I've got an old Creed 7E laying around.
Sign me up! :D

April 28th, 2015, 05:14 AM
Board layout in progress! I'm going to double the receive/transmit loops for full reader run control, plus it'll make use of those other two tranceivers on the MAX232.

July 10th, 2015, 05:56 AM
Just an update, we're in the process of moving and a job change. I should have time to wrap this up after the move. Sample parts ordered!

September 16th, 2015, 08:03 AM
Prototype PCBs ordered from OSH Park! I was able to keep nearly everything through hole, except the isolation transformer. This is a large SMD part and should be extremely easy for anyone to solder. Prototypes are 3x4" boards, double-sided, with DB25F on one end and large screw terminals on the other. Provides: TX, RX, reader run, AUX current loop input, isolated 12V loop supply, proper level shifting via MAX232, status indicators for all four lines. Rendered topside image:

http://i.imgur.com/4Az8pHil.png (http://imgur.com/4Az8pHi)

September 17th, 2015, 11:13 PM
I somehow missed this thread. I would be interested in a kit, or two. Won't need 60mA.


September 28th, 2015, 06:45 PM
Prototype boards are in, and I've assembled one: it "mostly works!" There were a couple of schematic errors, which were easily corrected (permanently and in testing). I also misunderstood how the switchmode transformer driver I'd chosen drives transformers: instead of a 12V loop supply capable of 4x 20mA loops, I ended up with a 24V supply capable of only driving 2x 20ma loops. My "easy substitution" option is to use a transformer wound to produce a 10V loop supply. The other option would be doubling the number of supplies, or finding a different driver/transformer pairing.

I think the 10V loop supply is the better option for the majority of people. While higher loop supply might be better in some cases, it's probably not really relevant to the average case in which the loop is not physically long. Thoughts?

November 2nd, 2015, 05:45 PM
Well, the 10V supply didn't work out, so I decided to go ahead and modularize the current loop send/receive circuits and the power supply. This will end up providing a 24V loop voltage (for passive loops, like teletypes). I'm also going to include a constant current source/sink so that there's no having to pick resistors based on expected loop voltage. The modules will be in a hobbyist/breadboard friendly format, so if anyone wants to include really solid TTL -> 20 mA current loop drivers, they don't have to build their own.

Question: the circuitry I'm currently working with has an effective max working voltage of 30 - 40 VDC, depending on the optocouplers used. This should be more than adequate for pretty much all active loops out there. There's a possibility of destroying the converter if you happen to connect something higher voltage or turn on the built-in current source on an active loop. I can include a relay-based loop cutout circuit with "Loop Overvoltage" indicator if that would be helpful. Including it would make the board larger, but anyone who didn't want that functionality (it'd add a small cost, of course) could jumper over it. Worthwhile?

November 3rd, 2015, 04:47 AM
Knowing the mistakes I've made, yes. I've let the magic smoke out too many times.

November 5th, 2015, 12:49 PM
Laid out the isolated power supply module today:


It's off to OSH Park. Connector samples came in, too.

November 16th, 2015, 08:59 AM
Sample boards in! The 24V isolated loop supply module works fine, and I think switching to a modular design was a good idea. Here's pictures of the supply plugged in to a test fixture:




November 16th, 2015, 07:00 PM
Another design question:

Dissipation for the current source is OK with 24V loop supply and a 2N3906 through-hole transistor. It will be out-of-spec at the max allowable loop voltage (40V) and could/would damage the 2N3906. I can do a few things:

1. Use a different through-hole transistor, like the 2N2907, and require a heatsink at higher loop voltages
2. Use a big TO-220 power PNP
3. Use a surface-mount 2N3906
4. Lay down multiple transistor footprints for desired power level
5. Make different modules for low/high power level
6. Try and redesign the current source

I like options #1 and #3 the best. #4 and #5 reduce the minimal configuration design goal. #2 makes the module larger, which is OK but not ideal. #6 sucks because I like my current design and it's cheap! Thoughts?

November 16th, 2015, 08:39 PM
To me, #1 seems the best.

November 17th, 2015, 01:55 AM
Nice looking work. I like #1 and #2. Also, it would be nice to have mounting holes in the four corners of the main board, or close to the corners.

December 20th, 2015, 04:56 AM
To me, #1 seems the best too.

December 20th, 2015, 04:13 PM
Well, since it's modular, I'm going with #1 *and* #3! Preassembled boards, if I do any, will include a surface mount transistor, but kit boards will use a 2N2907. I've sourced several hundred 2N2907s in metal cans, so heatsinks could be added if loop voltage is near the limit.

January 18th, 2016, 05:45 PM
Ordered the 20 mA loop receivers today:


This is the one that uses a large metal can 2N2905. Current source is now temperature compensated.

I updated the 24V switchmode loop supply board to use a full wave bridge rectifier. Not ordering more prototype boards of that yet, since the basic design is fine.

January 30th, 2016, 02:05 PM
Protoboards for the receiver are in! Assembled:


As you can see, I've soldered 0.1" breakaway headers to this one and stuck it directly into a solderless breadboard. That was part of the design goal for modularizing. There's a 1 Ohm resistor in series with the loop converter for current measurement. The two 3.32 Ohm resistors in series are like that because I didn't have a 6.64 Ohm resistor on hand.

There's plenty of room for a "tophat" style heatsink on the 2N2905A. It gets warm at 24V loop voltage with basically the loop voltage directly across the receiver -- loop resistance equal to whatever the power supply's resistance is, plus the 1 Ohm sense resistor.

TTL output is provided by a NPN inverter, logic 0 is around 90 mV and logic 1 is around 4 V. Sources 3 standard TTL loads.

January 31st, 2016, 10:25 AM
Did some frequency response testing today. My target bitrate was 9600 -- way more than you'd usually ever need for current loop. Personally, I'll be using the converters as the passive end of a current loop with my PDP-11/10, probably at 1200 or 2400 bps. With slow old 4N30 Darlington optocouplers, I was able to get to a very reasonable looking output waveform at 9600 bps with a few component value tweaks:


Fall time is 8 uS from when the input goes low, rise time is 20 uS, which should be just fine for 9600 bps current loop, if anyone ever needs to run it that high.

Here's a few pictures of the test setup. I used my Lambda power supply to power the breadboard, a Fluke 8842A for voltage and current measurements, a Tektronix CFG250 function generator for input, and a Tektronix 2432A oscilloscope:



February 5th, 2016, 12:11 PM
Proper value resistors came in, current is right where I calculated: 22 mA! Temperature compensation seems to work just fine, of course the board has to warm up to operating temperature. Swing during warm-up is a few tenths of a milliamp.

The current loop transmitter, revised 24V supply, and a breadboard breakout module are off to OSH Park for fabrication.

February 19th, 2016, 01:07 PM
My target bitrate was 9600 -- way more than you'd usually ever need for current loop.

FWIW, ND (Norsk Data) computers have a current loop console - at 9600 bps. So it is useful to some of us. :-)

February 19th, 2016, 01:29 PM
See? It's not just overengineering!

2N2905A transistors arrived from Bulgaria, along with prototype boards from OSH Park. I have to verify these final module revisions, then I'm set to lay out the base board.

February 21st, 2016, 10:51 AM
Haha, I indicated interest in this project exactly because I still have a hope of getting my own ND.. with 9600 baud current loop! :)


April 27th, 2016, 04:59 AM
OK, nearly done with the board layout for the base board! I think rather than put a DB9 or DB25 on the board, I'm going to put a 5-pin header so it can be assembled with whatever connector you like, or daisy chained onto the baudrate + USB converter I'll be designing to go with it. It would also make it easier to mount in a project box. Thoughts?

April 27th, 2016, 04:55 PM
Went ahead and sent it off with the 5-pin header for RS-232 and two 4-pin headers for the current loops:



Had space to put all of the pinouts on the back side in the silkscreen! The images are OSH Park renderings, but the board is being manufactured in China -- cheaper to get 5 boards made in China (with shipping!) than three in the US, and the turnaround times are faster anyway.

The base board is also done in KiCad instead of EAGLE CAD. The modules will probably stay in EAGLE for now, but if there's major changes to be made I'll move them to KiCad too.

With the AUX and READER RUN loops, this converter can be either end of the console link for a PDP expecting paper tape control -- that is, it can simulate a Teletype, or it can be connected to a Teletype and control the reader relay.

May 5th, 2016, 05:56 PM
Prototype base boards are in:


I'll probably populate one this weekend and get it tested out.

Dwight Elvey
May 6th, 2016, 12:50 PM
Years ago, I worked at Intel, when they made systems.
While I was there, I learned some about specmanship.
We had problems getting serial current loops to work at
9600 and some times even 4800.
We traced the problem to the optical isolators.
The biggest problem was the darlington ones.
Two factors were involved.
First, the turn off spec was done with the higher
end of current flow, while the turn on spec was
done by the lower current flow. Both of the timings
where tested under their optimal condition for
shortest time.
They usually have the lead for the intermediate emitter
base connection.
A resistor can be added there to optimize the circuit
for best turn on and turn off at the desired current
This only worked for a short time.
It seems, there is no spec for the gain of each separate
transistor. Form one manufacture to another there
is a large difference. In some,the photo transistor
has more or less gain and the difference is made up
by the output transistor.
The fix should have been to not use darlington optical
isolators but it was decided to only use one manufacture.
The conclusion I'm coming to is that if one needs
higher speeds, don't design using the darlington

September 15th, 2016, 12:31 AM
Was this project put on ice? I'm more interested than ever now that I've got myself a minicomputer which requires a console terminal w/current loop.. I've got one of those, but the future plans involve a RPi3 w/wifi connected to the console port, for remote operations. :)

September 15th, 2016, 03:41 AM
The XT-IDE rev 3 project kind of pushed it out of the way. Aside from the Slot 8 support board, that's pretty much out of the way. I'll try and dig this out today or tomorrow -- I have the prototype assembled, but haven't fully tested it.

September 16th, 2016, 10:12 AM
We are watching this thread with interest... :-)

September 19th, 2016, 09:44 AM
Got everything assembled and tested it over the weekend:


Unfortunately something is not 100% right -- it works fine up to 1200 bps, gets flakey at 2400 bps, and doesn't work at 9600 bps. I haven't broken out the 'scope to look at it. Odd, since I tested the modules with a square wave at what would be 10 kbit/sec. Baseboard and power module fully tested though -- the baseboard had the same "silkscreen effectively wrong" LED issue as the XT-IDE rev 3 board, an artifact from importing from an old version of KiCad!

October 8th, 2016, 11:07 AM
I have sourced several hundred 2N 2907s in metal cans, so heatsinks could be added if loop voltage is near the limit.