Skip to main content

ESP32 development tool with daemon-based serial port sharing

Project description

ESPal - ESP32 Development Tool

ESPal is a daemon-based tool for ESP32 development that solves the serial port sharing problem between monitoring and firmware uploads.

The Problem

When developing for ESP32, the serial port is used for both:

  • Monitoring - viewing debug output from your device
  • Uploading - flashing new firmware

These operations conflict because only one process can hold the port at a time. ESPal solves this with a daemon architecture where:

  • A daemon continuously monitors the serial port
  • Data is cached in a ring buffer (50MB default)
  • Multiple clients can read simultaneously
  • Build/upload operations coordinate port access automatically

Features

  • Daemon Architecture - Background daemon owns the serial port
  • Ring Buffer - Cached output survives uploads, can replay "since last upload"
  • Multiple Clients - User and AI assistants can monitor simultaneously
  • Auto-spawn - Daemon starts automatically when needed
  • VID:PID Detection - Track devices by USB ID, not port number
  • Build Integration - PlatformIO, Arduino CLI, and ESP-IDF support
  • Idle Shutdown - Daemon auto-exits after 30 minutes idle

Installation

Using pipx (recommended)

pipx install esp-pal

Using pip

pip install esp-pal

From source

git clone https://github.com/appositeit/esppal.git
cd esppal
pip install -e .

Requirements

  • Python 3.10+
  • Linux or macOS (uses Unix sockets)

Quick Start

# List available ESP32 devices
esppal list

# Start monitoring (daemon starts automatically)
esppal monitor

# Build and upload (daemon releases port automatically)
esppal run

# Check daemon status
esppal status

# Stop daemon
esppal daemon stop

Usage

Monitor Commands

# Live monitoring (default)
esppal monitor

# Monitor from last upload marker
esppal monitor --since-upload

# Start with last N lines from buffer
esppal monitor --tail 100

# Replay buffer and exit (no live monitoring)
esppal monitor --replay

# Use legacy direct serial mode (no daemon)
esppal monitor --legacy

Build Commands

# Build project
esppal build

# Upload firmware
esppal upload

# Build and upload
esppal run

# Clean project
esppal clean

Daemon Commands

# Show daemon status
esppal status

# Stop the daemon
esppal daemon stop

Device Selection

# Specify device manually
esppal -d /dev/ttyUSB0 monitor

# Set baudrate
esppal -b 115200 monitor

# Specify project directory
esppal -p /path/to/project build

# Use USB VID:PID for device detection
esppal --vidpid 10c4:ea60 monitor

# Or separate VID and PID
esppal --vid 10c4 --pid ea60 monitor

Build System Integration

# PlatformIO
esppal platformio esp32dev build
esppal platformio esp32dev upload

# Arduino CLI
esppal arduino esp32:esp32:esp32doit-devkit-v1 build

# ESP-IDF
esppal espidf build
esppal espidf flash

Configuration

PlatformIO

Add VID/PID to your platformio.ini:

[env:esp32dev]
platform = espressif32
board = esp32dev
monitor_speed = 115200
upload_vidpid = 10c4:ea60

Common ESP32 VID:PID Values

Chip VID:PID
Silicon Labs CP2102 10c4:ea60
CH340 1a86:7523
FTDI FT232 0403:6001
Espressif USB JTAG 303a:1001

Finding Your Device's VID:PID

# Interactive discovery (recommended)
esppal discover

# List devices with details
esppal list

Architecture

ESPal uses a daemon-client architecture:

┌─────────────┐     ┌─────────────┐
│   Client    │────▶│   Daemon    │────▶ Serial Port
│  (esppal)    │     │  (esppal.d)  │
└─────────────┘     └─────────────┘
                          │
┌─────────────┐           │
│  AI Client  │───────────┘
└─────────────┘
  • Daemon - Owns serial port, manages ring buffer, coordinates builds
  • Clients - Connect via Unix socket, subscribe to data stream
  • Ring Buffer - 50MB default, stores timestamped data with markers

Data Flow

  1. Daemon continuously reads from serial port
  2. Data stored in ring buffer with timestamps
  3. Markers inserted at key events (upload_start, upload_complete)
  4. Clients subscribe and receive data in real-time
  5. Clients can request replay from any marker

Development

# Run tests
pytest tests/ -v

# Run specific test file
pytest tests/test_buffer.py -v

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

esp_pal-0.1.1.tar.gz (75.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

esp_pal-0.1.1-py3-none-any.whl (60.5 kB view details)

Uploaded Python 3

File details

Details for the file esp_pal-0.1.1.tar.gz.

File metadata

  • Download URL: esp_pal-0.1.1.tar.gz
  • Upload date:
  • Size: 75.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for esp_pal-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f32a7bac4c58f4686c11394385cb77f61eea32da189321712930c148bc121806
MD5 d8edb7df8502cb3916293f329ca1e6a5
BLAKE2b-256 3f6f4d7eac6947c1641ef11c6d2d3cebe2e3b7ac5d592ed11620053ea6418964

See more details on using hashes here.

File details

Details for the file esp_pal-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: esp_pal-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 60.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for esp_pal-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3fe8d5befd292dd77a235a875f3026c69194ac98e11fcefbbe58044467568db
MD5 071d60daa51acd628bf6416e1031c562
BLAKE2b-256 184fb4d4dc9b913192aeb7dea6067f461950d92cc7a53bf1509419fcfc3f3257

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page