PIDEasy is an easy-to-use PID (Proportional-Integral-Derivative) controller library for Arduino projects.
- Simple and lightweight
- Supports windup limits
- Includes derivative smoothing
- Allows output constraints
- Download the latest version of PIDEasy from the GitHub Releases.
- Extract the ZIP file.
- Move the
PIDEasyfolder 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, 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(-1000, 1000);myPID.setSmoothingDerivate(0.8);This project is licensed under the MIT License.
Feel free to contribute! Fork the repository and submit a pull request.