Inverted pendulum on a cart

The inverted pendulum system is a popular demonstration of using feedback control to stabilize an open-loop unstable system. Although, people know this as Segway! All we need to do is find the right speed that we need in order to balance the stick right? Well, it’s not that easy!
For this particular system, we used an Arduino Uno, 3 DC motors, a motor driver and a 9V battery. Under the hood, we used a custom PID controller that had a relatively small code. The tricky part was to calculate the values for the P, I and D variables!
Our Method
Observe the open loop system before adding the PID control and define which point needs improvement. Then add the Proportional control to improve the time it gets to raise the bar, the Integral control to improve the excess and finally the Derivative control to eradicate the constant error. For faster results though, we used Routh’s criterion to calculate the values of the controller and then tinker with it until we got the best result we could.