Skip to content

kwlew/PIDEasy-Improved

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PIDEasy-Improved - PID Controller library for Arduino based environments.

This library is a fork of the original PIDEasy library.

🚀 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-Improved from the GitHub Releases.
  2. Extract the ZIP file.
  3. Move the PIDEasy-Improved 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-Improved, 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(-255, 255);

6️⃣ Adjust Derivative Smoothing (Optional)

myPID.setSmoothingDerivative(0.8);

7️⃣ Adjust Damping Factor (Optional)

myPID.setDampingFactor(0.8);

8️⃣ Check example for more info.

📜 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 easy PID controller creation, tailored specifically for line follower robots.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages