llm-pid-tuner  by KINGSTON-115

LLM-driven PID auto-tuning CLI tool

Created 1 month ago
354 stars

Top 78.8% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a minimalist, LLM-driven PID auto-tuning system, available as a command-line interface (CLI) tool. It addresses the complexity and trial-and-error inherent in PID controller parameter tuning, offering a streamlined approach for users seeking to optimize control systems like heating elements or motors. The system benefits users by reducing setup time, minimizing tuning errors, and providing a safety net through parameter rollback, making advanced control tuning more accessible.

How It Works

The system operates in two primary modes: a local simulation mode using simulator.py (which can integrate with MATLAB/Simulink) and a real hardware mode. In hardware mode, an MCU or firmware sends serial data (CSV format) containing PID loop states (setpoint, input, error) to the tuner.py script or the standalone .exe. This data is then processed, and API calls are made to a configured Large Language Model (LLM) to analyze the system's response and generate suggested PID parameter adjustments. A key design choice is the inclusion of safety mechanisms, such as rollback to previously stable parameters if new suggestions lead to performance degradation.

Quick Start & Requirements

The most straightforward method for users is to download the pre-compiled llm-pid-tuner.exe from the project's Release page. For hardware integration, a serial-communicating device (e.g., Arduino, ESP32) is required, with an example firmware (firmware.cpp) provided. Upon first run, the tool generates a config.json file that must be populated with essential LLM API details (LLM_API_KEY, LLM_API_BASE_URL, LLM_MODEL_NAME, LLM_PROVIDER) and serial port settings (SERIAL_PORT, BAUD_RATE). Alternatively, dependencies can be installed via pip install -r requirements.txt for source-based execution. Links to Bilibili and YouTube tutorials are available for guided setup.

Highlighted Details

  • LLM-Powered Analysis: Leverages LLMs to interpret real-time PID loop performance data and generate tuning recommendations.
  • Automated Rollback: Features a robust fallback strategy that reverts to the last known stable PID parameters if performance deteriorates, prioritizing system stability.
  • Broad LLM Provider Support: Configurable for various LLM services, including OpenAI, DeepSeek, MiniMax, Claude (native and proxy), Ollama, and LM Studio, offering flexibility in API choices.
  • System Identification: Includes a system_id.py utility to perform initial system identification from step response data, providing a baseline for LLM tuning.

Maintenance & Community

Community discussion and support are available via a QQ group (1082281492). Detailed video tutorials are provided on Bilibili and YouTube. Internal design documentation is available in PROJECT_DOC.md.

Licensing & Compatibility

The project is licensed under the Apache-2.0 license. This permissive license allows for commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

This tool is not an automated "set-and-forget" solution; it assists rather than replaces the user's judgment. Crucially, when tuning real hardware, especially heating systems, users must implement their own independent hardware-level safety measures (e.g., over-temperature cutoffs, sensor failure detection) as the software does not substitute for essential safety engineering. Correct configuration of LLM API endpoints and serial communication parameters is critical for operation.

Health Check
Last Commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
21
Issues (30d)
3
Star History
171 stars in the last 30 days

Explore Similar Projects

Starred by Tobi Lutke Tobi Lutke(Cofounder of Shopify), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
6 more.

xTuring by stochasticai

0.0%
3k
SDK for fine-tuning and customizing open-source LLMs
Created 3 years ago
Updated 1 month ago
Feedback? Help us improve.