How to use a serial terminal

Many pieces of field and laboratory equipment, our products included, utilize serial communication to interface with your computer. Serial connections allow you to send commands to an instrument to configure it and receive data back for setup or logging.  This blog post will briefly explain how to use a free serial terminal application to connect to and communicate with any serial device. By the end you will be a pro and ready to go control anything with a serial port on the back!

What is serial communication?

Serial communication between two devices refers to the method by which they transfer information – one bit at a time or serially. This is opposed to parallel communication, in which many bits may be sent simultaneously (often 8 or 16 at a time to make a byte or word). Serial communication transfers data one bit at a time (“bit-by-bit!”).

Although it generally involves slower data transfer rates, this method has several advantages. For instance, serial communication is easily configurable and commonly used in embedded systems. Additionally, it requires fewer data transfer wires simplifying the electronics and cabling requirements.

Most of our products connect with your computer using a universal serial bus (USB) port. If your instrument utilizes a serial connector (often a DB9 style connection), it may be necessary to purchase a serial to USB adapter if your computer does not have the appropriate port. In fact, these are handy to have out in the field as you never know what instrumentation you may encounter. 

How to connect with and configure your instrument

The first step involved in configuring your instrument is to download the CoolTerm application. There are many serial terminal tools available, but CoolTerm is a free, easy to use serial communication application that we often use in the shop and the field. Download the application for your operating system and follow the installation instructions in the README file on where to place the files for the application.

Default CoolTerm window

Step 1 – Identify the Device

In order to identify the device you want to connect to, first make sure that the device is not connected to your computer. In CoolTerm, go to Connection → Options → Port, and take stock of the identified devices.

Now, connect your instrument to your computer and click “Re-Scan Serial Ports.”

COM3 has appeared as a newly added port, so we know that it is our device. Ports are not called COM on Max/Linux systems, but the idea is identical.

Step 2- Configure

Before connecting, take a look at your device manual to determine the baud rate (data transmission rate) that your instrument uses. If you don’t know the baud rate a guess and check method can be employed, but we’ve found many geophysical instruments have 9600 baud as a default. 

You may want to change some of the default settings to make the application easier to use. For example, if you attempt to type a command, you won’t see anything appear on screen even though it is sent to the instrument. Additionally, any errors that you make cannot be remedied because the characters are sent to the device as you hit each key. This can be fixed by going to Connection→Options→Terminal, and clicking “Line Mode.” You will then be able to see and edit your commands before sending them.

 If the data is TAB formatted the default settings format the tabs as a period character. This is especially annoying if your data contain numerical data with decimal values! You can change this setting in Connection→Options→Data Handling, by clicking “Format TAB separated text.”

 

Data from RTD sensors before TAB formatting.
Data after formatting

Step 3 – Connect

Press “OK”, then click “Connect” at the top of the application screen. You should see the red “Disconnected” text at the bottom of the screen change to “Connected.”

That’s it! You are now connected to the device and it is ready to send and receive data!

Sending commands to your instrument

The commands that you send to your instrument will depend on what device you are using. The available commands may be found in the documentation of that device. 

In order for the computer and device to effectively speak to one another, serial communication relies on a set of rules for how data is transmitted. These rules include the baud rate, number of bits per packet of data, number of stop bits, and whether or not parity (error checking) is enabled. These settings can be altered in Connection Options. Most of the time parity will be turned off, there will be eight data bits, and one stop bit. If your device is configured differently, it should be recorded in the documentation. It is important that your computer and device are on the same page regarding these settings. If a command allows you to change the baud rate used by your instrument, for example, you must be sure to change this setting in CoolTerm, as well.

Example Commands

The device demonstrated in this blog post is the Leeman Geophysical 4-Channel RTD Interface, which allows you to connect up to four resistance temperature detectors (RTDs) and serially transfer readings to your computer, as well as send an analog temperature-dependent signal to other devices such as analog to digital converters. The commands for this device are listed in the documentation.

Commands from the Leeman Geophysical RTD Interface Documentation.

To view my settings, I input the command SHOW. To take a temperature reading from all sensors, I type the command READ.

Command outputs from the RTD Interface. The reading from a temperature sensor is boxed in red.

Conclusion

Sending serial commands to your instruments is a simple process that allows you to interface with and configure attached equipment. It may seem mystical  or complicated at first, but following the simple steps of identify, configure, and connect will make connecting to equipment a snap! Our team uses serial communications every single day and have even been tasked with reverse engineering serial commands from instruments whose manufacturer went out of business! If you’ve got a tough communications problem or and instrument that just won’t cooperate, drop us a line!