Sub topic 14
Fixing Garbled Text, Missing Ports, and Silent Monitors
This chapter assumes you can upload a basic Arduino sketch and understand setup(), loop(), variables, and if statements. The examples use an Arduino Uno and the Arduino IDE.
Serial problems usually come from one of four places:
- The computer cannot find the board.
- The Serial Monitor and sketch use different baud rates.
- The sketch sends output before you open the monitor.
- The sketch sends data too quickly or to the wrong connection.
A practical troubleshooting path
Use this order. It prevents you from changing several things at once.
Missing port
A port is the operating system's connection to the board. In the Arduino IDE, open the board or port menu and look for a new entry after plugging in the board.
If no new port appears:
- Use a USB cable that carries data. Some cables only provide power.
- Try another USB socket.
- Disconnect other serial devices temporarily.
- Check that the board's power light turns on.
- Select the correct board model in the IDE.
- On some clone boards, install the driver for the USB-to-serial chip.
- Close other programs that may have claimed the port.
Do not select a port only because it is the first one in the list. Unplug the board, observe which port disappears, then reconnect it and select the port that returns.
Garbled text
The baud rate is the number of serial symbols transferred per second. The value passed to Serial.begin() must match the value selected in the Serial Monitor.
void setup() {
Serial.begin(9600);
Serial.println("Serial test started");
}
void loop() {
Serial.println("Readable text");
delay(1000);
}For this sketch, select 9600 baud in the Serial Monitor. If the monitor shows random symbols, check both values first. A mismatch such as 115200 in the monitor and 9600 in the sketch commonly produces garbled output.
The line-ending setting affects characters sent from the computer to the board. It does not normally cause outgoing text to become garbled.
A silent monitor
A message in setup() prints only once. If you open the Serial Monitor after the board has already started, you may miss that message. Opening the monitor often resets an Uno, but this depends on the board and connection.
Press the board's Reset button after opening the monitor. Then check whether the repeating message appears. Also make sure that:
- The selected port is still correct.
- The sketch was uploaded successfully.
- The board has power.
- The code reaches the
Serial.println()call. - The monitor is not connected to a different board.
A loop that prints only when a condition is true can also appear silent. Temporarily add a regular heartbeat message to show that the loop is running.
Output that slows the sketch
Serial output takes time. The Arduino places outgoing bytes in a buffer, and transmitting a long message can block when that buffer fills. Printing every pass through loop() can therefore slow sensor reads, timing, and control logic.
Print at a measured interval instead:
unsigned long lastPrint = 0;
const unsigned long PRINT_INTERVAL = 500;
void setup() {
Serial.begin(9600);
}
void loop() {
unsigned long now = millis();
if (now - lastPrint >= PRINT_INTERVAL) {
lastPrint = now;
Serial.print("A0=");
Serial.println(analogRead(A0));
}
// Other sketch work continues here.
}At 9600 baud, shorter messages and slower output reduce transmission time. When you need more frequent data, you can use a higher matching baud rate, but both sides must support and select it.
Exercise
Exercise
A sketch uses Serial.begin(9600), but the Serial Monitor displays unreadable symbols. What should you check first, and what should you do if the port is missing entirely?
Show answer
First select 9600 baud in the Serial Monitor. If the port is missing, check for a data-capable USB cable, try another USB socket, and confirm that the correct board port and any required USB driver are installed.