Skip to content

ByteVoltaTeam/PIDEasy

Repository files navigation

PIDEasy - Simple PID Library for Arduino

PIDEasy is an easy-to-use PID (Proportional-Integral-Derivative) controller library for Arduino projects.

🚀 Features

  • Simple and lightweight
  • Supports windup limits
  • Includes derivative smoothing
  • Allows output constraints

📥 Installation

Arduino IDE (Manual Installation)

  1. Download the latest version of PIDEasy from the GitHub Releases.
  2. Extract the ZIP file.
  3. Move the PIDEasy folder to your Arduino libraries directory:
    • Windows: Documents/Arduino/libraries
    • Mac: ~/Documents/Arduino/libraries
    • Linux: ~/Arduino/libraries
  4. Restart the Arduino IDE.
  5. Go to Sketch > Include Library > Manage Libraries, search for PIDEasy, and check if it's installed.

📖 Usage

1️⃣ Include the Library

#include <PIDEasy.h>

2️⃣ Create a PID Controller

PID myPID(1.0, 0.5, 0.1); // Kp, Ki, Kd

3️⃣ Compute the PID Output

float error = desiredValue - actualValue;
unsigned long dt = millis() - lastTime;
float control = myPID.compute(error, dt);
lastTime = millis();

4️⃣ Set Constraints (Optional)

myPID.setConstrain(-255, 255); // Limit output

5️⃣ Enable Windup Prevention (Optional)

myPID.setWindUP(-1000, 1000);

6️⃣ Adjust Derivative Smoothing (Optional)

myPID.setSmoothingDerivate(0.8);

📜 License

This project is licensed under the MIT License.

🤝 Contributing

Feel free to contribute! Fork the repository and submit a pull request.

About

An Arduino Library for PID Controller

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages