0% found this document useful (0 votes)
4 views

8basics Inverted Pendulum

Uploaded by

vickyregar3035
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

8basics Inverted Pendulum

Uploaded by

vickyregar3035
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

INVERTED PENDULUM

The inverted pendulum problem is analogous to balancing a broom or a long pole on the
palm of your hand, which is something most of us have tried as a kid. When our eyes see
the pole falling to a certain side, they send this information over to the brain which
performs certain computations and then instructs your arm to move to a certain position
with a certain velocity to counter the pole's movement, which would hopefully bring the
tipping pole back up to vertical. This process is repeated several hundred times a second
which keeps the pole completely under your control. The inverted pendulum functions in
a similar manner. The aim is to balance a pendulum upside down on a cart that is allowed
to move about.
Instead of eyes, a sensor is used to detect the position of the pendulum which sends the
information over to a computer which performs certain computations and instructs
actuators to move the cart in a way to make the pendulum vertical again.

This problem of balancing a pendulum upside down requires insight into the movements
and forces that are at play in this system. Eventually, this insight will allow us to come up
with "equations of motion" of the system which can be used to compute relations
between the output that is going to the actuators and the inputs coming from the sensors.
CONTROL THEORY

Final equations of motion include:

• The angle of the pendulum to the vertical


• The angular velocity of the pendulum
• The angular acceleration of the pendulum
• The linear acceleration of the cart
Where the first three are quantities that are going to be measured by the sensor and the
last quantity is going to be sent to the actuator to perform.

The cart will be allowed to freely move on a set of rails giving it a single degree of
freedom. Here are the parts and supplies required to make the pendulum and the cart and
rails system:

ELECTRONICS

• One Arduino compatible board, any will work. I recommend an Uno in case you are not
too experienced with electronics because it'll be simpler to follow along.
• One Nema17 stepper motor, which will function as the actuator for the cart.
• One stepper motor driver, once again anything will work, but I recommend A4988
stepper motor driver because it will just be simpler to follow along.
• One MPU-6050 Six-Axis (Gyro + Accelerometer), which will detect the various
parameters such as angle and angular velocity of the pendulum.
• One 12v 10A power supply, 10A is actually a slight overkill for this specific project,
anything above 3A will work, but having the possibility to draw extra current allows for
future development where more power may be required.

HARDWARE

• 16 x bearings, I used skateboard bearings and they worked great


• 2 x GT2 pulleys and belt
• About 2.4 meters of 1.5-inch PVC pipe
• Bunch of 4mm nuts and bolts
Controlling the System (Proportional Control)

Initially, try out a basic proportional control system, that is, the velocity of the cart is
simply proportional by a certain factor to the angle that the pendulum makes with the
vertical. This was meant to be simply a test to make sure all the parts functioned
correctly.

Although, this basic proportional system was robust enough to make the pendulum
already balance.

While this control system worked remarkably well, it still had a few problems. If one
takes a look at the graph of the IMU readings over a certain time, we can clearly notice
oscillations in the sensor readings.
This implies that whenever the controller tries to make a correction, it is always
overshooting by a certain amount, which is, in fact, the very nature of a proportional
control system. This slight error can be corrected by implementing a different type of
controller which takes into account all these factors.
The code for the proportional control system is attached below. The code requires the
support of a few additional libraries which are the MPU6050 library, the PID library, and
the AccelStepper library. These can be downloaded using the Arduino IDE's integrated
library manager. Simply go to the Sketch >> Include Library >> Manage Libraries,
and then just search PID, MPU6050 and AccelStepper in the search bar and install them
by simply clicking on the Install button.
Controlling the System (PID Control)

Generally, in real life, once a control system proves to be robust enough for its
application, the engineers usually just complete the project rather than overcomplicating
the situations by using more complex control systems. But in our case, we are building
this inverted pendulum purely for educational purpose. Therefore we can try to progress
to more complex control systems such as PID control, which may prove to be far more
robust than a basic proportional control system.

Although PID control was far more complex to implement, once implemented correctly
and finding the perfect tuning parameters, the pendulum balanced significantly better. At
this point, it could also counter light jolts. The readings from the IMU over a given time
also prove that the readings never go too far away for the desired setpoint, that is, the
vertical, demonstrating that this control system is far more effective and robust than the
basic proportional control.
A robust PID library is already available for Arduino which was developed by Brett
Beauregard that can be installed from the library manager on the Arduino IDE.

Reference: https://www.instructables.com/Inverted-Pendulum-Control-Theory-and-Dynamics/

You might also like