How to Tune a PID Controller for an Inverted Pendulum | DigiKey
Автор: DigiKey
Загружено: 18 сент. 2023 г.
Просмотров: 69 326 просмотров
This tutorial demonstrates how to manually tune a PID controller to operate an inverted pendulum. Shawn uses the STEVAL-EDUKIT01 kit from STMicroelectronics, which includes an Arduino, encoder, and stepper motor connected together to create a feedback loop. The stepper motor rotates the encoder back and forth, and the encoder allows a bent rod to rotate freely around its axis. The intent is to design a controller in code that can make the rod (“pendulum”) stand upright with no human intervention.
You can learn more about PID controller theory in the previous video:
• What is a PID Controller? | DigiKey
Shawn uses a single PID controller in the video to maintain the rod in a vertical position. You can read about manual PID controller tuning here:
https://www.digikey.com/en/maker/proj...
The Arduino reads encoder values, which are sent to a Python program on a computer. The Python program acts as the PID controller in order to compute the stepper motor angle that is then sent back to the Arduino. The Arduino drives the stepper motor as requested by the Python PID controller.
Sending and receiving commands over a USB serial port is much slower than running the PID controller program directly on the Arduino. However, it allows us to construct pretty graphs and tune the PID controller much more easily. In other words, it’s great for teaching and demonstration but bad for production.
Manually tuning a PID controller consists of setting Ki and Kd to zero and slowly increasing Kp to find a point where the output almost (but not quite) reaches the setpoint without oscillating. From there, Ki is increased to remove the remaining steady-state error between output and setpoint. Ideally, the system should overshoot slightly but not oscillate around the setpoint.
In many cases, a PI controller is all that is needed. If overshoot is unacceptable, you can increase Kd so that the response approaches the setpoint quickly without overshooting. If Kp, Ki, or Kd are too high, you will find that your system begins oscillating (often uncontrollably). With properly tuned constants, you have a “critically damped” system.
PID controllers are widely popular in control theory and can be found in many places, especially in automotive and industrial applications.
Product Links:
STEVAL-EDUKIT01 - https://www.digikey.com/en/products/d...
Related Videos:
How to Control Output Voltage using a PID - • How to Control Output Voltage using a...
Related Project Links:
Introduction to PID Controllers - https://www.digikey.com/en/maker/proj...
How to Tune a PID Controller - https://www.digikey.com/en/maker/proj...
Related Articles:
STMicroelectronics Inverted Pendulum Kit Documentation - https://www.st.com/en/evaluation-tool...
STMicroelectronics Inverted Pendulum Kit Curriculum - https://www.st.com/content/st_com/en/...
Learn more:
Maker.io - https://www.digikey.com/en/maker
DigiKey’s Blog – TheCircuit https://www.digikey.com/en/blog
Connect with DigiKey on Facebook / digikey.electronics
And follow us on X (formerly Twitter) / digikey
00:00 - Introduction to the Inverted Pendulum
01:09 - What is a PID Controller
02:17 - How to Tune a PID Controller
03:30 - Arduino Code to Measure Encoder and Drive Stepper Motor
05:19 - Python Code on PC Used to Communicate with Arduino
09:06 - Python Code Used as PID Controller
13:37 - Where to Find Code
14:02 - Tune Kd in the PID Controller
16:39 - Tune Ki in the PID Controller
19:33 - Tune Kd in the PID Controller
23:02 - Tune Bias Term in the PID Controller
24:03 - Conclusion

Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: