Self-Balancing Robot

I built this self-balancing robot for a subject at my university. The robot had 2 motors on each side and "balance" itself upright using an implementation of a gyroscope and acceleration sensor and a PID Controller.

In the video above, I talked about my process of making the robot: what the challenges were and how I overcame them. Please leave a comment below if you have any questions or things to add! I am always looking forward to getting feedback!

COMPONENTS LIST:

  1. 12V 210 RPM DC Motor with wheel, mount and bracket x2
  2. Dual H Bridge L298N DC Motor Driver
  3. MPU-6050 3 Axis Accelerometer Gyroscope Sensor
  4. HC-05 Wireless Bluetooth RF Serial Transceiver
  5. Arduino Uno R3 (ATMega328P)
  6. 11.1V RC LiPo Battery Pack

WIRING DIAGRAM:

SOURCE CODE:

Please send an email to: tony@mechatony.com

CODE FLOWCHART:

EXTRAS:

My original documentation of the project (for the subject I was studying)

The AutoCAD drawing of the robot's frame

Thank you for reading!

13 thoughts on “Self-Balancing Robot”

    1. Hi Luis, sorry for the late reply.
      I believe I have answered this to you on YouTube already, but I’ll leave it here again.
      Yes I did use the Arduino board and the software that I used to upload code was Atmel Studio with AVRdude as my bootloader

  1. Hello Tony,
    First, very good work!

    I have a question just about the motors performance, would you have some preference between a 12v motor or 6v? do you know if ther have significant difference?

    Thanks man!

    1. Hi Arnon,

      Firstly, thank you for your compliments and for checking out my website!
      I am really sorry for the late reply, I have been on a vacation in the last 2 weeks.

      For this type of application, the voltage of the motor depends on the size and weight of your robot. For a bigger robot, you will need more torque to overcome its moment of inertia, and generally, a 12v motor will produce more torque than a 6v one, given the same gear ratio.

      That is also the second thing you should be looking at, gear ratio. For a PID Controller to work well, you will need the motor to turn fast, but still has a bit of torque. A gear ratio of 1:200, or around that number, should be sufficient. A high gear ratio, like 1:20, would produce more torque, but the motor would turn too slowly, and wouldn’t react fast enough.

      I hope I have been helpful!

      Cheers!

  2. Hi Tony,
    could make the dimensions of the robot structures available, because I can’t access AutoCAD drawing (it looks like it is splashed) and I can’t access the project’s GitHub either. Thankful!

  3. Hey thats an amazing project, i myself iam in the process of creating the same project. im trying to derive the dynamic equations of the system. how did you measure the moment of inertia?

  4. How can I download the source code? The site that can be downloaded is already missing, so I want you to tell me what the source code is.

  5. Hey,
    A great project, well described. Just one tiny thing. You have described the H-bridge in the parts list as a stepper driver when actually it is a dc motor driver.
    Sorry if I’m being overly pedantic!

    1. Hey! Thank you for checking it out
      I’ve fixed the wording for that part 😛 I only copy-pasted the name from the seller’s website and didn’t check it carefully
      I guess you can still use it to drive a stepper motor if you wish though

Leave a Reply

Your email address will not be published. Required fields are marked *