Original PIDEasy: https://github.com/vsjoaopedrovs/PIDEasy
This library is a fork of the original PIDEasy library.
- Simple and lightweight
- Supports windup limits
- Includes derivative smoothing
- Allows output constraints
- Download the latest version of PIDEasy-Improved from the GitHub Releases.
- Extract the ZIP file.
- Move the
PIDEasy-Improvedfolder to your Arduino libraries directory:- Windows:
Documents/Arduino/libraries - Mac:
~/Documents/Arduino/libraries - Linux:
~/Arduino/libraries
- Windows:
- Restart the Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries, search for
PIDEasy-Improved, and check if it's installed.
#include <PIDEasy.h>PID myPID(1.0, 0.5, 0.1); // Kp, Ki, Kdfloat error = desiredValue - actualValue;
unsigned long dt = millis() - lastTime;
float control = myPID.compute(error, dt);
lastTime = millis();myPID.setConstrain(-255, 255); // Limit outputmyPID.setWindUP(-255, 255);myPID.setSmoothingDerivative(0.8);myPID.setDampingFactor(0.8);This project is licensed under the MIT License.
Feel free to contribute! Fork the repository and submit a pull request.