REPORT ON AUTONOMOUS SYSTEM AND
CONTROL LABORATORY ELP7100
Stabilization Of Inverted Pendulum
Submitted by Group No: 6
1. Nikhil Kumar Yadav
2025EEA2417
2. Muhammed Aslam A
2025EEA2819
3. Riteen Shaw
2025EEA2867
Under the guidance of
Prof. SUBASHISH DATTA
In partial fulfillment of the requirements
for the award of the degree of
Master of Technology
Department of Electrical Engineering
INDIAN INSTITUTE OF TECHNOLOGY DELHI
August 2025
Contents:
1. Overview
2. Material List
3. List of Notations
4. Experiment Objective
5. Methodology
6. Experimental Results
7. Conclusion
1. Overview:
The inverted pendulum system has become a common engineering
challenge for students. It is a classic example of how an automatic
control system works. It includes Mathematics, Physics, and many
calculations. The inverted pendulum is an unstable and non-linear
system. This system is either in stable or unstable. In stable condition
the pendulum arm is pointing towards downward and in unstable
condition the arm of the pendulum is inverted and pointing towards
upward direction.
2. Material Required:
1. Motor shaft flange and M3x8 mm machine screws
2. Nema17 stepper motor and encoder L-bracket
3. Motor cables
4. 12 V power supply
5. Rotary encoder with M3x8 mm precision screw and washer
6. M3x20 mm machine screw and 10 mm stand-offs
7. X-NUCLEO-IHM01A1 motor driver expansion board
8. NUCLEO-F401RE development board
9. Zip ties
10. M3x16 mm machine screws
11. Adhesive rubber cushions and paper clip
12. M3 machine nuts
13. Acrylic pendulum tower sidewalls
14. Acrylic pendulum base
15. Acrylic motor mount
16. Aluminium pendulum rod
17. Screwdriver
3. List of Notations:
• θ=pendulum angle from vertical
• Φ = rate of change of angle
• m = mass of pendulum
• l= length of pendulum
• g= acceleration due to gravity
4. Experiment Objective:
The aim of this experiment is to design and understand that how an
unstable system should be balanced in certain angle and position,
in this experiment we are try to stabilized an INVERTED
PENDULUM. Our goal is to stabilize the pendulum arm in upright
direction on a certain angle and position using some control system.
5. Methodology
We were provided with STEVAL-EDUKIT01 by STMicroelectronics. The
STEVAL-EDUKIT01 contains all components, control boards and
mechanical parts to build a high performance rotary inverted pendulum.
STEVAL-EDUKIT01 evaluation kit
5.1 System Assembling
First, we attached the motor shaft flange to the encoder L-bracket with
four M3x8 mm screws and secure them with four M3 nuts. Then installed
the rotary encoder on the flange with the encoder body over the
previously installed M3 nuts and used the provided M3x8 mm precision
screws with washer and spring tensioner. We peeled off the acrylic
motor mount protective film and installed the stepper motor using four
M3x8 mm machine screws. Attached the four rubber pads over the 5 mm
holes on base plate to ensure a firm grip on any surface.
For building the system tower:
⚫ Interlocked the sidewalls to each other and place them on the base.
⚫ Fixed them with screws and nuts.
To assemble the motor and the encoder system:
⚫ Installed the motor cable.
⚫ Placed the motor mount on top of the tower and secure it with four
M3x16 mm screws and four nuts.
⚫ Inserted the motor shaft in the motor flange and secure it with a
M3x8 mm screw
Then, we attached the tower assembly to the system base using four
M3x16 mm screws and nuts. The motor and encoder cables was taken
out from the evaluation board sides. After we fixed the NUCLEO-F401RE
development board to the base using the M3x20 mm screws
and plastic standoffs. Then we installed the pendulum rod on the
encoder shaft and secured it with a M3x8 mm screw.
We mounted the X-NUCLEO-IHM01A1 expansion board on top of the
NUCLEO-F401RE development board. For that, we aligned the Arduino
connectors pins and sockets on the two boards.
Connected the following cables to the X-NUCLEO-IHM01A1:
• The rotary encoder cables:
1. positive (power) wire – E1 (red)
2. negative (ground) wire – E2 (black)
3. phase 1 – E3 (white)
4. phase 2 – E4 (green)
• The stepper motor cables:
1. phase A1 – M1A (red)
2. phase A2 – M1B (blue)
3. phase B1 – M2A (yellow)
4. phase B2 – M2B (orange)
• The power supply cables:
1. positive (12 V) – PS+ (black with white stripe)
2. ground – PS- (black)
X-NUCLEO-IHM01A1 cable connections
5.2. Control Synthesis Procedure
The rotary inverted pendulum can be modeled in two parts:
• Rotor dynamics:
The motor drives the rotary arm, and its input is proportional to
angular acceleration. This is modeled as a double integrator:
Grotor(s)=
• Pendulum dynamics (suspended mode):
The pendulum angle θ(s) responds to the rotor angle ϕ(s) as:
Gpend(s)=
where ωr is the resonance frequency, ωg is the natural frequency,
and Q is the quality factor (related to damping). These parameters
depend on pendulum length, mass, and inertia.
The open-loop system Gpend(s) Grotor(s) is unstable and lightly damped,
which motivates the use of PID control.
A dual-loop PID control system is used to stabilize and control the
pendulum:
1. Inner loop (rotor PID):
This loop forces the rotor angle ϕ to follow the command quickly
and prevents long-term drift.
The rotor closed-loop transfer function is:
2. Outer loop (pendulum PID):
Using the rotor as an actuator, the pendulum closed-loop transfer
function becomes:
In rotor loop, start with PD control to stabilize the 1/s2 dynamics,
then add a small integral term if zero steady-state error is required.
Make sure the rotor loop is significantly faster than the pendulum
loop. Use PD to add damping at the pendulum’s resonance
frequency. Tune Kp to achieve a phase margin above 30°. Finally,
add a small Ki for steady-state accuracy. Check stability margins
(Bode/Nyquist), minimize overshoot, and confirm disturbance
rejection.
5.3. Control Implementation
First, we needed to install a software STM32CubeProgrammer to our
system for the installation of firmware. After completion of installation
of STM32CubeProgrammer just restart the software and connect the
EduKit to our computer using USB cable.
Select the Connect Button on the STM32CubeProgrammer to connect
the kit with the software. Select Download Button on Programmer.
Select Browse and select the Reference Firmware file. Reference
Firmware file can be downloaded from STMicroelectronics official
website. After selecting the reference firmware ensure that Verify
Programming is checked and Run After Programming is checked. Then
select start programming and then we can select disconnect. Now our
program of inverted pendulum is uploaded to the board.
The rotary inverted pendulum also provides output data via USB cable
with a baud rate of 115200. Output data values include:
1. time (seconds)
2. cycle delay (milliseconds)
3. pendulum angle (degrees)
4. rotor angle (degrees)
5. current combined pendulum, rotor and auto slope correction PID
6. rotor control output (degrees)
7. rotor position reference command (degrees)
We can observe the outputs and can change P, I and D values of
Pendulum and Rotor on Matlab.
[Link]
Ol/view?usp=sharing
We can download this Matlab file and then select Run to start the
Workbench and view real time system operation. You may select Sine Off
or Sine On, Rotor Step Off, Rotor Step On, for an initial demonstration.
6. Experimental Results
This is the final result after assembling and running the code for the
experiment.
After successfully completing the mechanical assembly and performing
the firmware installation pendulum.m file is executed on the MATLAB
software, it shown the live waveforms for rotor angle, pendulum angle,
rotor tracking command and rotor control.
We can change the P, I and D values of rotor and pendulum here and
observe the changes accordingly.
Also STMicroelectronics provide other MATLAB files on there website
from which we can observe various outputs and functions of our inverted
pendulum. Some of them are attached below.
Root locus with PD control
7. CONCLUSION:
The inverted pendulum experiment was successfully carried out using a
PID controller. By varying the proportional, integral, and derivative gains,
we observed clear changes in the system response. Increasing the
proportional gain improved the speed of response but introduced higher
oscillations. The derivative gain helped to reduce overshoot and stabilize
the pendulum more effectively, while the integral gain minimized steady-
state error but made the system more sensitive to oscillations.
Through these observations, we confirmed the practical effects of PID
parameters on system stability and performance. The experiment
demonstrated the importance of proper tuning to achieve a balance
between fast response, low overshoot, and steady-state accuracy.