A Guide to Serial Terminal Settings
A comprehensive guide to serial port settings, including baud rates, data bits, parity, stop bits, and flow control, to ensure successful communication with your devices.
~8 minutes
When you connect to a serial device, you need to configure your terminal to match the device's settings. These settings, based on standards like RS-232, determine how the data is transmitted and interpreted. Let's break down the most common serial terminal settings and what they mean.
Baud Rate
The baud rate is the rate at which symbols are transmitted over the serial line, measured in bits per second (bps). For a serial connection to work, both the transmitting and receiving devices must be set to the exact same baud rate. If they are mismatched, the receiver will misinterpret the timing of the bits, resulting in garbled, unreadable data. For a deeper dive, see our article: Demystifying Serial Settings.
Common Baud Rates
You'll often encounter a standard set of baud rates:
- 1200
- 2400
- 4800
- 9600 (Very common for simple devices like Arduino)
- 19200
- 38400
- 57600
- 115200 (Common for development boards like ESP32)
So which one should you use?
- Check the Datasheet: The first place to look is the documentation for your device. It will often specify a default or recommended baud rate.
- Faster is Better, to a Point: A higher baud rate means faster data transfer. For applications sending a lot of data, like firmware uploads or streaming sensor data, a higher rate (e.g., 115200 or higher) is desirable.
- Reliability: At very high speeds and over long wires, signal integrity can become an issue, leading to errors. If you experience problems, try a lower baud rate. For most hobbyist projects with short USB cables, this is rarely an issue.
- Start with 9600: If you're unsure, 9600 is a safe and widely supported starting point.
Remember, there's no magic. It's just a setting. As long as both ends agree, it will work. The key is ensuring that agreement.
Data Bits
This setting determines the number of data bits in each character transmitted via the UART. It's usually 7 or 8. ASCII characters can be represented with 7 bits, but 8 bits is more common today as it supports a wider range of characters.
Parity
Parity is a simple form of error checking. It involves adding an extra bit to each character to ensure that the total number of 1s is either even or odd. The parity setting can be None, Even, or Odd.
- None: No parity bit is sent. This is the most common setting.
- Even: The parity bit is set to make the number of 1s even.
- Odd: The parity bit is set to make the number of 1s odd.
Stop Bits
Stop bits are sent at the end of each character to mark its end. The stop bits setting is usually 1 or 2. It provides a way for the receiving device to synchronize with the sender. Be aware that how your terminal interprets the end of a line is also important, which you can read about in ...our guide to line endings.
Flow Control
Flow control is a mechanism for preventing data loss when one device is sending data faster than the other can receive it. There are two main types of flow control, which are explained in detail in our article Flow Control.
- None: No flow control is used.
- Hardware (RTS/CTS): This method uses two extra wires in the serial cable, Request to Send (RTS) and Clear to Send (CTS), to signal when it's safe to send data.
- Software (XON/XOFF): This method uses special characters (XON and XOFF) sent over the data lines to start and stop the transmission of data.
Settings Summary Table
Here is a quick reference table for the most common serial port settings. The combination of 8 data bits, no parity, and 1 stop bit is often abbreviated as "8N1".
| Setting | Typical Values | Common Default | Notes |
|---|---|---|---|
| Baud Rate | 9600, 115200, 921600 | 9600 or 115200 | Must match on both devices. 9600 is common for Arduino, 115200 for ESP32/Raspberry Pi. |
| Data Bits | 7, 8 | 8 | 8 bits is the standard for almost all modern devices. |
| Parity | None, Even, Odd | None | Used for basic error checking, but typically disabled in favor of higher-level checks like CRC. |
| Stop Bits | 1, 2 | 1 | 2 stop bits is a legacy setting for very old, slow equipment. |
| Flow Control | None, RTS/CTS, XON/XOFF | None | Critical for high-speed data transfer or when the receiver can't process data as fast as it's sent. |
Understanding these settings is essential for successful serial communication. When in doubt, consult the documentation for the device you're working with to find the correct settings.