Common
Remote serial interfaces with socat
19. April 2019
0

I’m in the process of developing zcan, a software reading CAN bus messages from Zehnder ComfoAir Q series ventilation systems. I would like to streamline development on my laptop while the serial interface is attached to a micro PC close to the ventilation unit. That’s why I need a remote serial interface.

Installation

On Debian linux it’s fairly easy:

apt install socat

On MacOS (my dev machine) it’s also quite simple using Homebrew:

brew install socat

Usage

On the system with the serial interface directly attached I use the following command to connect the serial device /dev/ttyACM0 with TCP port 33333. The baud rate needs to be adjusted to whatever your device needs.

sudo socat TCP-L:33333 GOPEN:/dev/ttyACM0,ispeed=115200,ospeed=115200,b115200,raw,echo=0

On the client side I use this command to establish a virtual serial device at /tmp/ttyACM0:

socat pty,link=/tmp/ttyACM0,raw  tcp:<myRemoteHost>:33333

It works like a charm :-).

Leave a Reply

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