The command line interface can be used to create virtual serial devices. For more information, use the -h option.

$ serial_mux -h


If the Arduino runs code that makes use of the serialMux protocol, like in this sketch, the serial_mux command will create virtual serial devices.

Start the serial multiplexer on a serial device, e.g., /dev/ttyUSB0.

$ serial_mux /dev/ttyUSB0
Detected 2 virtual serial ports.
  Virtual serial device 1: /dev/pts/8
  Virtual serial device 2: /dev/pts/9

Press Ctrl+C to exit.


We can now run the demo program that uses two-way communication over the first virtual serial device.

$ python /dev/pts/8
received: 0
received: 1
received: 2

Simultaneously, we can look at the log messages that are written to the second virtual serial device.

$ picocom -q /dev/pts/9
time: 3432
time: 6860
time: 10290