Go Down

Topic: Self Balancing Robot with PID Control (Read 2369 times) previous topic - next topic


Hi Guys,

Currently I am working on a PID control based system that will allow my robot to self balance. However, I am having some issues and I am relatively new to Arduino, let alone coding. The current list of parts I am using include:

- Tamaya Double Gear Box with 2 DC Motors from Polulu
- Tamaya Wheel set from Polulu
- AXDL203EB - Dual-Axis Accelometer
- Arduino Uno
- Adafruit Motorshield V2

The main issue I am having is getting my robot to balance and whether or not my coding is correct in this case. I have read a lot in regards to Brett's PID library, Kas' robots, Instructables, and the fourm, but I am still confused on why it doesn't balance. I have encased all my components within a grey box mounted on the side of my robot, which makes its sorta heavy on one side..., but I think my coding may be the real issue? I have attached the code below for anyone who is interested in helping me with this project.


I see you are using an accelerometer but where is your gyro?  In fact, you do not need an accelerometer at all.  You will hear some say you need an accelerometer but you can balance fine without one.


Accelerometer is useless for balancing as you need to respond to angle only,
and accelerometers mix together angular and linear motion.  You can use an
accelerometer to measure static orientation, but not rotation.

Ideally you want no backlash in your gears, otherwise you'll have a lot of wobble.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]



I did 2-wheel balancing of a robot 8 years ago with Asuro robot, and only infrared LED and photo sensor used for distance determination (with Arduino better HC SR04 ultrasonic based these days). No PID control was needed, just "if distance bigger than threshhold then move forward else move backward" did the trick.

The first experiments were not completely successful and I got a "runaway robot" ;-)

Later I avoided the "runaway" phenomenon completely by just braking one wheel:

As you can see making the threshhold a little bit to low for "real balancing" makes the robot move on two wheels only!

If you want to see full videos you can find them on HermannSW youtube channel.



You have probably seen it, but this complete how-to-do-it thread uses both an accelerometer and gyro.

Go Up