{"id":157,"date":"2025-09-19T11:37:43","date_gmt":"2025-09-19T11:37:43","guid":{"rendered":"http:\/\/louis.rotech.nz\/?page_id=157"},"modified":"2025-09-23T11:00:16","modified_gmt":"2025-09-23T11:00:16","slug":"self-balancing-robot","status":"publish","type":"page","link":"http:\/\/louis.rotech.nz\/?page_id=157","title":{"rendered":"Self-Balancing Robot"},"content":{"rendered":"\n<p>I built a self-balancing robot using two simple brushed DC motors, an Arduino and motor controller, and a MPU6050 IMU sensor unit for sensing the tilt angle of the robot body, all powered by 6 AA batteries.<\/p>\n\n\n\n<p>Using a PID control algorithm, the robot is able to correctly actuate its wheels depending on the tilt angle detected, maintaining a level body angle. The P, I and D gains were tuned and tested iteratively until appropriate values were obtained that enabled balancing of the robot with <em>minimal overshoot<\/em> of robot angle when adjusting, yet <em>achieving target angle quickly<\/em>.<\/p>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-2 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-1 wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Front-768x1024.jpeg\" alt=\"\" class=\"wp-image-160\" srcset=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Front-768x1024.jpeg 768w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Front-225x300.jpeg 225w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Front-1152x1536.jpeg 1152w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Front-1536x2048.jpeg 1536w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Front-scaled.jpeg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Back-768x1024.jpeg\" alt=\"\" class=\"wp-image-159\" srcset=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Back-768x1024.jpeg 768w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Back-225x300.jpeg 225w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Back-1152x1536.jpeg 1152w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Back-1536x2048.jpeg 1536w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v1-Back-scaled.jpeg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>First self-balancing robot version. Used a drone motor and ESC for the actuators. Found control of the robot to be too difficult and imprecise, especially since the motors feature a <em>low-torque high-speed response<\/em> (opposite of the desirable actuator properties for a self-balancing robot).<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-4 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-3 wp-block-group-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-1-768x1024.jpeg\" alt=\"\" class=\"wp-image-161\" srcset=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-1-768x1024.jpeg 768w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-1-225x300.jpeg 225w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-1-1152x1536.jpeg 1152w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-1-1536x2048.jpeg 1536w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-1-scaled.jpeg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-2-768x1024.jpeg\" alt=\"\" class=\"wp-image-162\" srcset=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-2-768x1024.jpeg 768w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-2-225x300.jpeg 225w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-2-1152x1536.jpeg 1152w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-2-1536x2048.jpeg 1536w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-2-scaled.jpeg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-3-768x1024.jpeg\" alt=\"\" class=\"wp-image-163\" srcset=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-3-768x1024.jpeg 768w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-3-225x300.jpeg 225w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-3-1152x1536.jpeg 1152w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-3-1536x2048.jpeg 1536w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-3-scaled.jpeg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-4-768x1024.jpeg\" alt=\"\" class=\"wp-image-164\" srcset=\"http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-4-768x1024.jpeg 768w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-4-225x300.jpeg 225w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-4-1152x1536.jpeg 1152w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-4-1536x2048.jpeg 1536w, http:\/\/louis.rotech.nz\/wp-content\/uploads\/2025\/09\/Robot-v2-4-scaled.jpeg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>Second robot version. Two <em>high-torque low-speed<\/em> DC motors are used instead. The orange LiPo battery is used as a <em>counterweight<\/em> only; the robot is powered by 6 AA batteries here.<\/p>\n\n\n\n<p>Video:<\/p>\n\n\n\n<p>The code for this project can be found in <a href=\"https:\/\/github.com\/MCNeutron\/self-balancing-robot.git\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#215f9a\" class=\"has-inline-color\">this<\/mark><\/strong><\/a> GitHub repository.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I built a self-balancing robot using two simple brushed DC motors, an Arduino and motor controller, and a MPU6050 IMU sensor unit for sensing the tilt angle of the robot body, all powered by 6 AA batteries. Using a PID control algorithm, the robot is able to correctly actuate its wheels depending on the tilt [&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-157","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/louis.rotech.nz\/index.php?rest_route=\/wp\/v2\/pages\/157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/louis.rotech.nz\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/louis.rotech.nz\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/louis.rotech.nz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/louis.rotech.nz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=157"}],"version-history":[{"count":8,"href":"http:\/\/louis.rotech.nz\/index.php?rest_route=\/wp\/v2\/pages\/157\/revisions"}],"predecessor-version":[{"id":181,"href":"http:\/\/louis.rotech.nz\/index.php?rest_route=\/wp\/v2\/pages\/157\/revisions\/181"}],"wp:attachment":[{"href":"http:\/\/louis.rotech.nz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}