This page contains all of the files and info about my self-balancing robot projects. Before you read my documentation or download any of the content, I recommend that you read through my tutorial about self-balancing robots first! Here are the links to each part of the tutorial:

Project Description

I started working on my first self-balancing robot during summer 2014. Since then I’ve been working on a second generation version of the robot, which includes some additional features.

Please Note: The files below are relatively old, and I have recently released an updated version of the self-balancing program. This code will probably be more useful for anyone who is building their own robot: [link to newer code]


Self-balancing Robot (Gen 1)

Download All Files: Self-balancing Robot Demo (Zip File)

This package contains:

  1. Project Documentation (PDF)
  2. Self-balancing Sketch (Arduino Sketch)
  3. MPU6050 Library (Zip File)
  4. I2Cdev Library (Zip File)
  5. Balance Robot 3D Designs (*.stl Files)


Preview of 3D Files:

This Post Has 9 Comments

  1. Thanks for the project! I’m Brazilian, electrical engineering student, your project helped me a lot! Congratulacions!

  2. Hi!! Mr. Simon your Tutorial is awesome.
    In addition to your code, I want to print real time Pulse Width Modulation (PWM) of motors. So please suggest what I would have to do.
    Thanks in advance

    1. Hi, printing out the real time PWM is really easy! Simply insert this line: Serial.println(PIDValue); into line 252 of my updated code here. Please note that printing to the console is very slow, and could affect the performance of the balancing system. I recommend you turn off any continuous serial outputs such as this once you are done debugging.

  3. Hello I want to know what may be the possible applications of this robot

    1. Hi Mohsin,
      I discuss some of the possibilities in my introduction post: To be honest, a simple two-wheeled self-balancing robot does not have many applications, but it is a fun robot to make and show off to your friends!
      The key is that the algorithms used in this project can be built upon and used in many different scenarios, such as bipedal robots, quad-copters, 3D printers etc.

  4. Hi, I’m developing a telemetry system with Galileo but I’m having problems when dealing with this MPU6050 breakout . I have the same olimex mpu6050 that you provided as example but I don’t know how to wire it on the flat ribbon cable. Can you provide a picture with the pins ? Thank you

  5. Thanks for the project.
    Can you tell the diameter of the motors ?

    1. I used motors with a diameter of 25mm and a total length of 70mm. You can essentially use any motors that you have lying around, as long as they draw no more than 12v, they are between 120-300RPM, and they have a relatively high torque. You can look at the first part of my Self-Balancing Robot Series to view all of the details about the components I used.


Leave a Reply

ten − three =