Differences between revisions 14 and 15
Revision 14 as of 2015-08-25 22:34:22
Size: 2527
Editor: CarlNobile
Comment:
Revision 15 as of 2015-08-31 14:38:06
Size: 2736
Editor: CarlNobile
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
This is a simple serial terminal program. It has been tested on Linux, but will most likely work on any platform. This is a simple half duplex serial terminal program. It has been tested on Linux, but will most likely work on any platform.

You will need to install the python serial package.

On a Debian based system. i.e. Ubuntu:
{{{
$ sudo apt-get install python-serial
}}}

With pip:
{{{
$ sudo pip install pyserial
}}}

Python Serial Terminal

This is a simple half duplex serial terminal program. It has been tested on Linux, but will most likely work on any platform.

You will need to install the python serial package.

On a Debian based system. i.e. Ubuntu:

$ sudo apt-get install python-serial

With pip:

$ sudo pip install pyserial

Features

  1. Generates a CSV file from the serial data. Serial data from the device must be formatted with commas between fields. The first row, after parsed, is taken to be the column length which all succeeding rows should equal.
  2. Add line numbers to the screen and CSV output.
  3. Set baud rate.
  4. Set serial device.
  5. Set output stream, default is current display terminal, but could be a file.
  6. Turn on the debug option. At present this will just print a parsed set of command-line options to the screen.
  7. Terminate the program with a Control-c (^c).

Download

Serial Terminal

Installation

Just put the file anyplace you would want to execute it. A good idea is to create a /home/{username}/bin directory. Most Linux systems will automatically add a $HOME/bin to you execution path. After sterm.py is where you want it you will want to make the script executable as shown below.

$ chmod 755 sterm.py

Help Screen

$ ./sterm.py -h
usage: sterm.py [-h] [-b BAUD] [-c CSVFILE] [-D] [-d DEVICE] [-l] [-n]
                [-s STREAM]

Serial console

optional arguments:
  -h, --help            show this help message and exit
  -b BAUD, --baud BAUD  Baud rate number, use -l to display available baud
                        rates.
  -c CSVFILE, --csv CSVFILE
                        CSV output filename
  -D, --debug           Debug output
  -d DEVICE, --device DEVICE
                        Serial device
  -l, --blist           List available baud rates.
  -n, --line-numbers    Prefix line numbers to each line.
  -s STREAM, --stream STREAM
                        Raw stream filename

Baud Rate List

$ ./sterm.py -l
1 4800
2 9600
3 19200
4 38400
5 57600
6 115200
7 230400
8 250000

Examples

  1. ./sterm.py -d /dev/ttyACM0 -b 6 -n -c filename.csv

    • Uses port /dev/ttyACM0 on Linux, set to 115200 baud, creates line numbers, and creates a CSV file of the data.

  2. ./sterm.py -d /dev/ttyACM0 -s display.out

    • Uses port /dev/ttyACM0 on Linux, set to 9600 baud (default), and sends the display data to a file.

  3. ./sterm.py -Dd /dev/ttyACM0

    • Uses port /dev/ttyACM0 on Linux, set to 9600 baud (default), and debug is turned on.

PythonTerminal (last edited 2015-08-31 14:38:06 by CarlNobile)