Home General USR-IOT Serial-to-Ethernet Converters with Linux

USR-IOT Serial-to-Ethernet Converters with Linux

by n8ur

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:

# open virtual serial port
socat pty,link=$HOME/vmodem0,waitslave tcp: &
# run the program
# 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.

You may also like


Steen Andreassen December 3, 2019 - 8:39 am

Hi there

Very interesting reading. I’ve searched for this information for quite some time
How do you configure the USR-TCP232 unit when it comes to TCP/UDP/Servermode etc?

n8ur December 3, 2019 - 6:42 pm

Hi Steen —

I don’t have the system in front of me right now, but I think I was able to use pretty much the default settings on the USR-TCP232.

Frans October 3, 2022 - 9:39 am

Nice. Just had disable flow control in the web interface then i could short pins 2 & 3, connect with minicom and it echos back. whatever I type.

in one terminal
socat pty,link=$HOME/vmodem0,waitslave tcp:

in another
minicom -D $HOME/vmodem0

it does seem to drop inactive connections with these settings, have not looked into that yet.

Next is to try get modbus working.


Leave a Comment

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