You can send and receive data from serial devices in Linux using command-line utilities like Screen or Minicom, or by redirecting the echo command. Before establishing a connection, you must identify the correct serial port path, which is typically found at /dev/ttyUSB0 for USB serial adapters.
How to Identify the Serial Port
Connect the serial adapter to the computer.
Open a terminal and run
dmesg | tailto look for the attached converter path, or runls -tr1 /dev/tty* | tail -n 1to print the newest created serial adapter.
How to Connect Using Screen
Run
screen /dev/ttyUSB0 9600in the terminal to transmit and read text.Disconnect while leaving the session open by pressing Ctrl+a then Ctrl+d, or quit completely by pressing Ctrl+a then k, and 'y' to kill the session.
How to Connect Using Minicom
Run
minicom -b 9600 -D /dev/ttyUSB0to open an interface to send text.Quit the application by pressing Ctrl+a, then z, then x.
Configure presets using the setup mode by running
minicom -s.
How to Write Directly to the Serial Device
Set the port speed with
stty -F /dev/ttyUSB0 speed 9600.Send text for one-way communication by running
echo helloworld >/dev/ttyUSB0.
Workarounds for Serial Device Errors
Resolve permission denied errors by adding your user account to the 'dialout' group or the group with control of the serial port. Check group ownership with
ls -l /dev/ttyUSB0and add your account by runningsudo usermod -a $(whoami) -G dialout, then log out and back in or restart the computer for the changes to take effect.Fix scrambled text by correcting baud rate mismatches on either the computer or the device. Check the device's sticker or user manual for the correct port settings and configure them accordingly.
Applicable To
PL2303-DB9