Go Down

Topic: Self balancing robot issue (Read 23601 times) previous topic - next topic


The dead zone problem is common for DC motors.  Using the Lego NXT I was able to record the motor input and the wheel position while my robot was balancing to get an accurate fit for my model of input vs output.  You could see that for small values of motor input the wheel position was not moving even though the motor input was small  but non-zero.  I have a plot of this phenomenon but can't manage to post it here.


Here are two more videos after I added motor dead zone compensation:


Hi! How did you add the dead zone compensation? Only by adding an offset to the PWM signal?


PS: I'm working on a balancing robot too, but I don't get full stability. It gets perturbations from it's own start-stop acceleration that makes it drift a little bit too much


Yes, just by adding an offset to the PWM signal.

Also, adding weight on top of the robot improves stability. And be sure to check the standard PID tuning techniques, that is the most important part.



where I connect the gyro and the :
3 .....  10 k resistance !!!!
from where I get I2Cdev.h


Here's my self-balancer without gyros or accelerometers:


It uses one IR range sensor to measure pitch angle, then differentiate that to get pitch rate.  These feed a PID controller for stability.

I'm working on a new version without the IR range sensor because that system only works on smooth flat surfaces.  I built and IMU with a Kalman filter on the Arduino Due using the Eigen C++ library for the matrix math.  Next step is to integrate it all.


plz can u answer me where to put the 3 10 k ohm variable resistance and the gyro sensor

:smiley-eek: :smiley-eek: :smiley-eek: :smiley-eek: =( =( =( =( =(


i did it

i will upgrade later






is it possible for you to post the code so we can all enjoy? :)


Nov 06, 2014, 08:35 am Last Edit: Nov 06, 2014, 08:35 am by cagiva
We decided to install an Android device on the robot to control its balance instead of using an IMU. Here you can see the result:



Mar 20, 2016, 09:20 am Last Edit: Mar 20, 2016, 08:49 pm by Southpark
You are correct that you do not need a Kalman filter.  You also do not need an accelerometer.  Check out the attached document for some of the myths concerning balancing robots.
It's pretty odd how they mention things like :


"You can balance with just PID control but if you give the robot a push or have an offset in the gyro output you will cause the robot to fall."

And "In order to balance you need PID control plus positive feedback."

And "Positive feedback seems to be necessary. If you are balancing with a 'complementary filter' you are introducing positive feedback. If you are balancing with a gyro and an accelerometer you are introducing positive feedback. If you are balancing with a gyro and wheel encoders you are introducing positive feedback."

I disagree with most of his/her comments. Maybe even all of their comments.

I agree that you don't need a Kalman filter or an accelerometer, or wheel encoders for balancing a bot though. On the other hand, some of these features could enhance performance if you have a fast enough processor to handle things. But a number of things in that 'myth' pdf is quite misleading.

Their equation that comes after their sentence "PID control with positive feedback looks like this..." is erroneous.

I've recently been tinkering with a balance bot, and looking for information in the Arduino forums. Getting ideas about what others are doing to get their bots to balance really well, and dealing with noisy data and practical effects. Stumbled on this myth pdf, and thought some of the teachings in there are kind of misleading.

Go Up