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 espal
Using pip
pip install espal
From source
git clone https://github.com/appositeit/espal.git
cd espal
pip install -e .
Requirements
- Python 3.10+
- Linux or macOS (uses Unix sockets)
Quick Start
# List available ESP32 devices
espal list
# Start monitoring (daemon starts automatically)
espal monitor
# Build and upload (daemon releases port automatically)
espal run
# Check daemon status
espal status
# Stop daemon
espal daemon stop
Usage
Monitor Commands
# Live monitoring (default)
espal monitor
# Monitor from last upload marker
espal monitor --since-upload
# Start with last N lines from buffer
espal monitor --tail 100
# Replay buffer and exit (no live monitoring)
espal monitor --replay
# Use legacy direct serial mode (no daemon)
espal monitor --legacy
Build Commands
# Build project
espal build
# Upload firmware
espal upload
# Build and upload
espal run
# Clean project
espal clean
Daemon Commands
# Show daemon status
espal status
# Stop the daemon
espal daemon stop
Device Selection
# Specify device manually
espal -d /dev/ttyUSB0 monitor
# Set baudrate
espal -b 115200 monitor
# Specify project directory
espal -p /path/to/project build
# Use USB VID:PID for device detection
espal --vidpid 10c4:ea60 monitor
# Or separate VID and PID
espal --vid 10c4 --pid ea60 monitor
Build System Integration
# PlatformIO
espal platformio esp32dev build
espal platformio esp32dev upload
# Arduino CLI
espal arduino esp32:esp32:esp32doit-devkit-v1 build
# ESP-IDF
espal espidf build
espal 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)
espal discover
# List devices with details
espal list
Architecture
ESPal uses a daemon-client architecture:
┌─────────────┐ ┌─────────────┐
│ Client │────▶│ Daemon │────▶ Serial Port
│ (espal) │ │ (espal.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
- Daemon continuously reads from serial port
- Data stored in ring buffer with timestamps
- Markers inserted at key events (upload_start, upload_complete)
- Clients subscribe and receive data in real-time
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file esp_pal-0.1.0.tar.gz.
File metadata
- Download URL: esp_pal-0.1.0.tar.gz
- Upload date:
- Size: 75.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3733ee17cde7dadf92d49cb230b0ccd73012d811c8234aeb9a1e280f09ccc1d
|
|
| MD5 |
3f2da11c4b36819cfbf63246fe74eaf2
|
|
| BLAKE2b-256 |
d92862bff1946367c6e927668a418c5920e16be747091f96afa639a50e74624c
|
File details
Details for the file esp_pal-0.1.0-py3-none-any.whl.
File metadata
- Download URL: esp_pal-0.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c05f6148d4990fa2de5e1e5651a142caa7d4df202bafdc351a472a1f08074b9e
|
|
| MD5 |
dbd101dfbcb352612855d87204e0eafc
|
|
| BLAKE2b-256 |
c0cd09af8e395876d85781ae2b5739c887f917be3a3dcb3c3c856622ef3d76cb
|