MycilaUtilities
Utility helpers for Arduino / ESP32: PID controller, timing helpers, etc.
![]() |
![]() |
Quick links
- Source: https://github.com/mathieucarbou/MycilaUtilities
- Examples:
examples/ - API headers:
src/ - Classes reference:
docs/CLASSES.md
Releasing
Run the Bump version workflow with a major.minor.patch version to open a pull request against the default branch. The script can also be run locally as python3 .github/scripts/update-version.py 1.2.3; it updates the library descriptors, version macros, and current-version references in the README and documentation.
The workflow requires Actions to be allowed to create pull requests in the repository settings. Pull requests created with GITHUB_TOKEN do not trigger other workflows; optionally configure a VERSION_BUMP_TOKEN repository secret with a token that can write contents and pull requests to run the usual checks.
After merging the bump, create and push a tag for that commit. Run Publish to PlatformIO with the tag name (or latest for the most recently created tag). Configure the PLATFORMIO_AUTH_TOKEN repository secret before publishing.
Classes and utilities
This repository includes a few focused utility classes. See docs/CLASSES.md for the full short reference; the main types are:
Mycila::PID— flexible PID controller with modes, anti-windup, json export (optional), pause/resume and reset.Mycila::ExpiringValue<T>— value container with expiration semantics and optional JSON export.Mycila::string— string helper utilities (trim, case conversion, formatting floats).Mycila::Time— helpers for formatting Unix timestamps, converting HH:MM, and time-range checks.
Mycila::PID (src/MycilaPID.h)
A compact and flexible PID controller. Key features:
- Configurable Kp, Ki, Kd and tunings
- Proportional and derivative modes (ON_ERROR or ON_INPUT)
- Integral correction modes (OFF or CLAMP)
- Output limits and optional anti-windup
- Reverse mode, time-sampling mode, pause/resume, and reset with optional initial output
- State getters (pTerm/iTerm/dTerm/last input/output) and optional JSON export when
MYCILA_JSON_SUPPORTis enabled
PID Simulator
Full PID controller documentation is available at https://mathieu.carbou.me/MycilaUtilities/pid
Mycila::ExpiringValue (src/MycilaExpiringValue.h)
Holds a value with an optional expiration time (milliseconds).
- Update the value and obtain the old value
- Check presence/expiration and retrieve the value or an alternative
- Optional JSON export when
MYCILA_JSON_SUPPORTis enabled
Mycila::string (src/MycilaString.h)
Small string helper utilities:
- toLowerCase / toUpperCase
- trim, startsWith, endsWith
- to_string(float,double,decimals)
Mycila::Time (src/MycilaTime.h)
Time helpers:
- Format Unix timestamps to ISO8601 or local strings
- Convert HH:MM to minutes and check if a time is in a range
- Format seconds into D HH:MM:SS
If you’d like, I can expand this page with example snippets, code references, or copy parts of header comments into the docs.
Examples
See examples/ for demonstrations and working sketches, including a PID simulator and web UI examples.
Contributing
Contributions are welcome — please follow the CODE_OF_CONDUCT.md and open PRs against main.
License
MIT

