Sub topic 15
Using Other Serial Terminal Programs
Assume you can upload an Arduino sketch, identify its serial port, and use Serial.begin() and Serial.println(). The Arduino IDE Serial Monitor is convenient, but other terminal programs can provide better logging, keyboard shortcuts, timestamps, or control over line endings.
Why use another terminal?
A serial terminal is a program that sends and receives bytes through a serial port. The Arduino appears as a serial port because its USB connection carries serial data.
External terminals are useful when:
- You want to save output directly to a log file.
- You need timestamps for each received line.
- You want to keep the terminal open while editing the sketch.
- You need to send exact control characters.
- The IDE Serial Monitor does not support a feature you need.
Only one program can usually use the Arduino's serial port at a time. Close the IDE Serial Monitor before opening another terminal.
Match the connection settings
The terminal must use the same settings as the sketch. The most important setting is the baud rate, which is the number of symbols sent per second.
| Setting | Typical value | Purpose |
|---|---|---|
| Port | `COM3` or `/dev/ttyACM0` | Selects the Arduino |
| Baud rate | `9600` | Must match `Serial.begin()` |
| Data bits | 8 | Number of data bits |
| Parity | None | Error-checking mode |
| Stop bits | 1 | Marks the end of a character |
| Flow control | None | Prevents hardware handshaking |
For example, this sketch uses 115200 baud:
void setup() {
Serial.begin(115200);
Serial.println(F("Arduino is ready"));
}
void loop() {
Serial.println(millis());
delay(1000);
}Common terminal programs include PuTTY on Windows, screen on macOS and Linux, and minicom or tio on Linux. A command-line terminal might be started like this:
screen /dev/ttyACM0 115200Replace /dev/ttyACM0 with the port shown by your operating system. On Windows, a graphical program such as PuTTY normally asks for the port name, speed, data bits, parity, stop bits, and flow control.
Sending input and handling line endings
External terminals differ in how they send the Enter key. Some send a line feed, some send a carriage return, and some send both. Your sketch should handle the endings that your terminal sends.
For command-based input, a line-oriented library or a small receive buffer is easier to extend than reacting to every character. For simple tests, inspect each received character and ignore '\n' and '\r'.
A terminal may also reset an Arduino when it opens the port. Wait for the startup message before sending a command. If the board resets, the first characters you send could be lost during startup.
Logging and troubleshooting
External terminals can record output, but logging adds work for the computer and may not preserve the exact timing of transmission. For timing-sensitive tests, keep the logging format simple and print at a controlled rate.
If no port appears, disconnect and reconnect the board, check the selected board and cable, and close programs that may already own the port. Linux may require permission to access the serial device. A terminal that opens successfully but shows nothing may have opened after the sketch printed its one-time startup message; reset the board or print periodically.
Exercise
Your sketch uses Serial.begin(9600), but an external terminal displays random symbols. What should you check first?
Show answer
Set the terminal speed to 9600 baud, then verify the selected port and the other serial settings.