CoderTools

Online Serial Port Debugger

Browser-based serial debugging tool - no download required, real-time monitoring via Web Serial API

Connection

Status: Disconnected

Data Monitor

Send Data

Interval (ms):

Statistics

0
Bytes Sent
0
Bytes Received
00:00:00
Connection Time
0
Data Rate (B/s)

Serial Port Debugger Documentation

How to Use This Tool

  1. Connect your serial device to the computer
  2. Configure connection parameters (baud rate, data bits, parity, stop bits)
  3. Click "Connect" to establish serial connection
  4. Monitor received data in real-time
  5. Send data in text or HEX format
  6. Use send history to repeat previous commands
  7. View connection statistics and data rate

Connection Parameters

Baud Rate
Data transmission speed (bits per second)
Data Bits
Number of bits per data frame (5-8)
Parity
Error detection method (None, Even, Odd)
Stop Bits
Frame end indicators (1 or 2)

Implementation Principles

This tool is implemented using the Web Serial API, a modern browser interface that allows web applications to communicate directly with serial devices. Below are the core implementation details:

Core API: Web Serial API

The tool is built on the Web Serial API, which provides JavaScript interfaces to access serial ports through the browser.

Main Features:

  • Native browser serial port access without installing drivers or plugins
  • Supports multiple serial port configurations (baud rate, data bits, parity, stop bits, flow control)
  • Bidirectional data communication using Readable/Writable Streams
  • Asynchronous operations based on Promises and async/await

Implementation Steps

1. Request Serial Port Access
const port = await navigator.serial.requestPort();

Use navigator.serial.requestPort() to prompt the user to select a serial port device. This requires user interaction to ensure security.

2. Configure and Open Port
await port.open({
  baudRate: 9600,
  dataBits: 8,
  parity: 'none',
  stopBits: 1,
  flowControl: 'none'
});

Call the port.open() method with configuration parameters including baud rate, data bits, parity, stop bits, and flow control.

3. Read Data
const reader = port.readable.getReader();
while (true) {
  const { value, done } = await reader.read();
  if (done) break;
  // Process received data (Uint8Array)
  const text = new TextDecoder().decode(value);
}

Get a reader from port.readable and use an async loop to continuously read data. Received data is in Uint8Array format and needs to be decoded using TextDecoder.

4. Send Data
const writer = port.writable.getWriter();
const encoder = new TextEncoder();
const data = encoder.encode('Hello Serial!');
await writer.write(data);

Get a writer from port.writable, use TextEncoder to convert strings to Uint8Array, then call writer.write() to send data.

5. Close Connection
await reader.cancel();
await reader.releaseLock();
await writer.releaseLock();
await port.close();

Before closing, release the reader and writer locks, then call port.close() to close the serial port connection.

Key APIs Used

  • navigator.serial.requestPort() - Request user to select a serial port
  • port.open(options) - Open serial port with configuration
  • port.readable.getReader() - Get read stream reader
  • port.writable.getWriter() - Get write stream writer
  • reader.read() - Read data from serial port
  • writer.write(data) - Write data to serial port
  • TextDecoder / TextEncoder - Convert between strings and byte arrays
  • port.addEventListener('disconnect') - Listen for device disconnect events

Key Features

Web Serial API

Direct browser access to serial ports without additional software

Real-time Monitoring

Live data monitoring with timestamp and auto-scroll support

HEX Mode

Send and receive data in hexadecimal format with validation

Send History

Track and replay previously sent commands

Statistics

Monitor data transmission rates and connection time

Multi-language

Support for Chinese, English, Japanese, French, and Spanish

Common Use Cases

Development & Debugging

  • Arduino and ESP32 development
  • Embedded system debugging
  • Firmware development and testing
  • IoT device configuration

Testing & Communication

  • AT command testing for modems
  • Sensor data monitoring
  • Protocol analysis and debugging
  • Industrial device communication

Browser Support & Requirements

Supported Browsers

  • Chrome 89+
  • Edge 89+
  • Firefox (not supported)
  • Safari (not supported)

Requirements

  • Chromium-based browser with Web Serial API support
  • HTTPS connection (required for Web Serial API)
  • User permission to access serial ports
  • Compatible serial device drivers installed

Related Standards and Specifications

RS-232: RS-232: Classic serial communication standard defining electrical characteristics and connector specifications
UART: UART: Universal Asynchronous Receiver-Transmitter, the core protocol for serial communication
USB-to-Serial: USB-to-Serial: Common serial conversion method in modern devices

For more information: Wikipedia RS-232, UART Protocol Standards Documentation

Quick Menu

No recent tools