Let's Make Robots!

Self Balancing Robot using MPU6050 and Arduino

This is my first robot. I have used an MPU6050 IMU, Arduino UNO, and an Arduino Motor Shield. The motors I have used are cheap ones, that is why a small oscillation always appears. Sensor- It is an MPU 6050 IMU. I have used Jeff Rowberg's DMP library. You won't need any other filters if you use that library. It gives you directly the yaw,pitch,roll values if you want. https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

That's really nice. I'm always amazed by balancing robots.

Most of the DC motors I have , have this problem. I can move the shaft a little bit without moving the motor . That's why I think some balancing bots use Steppers.


Nice bot. I love balancing bots...Now make it remote controlled/obstacle avoiding...

I've always thought the self-balancing robots were interesting. I'd also love to see a video.

@duane degn   I'm using an Ardumoto Shield it has an onboard L298P. The motors ought to have the same characteristics as http://www.pololu.com/product/1103 these ones. But they were manufactured by a different company so they are not as qualified as tho ones at pololu. But they are much cheeper indeed. I have built the wheels myself after a long search on internet. They have 7 cm on diameter

@Dipanjan Hope I can get new DC motors with encoders. They obviously work more stable then these ones. 

@DengerousThing I have already shared a video, also available on youtube http://www.youtube.com/watch?feature=player_embedded&v=V1PuCrxtkjc

Thanks for comments 

I think that balancing robots are more stable if there is more weight up high. You might want to make a top shelf to put your batteries or something else fairly heavy on. They can also be more stable if they are taller, if your controller can react fast enough and yours seems to be able to react quickly enough.

The last point seems counterintuitive to some people (it took me a while to understand it). An analogy is comparing balancing a broomstick on the palm of your hand vs balancing a pencil there. Most people can balance a broomstick for minutes with just a little practice, whereas the pencil is a lot more difficult for most people.

looking good kaanmcetin. It's balancing! Definitely on my to-do list now. Need to fetch some accelerometers!

1. The link to Jeff Rowberg's DMP library seems to be broken.

2. In the LMR scheme of thing what does "collected" mean?

Thanks for posting!!!

Thank you all for the comments and reccomendations on my robot. 

@DangerousThing Actually the robot has another shelf on the top. I already have planned the batteries to be hooked op on its top so that the robot could be more stable. But I havent got any Li-po batteries yet and I power the robot with a 12V adapter. I just didn't need that shelf yet. I have tried to put my finger on its top and press it to simulate a weight on its top, it surely was more stable than before. One thing I am curious about is that if the motors can stand up that much weight as they can not generate enough torque. (that might be caused by the insufficient power source too). 

@bdk6 Thanks for your support. It really was a fast start for me, I had too learn too much to build this robot. And I think it could have been a lot easier if i had started with easier ones. I still need to learn how to interface with arduino over other programs like processing. And it is not a problem for me if you give me information about what i have to change with my project, so that i can improve myself. I won't be discouraged by my faults.

@enigmerald If you start building one notice me, i would like to see your robot and maybe we can compare our works and improve them. I would try tohelp you at certain points. 

@ggalant I dont know why the link is broken, couldnt fix it either. You can google that library, its not hard to find it. 

It might be possible to use a 12v 7amp-hr sealed lead acid battery. They are large and heavy, but are occasionally used in toys. They are usually cheaper than LiPos and might work better for the battery for this bot. I have a place down the street that sells them.

To try it out, put something that weighs a few pounds on your top shelf (tape a barbell or a couple cans of food there). If that makes it more stable then the theory works in your case and a small SLA would work on the top shelf.

Unfortunately I can't estimate very well so I don't know how large your shelves are.

I'm seriously debating turning my soon to be robot Groucho into a balance bot. This is partly because I've always wanted to do something like this and partly because a balance bot moves fast much like Groucho Marx's trademark walk (head forward, body leaning forwards, legs back). Decisions, decisions. If I do start building one, I'll let you know. I can use all the help I can get.

I do agree with the others and think your build is great. Especially for a first robot.


I had a not so good self balancing robot that used 2 IR distance sensors to detect tilt. Also had accel & gyro but never was able to figure out how to intergrate them.  Used the motors for another project but still have frame, CPU, and other electronics. Bought a MPU6030 and some motors and want to give it another try. Would you be willing to share your code and ideas?

One of the problems I have is how "hard" to drive the motors. My motors have encoders which work great for other robots but seem to be a hinderance with these machines. Tumeing the PID seemed to be an endless challenge.

Regards George