{"id":127,"date":"2025-07-18T00:36:29","date_gmt":"2025-07-18T00:36:29","guid":{"rendered":"https:\/\/www.rickykurosawa.com\/?page_id=127"},"modified":"2025-07-20T08:13:22","modified_gmt":"2025-07-20T08:13:22","slug":"balancing-an-inverted-pendulum-using-classic-control-theory-techniques","status":"publish","type":"page","link":"https:\/\/www.rickykurosawa.com\/?page_id=127","title":{"rendered":"Balancing an inverted pendulum using classical control theory techniques"},"content":{"rendered":"\n<h3 class=\"wp-block-heading alignwide\">Introduction and Goals<\/h3>\n\n\n\n<div class=\"wp-block-columns alignwide are-vertically-aligned-top is-layout-flex wp-container-core-columns-is-layout-3a88641f wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"wp-block-paragraph\">In the final ENGS 26 project, our goal was to use skills learned in the class to balance an inverted pendulum that is inherently unstable when perturbed from equilibrium. This was accomplished through math modeling the dynamics of the car and pendulum, testing the transient behavior of the car parts (motor, sensor, etc), and doing root-locus analysis to make our system stable. After two hard-working weeks, my teammate and I were able to make a working car that balances our pendulum.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-top is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"1154\" src=\"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_3BE3CA96335B-1-1-edited.jpeg\" alt=\"\" class=\"wp-image-172\" style=\"width:253px;height:auto\" srcset=\"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_3BE3CA96335B-1-1-edited.jpeg 602w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_3BE3CA96335B-1-1-edited-156x300.jpeg 156w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_3BE3CA96335B-1-1-edited-534x1024.jpeg 534w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><figcaption class=\"wp-element-caption\">This is the car balancing the pendulum arm<\/figcaption><\/figure>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns alignwide is-layout-flex wp-container-core-columns-is-layout-3a88641f wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h3 class=\"wp-block-heading\">Math Modeling and Approach<\/h3>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns alignwide is-layout-flex wp-container-core-columns-is-layout-3a88641f wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"wp-block-paragraph\">To begin the math-modeling process, my partner and I made several assumptions to make the modeling manageable. The most important and significant assumption we made was that the pendulum arm must be in the linear range. This system can quickly become super nonlinear super quickly, but we decided to work with very small-angle perturbations to approximate sine(x) to x. This assumption and physical setup allowed the model to be significantly simpler. Another important assumption was that the pendulum arm&#8217;s mass can be approximated to be in the center of mass since the mass of the stick was significantly less than the chassis. Lastly, we assumed that the car&#8217;s movement will be applied as a torque directly on the pendulum arm without any significant losses.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We tried to get the differential equations in two methods. The Euler-Lagrange equations and torque balance. To me, torque balance makes a bit more sense since we build the equations up with the intuitive equations of Newton. With this, we were able to make the block diagram that eventually led us to success. Many of the transfer functions for the blocks were found in the lab, which won&#8217;t be discussed in detail here. Theta\/Tau represents the differential equation found by torque balancing.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"2251\" height=\"668\" src=\"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.45.42\u202fAM-edited.png\" alt=\"\" class=\"wp-image-168\" style=\"width:492px;height:auto\" srcset=\"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.45.42\u202fAM-edited.png 2251w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.45.42\u202fAM-edited-300x89.png 300w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.45.42\u202fAM-edited-1024x304.png 1024w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.45.42\u202fAM-edited-768x228.png 768w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.45.42\u202fAM-edited-1536x456.png 1536w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.45.42\u202fAM-edited-2048x608.png 2048w\" sizes=\"auto, (max-width: 2251px) 100vw, 2251px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading alignwide\">Root-Locus and Compensator Design<\/h3>\n\n\n\n<div class=\"wp-block-columns alignwide is-layout-flex wp-container-core-columns-is-layout-3a88641f wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"wp-block-paragraph\">To make our system respond quickly while removing steady-state error to 0, we chose to use a PID controller. These specifications were desired considering that the pendulum is starting at an unstable solution. This means that a steady-state error of 0 is necessary for the pendulum to stop moving. The derivative part of the controller was also crucial. It was implemented to improve the transient performance, which essentially allows for anticipation of the pendulum arm and reduce overshoot and settling time.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1813\" height=\"1279\" src=\"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.53.11\u202fAM-edited.png\" alt=\"\" class=\"wp-image-170\" style=\"width:510px;height:auto\" srcset=\"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.53.11\u202fAM-edited.png 1813w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.53.11\u202fAM-edited-300x212.png 300w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.53.11\u202fAM-edited-1024x722.png 1024w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.53.11\u202fAM-edited-768x542.png 768w, https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/Screenshot-2025-07-20-at-12.53.11\u202fAM-edited-1536x1084.png 1536w\" sizes=\"auto, (max-width: 1813px) 100vw, 1813px\" \/><figcaption class=\"wp-element-caption\">In the bottom of this image, you can see the circuit implemented. This image also allows you to see how the car works.<\/figcaption><\/figure>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading alignwide\">Results<\/h2>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"720\" style=\"aspect-ratio: 1280 \/ 720;\" width=\"1280\" controls src=\"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_7742.mov\"><\/video><\/figure>\n\n\n\n<div class=\"wp-block-columns alignwide is-layout-flex wp-container-core-columns-is-layout-3a88641f wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p class=\"wp-block-paragraph\">Credit: Rana Moeez Hassan for being a great help on the circuitry and being an amazing lab partner, Dr. Laura Ray for instructing the course and answering all of our questions, and Bob Barry for fixing any lab issues and for being patient with us.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\"><\/div>\n<\/div>\n\n\n\n<p class=\"has-text-align-left wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction and Goals In the final ENGS 26 project, our goal was to use skills learned in the class to balance an inverted pendulum that is inherently unstable when perturbed from equilibrium. This was accomplished through math modeling the dynamics of the car and pendulum, testing the transient behavior of the car parts (motor, sensor, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-127","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Balancing an inverted pendulum using classical control theory techniques - Ricky Kurosawa<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rickykurosawa.com\/?page_id=127\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Balancing an inverted pendulum using classical control theory techniques - Ricky Kurosawa\" \/>\n<meta property=\"og:description\" content=\"Introduction and Goals In the final ENGS 26 project, our goal was to use skills learned in the class to balance an inverted pendulum that is inherently unstable when perturbed from equilibrium. This was accomplished through math modeling the dynamics of the car and pendulum, testing the transient behavior of the car parts (motor, sensor, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rickykurosawa.com\/?page_id=127\" \/>\n<meta property=\"og:site_name\" content=\"Ricky Kurosawa\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-20T08:13:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_3BE3CA96335B-1-1-edited.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"602\" \/>\n\t<meta property=\"og:image:height\" content=\"1154\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rickykurosawa.com\\\/?page_id=127\",\"url\":\"https:\\\/\\\/www.rickykurosawa.com\\\/?page_id=127\",\"name\":\"Balancing an inverted pendulum using classical control theory techniques - Ricky Kurosawa\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rickykurosawa.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rickykurosawa.com\\\/?page_id=127#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rickykurosawa.com\\\/?page_id=127#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rickykurosawa.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/IMG_3BE3CA96335B-1-1-edited.jpeg\",\"datePublished\":\"2025-07-18T00:36:29+00:00\",\"dateModified\":\"2025-07-20T08:13:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rickykurosawa.com\\\/?page_id=127#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rickykurosawa.com\\\/?page_id=127\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rickykurosawa.com\\\/?page_id=127#primaryimage\",\"url\":\"https:\\\/\\\/www.rickykurosawa.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/IMG_3BE3CA96335B-1-1-edited.jpeg\",\"contentUrl\":\"https:\\\/\\\/www.rickykurosawa.com\\\/wordpress\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/IMG_3BE3CA96335B-1-1-edited.jpeg\",\"width\":602,\"height\":1154},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rickykurosawa.com\\\/?page_id=127#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rickykurosawa.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Balancing an inverted pendulum using classical control theory techniques\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rickykurosawa.com\\\/#website\",\"url\":\"https:\\\/\\\/www.rickykurosawa.com\\\/\",\"name\":\"Ricky Kurosawa\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rickykurosawa.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Balancing an inverted pendulum using classical control theory techniques - Ricky Kurosawa","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rickykurosawa.com\/?page_id=127","og_locale":"en_US","og_type":"article","og_title":"Balancing an inverted pendulum using classical control theory techniques - Ricky Kurosawa","og_description":"Introduction and Goals In the final ENGS 26 project, our goal was to use skills learned in the class to balance an inverted pendulum that is inherently unstable when perturbed from equilibrium. This was accomplished through math modeling the dynamics of the car and pendulum, testing the transient behavior of the car parts (motor, sensor, [&hellip;]","og_url":"https:\/\/www.rickykurosawa.com\/?page_id=127","og_site_name":"Ricky Kurosawa","article_modified_time":"2025-07-20T08:13:22+00:00","og_image":[{"width":602,"height":1154,"url":"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_3BE3CA96335B-1-1-edited.jpeg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.rickykurosawa.com\/?page_id=127","url":"https:\/\/www.rickykurosawa.com\/?page_id=127","name":"Balancing an inverted pendulum using classical control theory techniques - Ricky Kurosawa","isPartOf":{"@id":"https:\/\/www.rickykurosawa.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rickykurosawa.com\/?page_id=127#primaryimage"},"image":{"@id":"https:\/\/www.rickykurosawa.com\/?page_id=127#primaryimage"},"thumbnailUrl":"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_3BE3CA96335B-1-1-edited.jpeg","datePublished":"2025-07-18T00:36:29+00:00","dateModified":"2025-07-20T08:13:22+00:00","breadcrumb":{"@id":"https:\/\/www.rickykurosawa.com\/?page_id=127#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rickykurosawa.com\/?page_id=127"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rickykurosawa.com\/?page_id=127#primaryimage","url":"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_3BE3CA96335B-1-1-edited.jpeg","contentUrl":"https:\/\/www.rickykurosawa.com\/wordpress\/wp-content\/uploads\/2025\/07\/IMG_3BE3CA96335B-1-1-edited.jpeg","width":602,"height":1154},{"@type":"BreadcrumbList","@id":"https:\/\/www.rickykurosawa.com\/?page_id=127#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rickykurosawa.com\/"},{"@type":"ListItem","position":2,"name":"Balancing an inverted pendulum using classical control theory techniques"}]},{"@type":"WebSite","@id":"https:\/\/www.rickykurosawa.com\/#website","url":"https:\/\/www.rickykurosawa.com\/","name":"Ricky Kurosawa","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rickykurosawa.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.rickykurosawa.com\/index.php?rest_route=\/wp\/v2\/pages\/127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rickykurosawa.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.rickykurosawa.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.rickykurosawa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rickykurosawa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=127"}],"version-history":[{"count":4,"href":"https:\/\/www.rickykurosawa.com\/index.php?rest_route=\/wp\/v2\/pages\/127\/revisions"}],"predecessor-version":[{"id":174,"href":"https:\/\/www.rickykurosawa.com\/index.php?rest_route=\/wp\/v2\/pages\/127\/revisions\/174"}],"wp:attachment":[{"href":"https:\/\/www.rickykurosawa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}