Inverted Pendulum System
Final Project, Microcontrollers
Snapshot Overview
Project Dates: August 2024 through December 2024
Technical Skills Used:
-
Control System Analysis & Design
-
Assembly Language Programming
-
C Language Programming
-
Sensor Integration
-
Stepper Motor Control
-
Microcontroller Integration
Project Outcome(s):
-
Successful design and assembly of an inverted pendulum system using a microcontroller for decision-making.
-
Integration of an encoder into the microcontroller-driven inverted pendulum system for real-time angle measurements. It was found that we would require an encoder with lower resolution to successfully implement the control system.

Building Microcontroller Knowledge & Skills
One of the courses I took during the studies for my M.S. degree was an Electrical Engineering Department course called Microcontrollers. This course provided an opportunity to learn more about programming and using microcontrollers for various embedded system applications. Some of the concepts that were covered in this course consisted of programming in assembly and C, bus structures, interrupts, timing, real-time control, parallel and serial interfaces, support devices, disassemblers, and related topics.
The majority of the homework assignments and the final project were completed using an ATmega328PB. We used both Assembly and C coding to transmit and receive communications with the ATmega328PB. In order to facilitate the communications between our computers and the microcontroller, we grew skilled at converting between decimal, binary, and hexadecimal number representations. To close out the course, we were tasked with using all of our learned skills to complete a feedback-related project using the ATmega328PB.
Implementing An Inverted Pendulum Controller
For our final project, my group decided to implement an inverted pendulum control system using our ATmega328PB. Inverted pendulum control is a classic controls problem that is found particularly challenging due to the system's nonlinearity. The basic set-up of an inverted pendulum system consists of a pendulum of mass, m, and length, L, which spins freely while attached to a cart of mass, M.
The angle, theta, of the pendulum from stability (theta is equal to 0), is usually determined either by and encoder attached to the pendulum base or an accelerometer attached on to the pendulum's free end. My group decided to use an encoder to determine the angle of the pendulum at any point in the program's runtime. Applied movement to the cart was provided by a stepper motor which was controlled by the ATmega328PB. We created a block diagram and developed a transfer function for the control of the cart's movement, and were able to get reasonable results. After lots of testing, we noticed that we were missing steps or ticks on our encoder at points where the pendulum and cart began moving larger amounts. We realized that the resolution of our encoder was actually likely to fine to control our system with the overall resolution of our stepper motor movements and cart quality.


