USR-IOT Serial-to-Ethernet Converters with Linux

I’m posting this mainly because Google didn’t turn up any help when I queried about using the USR-IOT serial port to ethernet converters (also known as terminal servers) with Linux. They make several low-cost devices that are really handy if you need to talk to serial devices that are far from the host computer. In particular, the USR-TCP232-410S single port converter and USR-N540 four port device are quite inexpensive. Their website has nary a mention of Linux compatibility, and I didn’t find any Google hits indicating that they work with anything other than Windows and maybe Mac.


It turns out that they work just fine under Linux, using standard protocols. You can even change speed as if the port were physically connected to the computer. Leaving the server set at its default settings, all you need to do on the Linux end is install the socat “multipurpose relay” tool (it’s available as a package in Debian-based distributions) and write a simple shell script.

Here’s what I’m using:


#!/bin/bash
# open virtual serial port
socat pty,link=$HOME/vmodem0,waitslave tcp:10.73.1.71:23 &
# run the program
./testcomms.py
# kill socat afterwards
killall socat

Customize the socat command line with the name of the port device (here $HOME/vmodem0, but you can name it and place it wherever you want), and the IP address and port of the serial server.

This worked on the first try, suspiciously easily.

It appears that socat destroys the vmodem0 device when the called program finishes running, but does not kill its process. That’s why I stuck the killall command on the last line. There is probably a way to make the device persistent so you would only need to run the socat command once at bootup, but I haven’t dug around for it yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

RELATED POST

GPS Frequency Stability

I couldn't find a nice graph showing the timing performance of a single-frequency, sawtooth-corrected, pulse-per-second output from a GPS. So…

Mini-Circuits Power Amp

Each year at the Dayton Hamvention, the folks at Mini-Circuits have a bunch of odds and ends they sell very…

Oscillator Aging Trends

It's well known that just about all oscillators drift, or "age", in frequency with time. In crystal oscillators, the most…

HP 5065A Status

My faithful HP 5065A Rubidium standard, which had been converted to a "Super" model, developed an intermittent sickness and back…