Tools for reading and analyzing Arduino serial monitor output for enhanced debugging...
This skill provides advanced tools for reading and analyzing serial monitor data from Arduino boards, enhancing the debugging experience beyond the basic Arduino IDE serial monitor.
t_ms=123 level=INFO event=sensor_read value=...; keep secrets and tokens
out of output.hardware-tdd for a test matrix and embedded-project-loop when
the next observation must come from a user-operated board.Serial.print("t_ms=");
Serial.print(millis());
Serial.print(" level=INFO event=ready board=");
Serial.println(BOARD_ID);
Use a fixed, bounded format appropriate to the board's memory budget. Do not log Wi-Fi passwords, API keys, certificates, tokens, or private data.
# Monitor serial port with default settings (9600 baud)
uv run --no-project scripts/monitor_serial.py --port COM3
# Specify baud rate and output file
uv run --no-project scripts/monitor_serial.py --port /dev/ttyACM0 --baud 115200 --output debug.log
# Filter for specific patterns
uv run --no-project scripts/monitor_serial.py --port COM3 --filter "ERROR|WARNING"
# Parse JSON data from serial
uv run --no-project scripts/monitor_serial.py --port COM3 --format json --pretty
# Monitor with timestamp and color coding
uv run --no-project scripts/monitor_serial.py --port COM3 --timestamp --color
# Detect common Arduino errors
uv run --no-project scripts/monitor_serial.py --port COM3 --detect-errors
--port: Serial port (e.g., COM3, /dev/ttyACM0)--baud: Baud rate (default: 9600)--output: Output file for logging--filter: Regex pattern to filter lines--format: Data format (text, json, csv, binary)--timestamp: Add timestamps to output--color: Enable color-coded output--detect-errors: Highlight common error patterns--timeout: Connection timeout in secondsFilter for: "low memory|stack overflow|heap"
Filter for: "sensor|reading|value"
Format as: json
Enable: --timestamp
Filter for: "start|end|duration"
Filter for: "timeout|failed|error"
Enable: --detect-errors
# Compile and upload, then monitor
arduino-cli compile --fqbn arduino:avr:uno sketch/
arduino-cli upload -p COM3 --fqbn arduino:avr:uno sketch/
uv run --no-project scripts/monitor_serial.py --port COM3
arduino-cli board list for available portsSerial.begin(9600))# Add user to dialout group
sudo usermod -a -G dialout $USER
# Logout and login again
Record the board, firmware/image version, toolchain, baud, port, reset cause, and timestamp source. Label serial output as hardware or system evidence only when it was captured on the target. Redact Wi-Fi passwords, API keys, certificates, tokens, and personal data before saving logs or sharing them.
uv 0.4+ (the script declares pyserial and colorama inline)uv run --no-project scripts/monitor_serial.py --help.// Arduino sketch
void setup() {
Serial.begin(9600);
}
void loop() {
float temp = analogRead(A0) * 0.488;
Serial.print("Temperature: ");
Serial.print(temp);
Serial.println(" C");
delay(1000);
}
uv run --no-project scripts/monitor_serial.py --port COM3 --filter "Temperature" --timestamp
// Arduino sketch with JSON output
#include <ArduinoJson.h>
void setup() {
Serial.begin(115200);
}
void loop() {
StaticJsonDocument<200> doc;
doc["temperature"] = analogRead(A0) * 0.488;
doc["humidity"] = analogRead(A1) * 0.146;
doc["timestamp"] = millis();
serializeJson(doc, Serial);
Serial.println();
delay(2000);
}
uv run --no-project scripts/monitor_serial.py --port COM3 --format json --pretty
Use the shared Arduino skill contract: state assumptions, required tools and versions, implementation steps, tests/evidence by proof stage, known limitations, and recovery/security notes.