Two wheeled self balancing robot
Page 1 of 1

Author:  jlc2ay [ Sun Nov 22, 2015 10:39 pm ]
Post subject:  Two wheeled self balancing robot

Hello, I am wanting to build a two wheeled self balancing robot with the lego mindstorms Ev3 kit. My configuration that I initially built was that of the BALANC3R ( I ended up modifying it by deciding to drop the control brick down between the motors, lowering the center of gravity.

I am trying to figure out how I need to approach coding it now. I have attached a gyro sensor to the top of the bot. I have tried using if statements that check for different input values for the gyro sensor. When the if statement is activated, I call the setmotorsynch() function where the motor speeds vary depending upon what gyro value was detected. By doing this, I was attempting to tune the numbers through trial and error to get it to be able to balance. However, this does not seem efficient.

After doing some Googling, it seems that the programs people are creating for two wheeled self balancing robots are pretty complex in nature (PID, error checking, etc.). For those more experienced in this platform than I, is there a simpler way to make the robot capable of self balance or do I need to do some research into PID and try to go from there? I am looking for what I need to account for in order to program a two wheeled self balancing robot.

On another note, my gyro sensor sometimes seems to go haywire. It will work fine one day. Then the next time I use it, the gyro sensor will have massive drift when I run the program. It will very quickly increase in value to infinity. Not sure why this is happening...I read about some issues on another forum where the sensor had to be plugged in before power on, but that did not seem to be the same cause for me.

Thanks for any input you may have, it is appreciated.

Author:  Tabor473 [ Mon Dec 28, 2015 1:29 am ]
Post subject:  Re: Two wheeled self balancing robot

So in all honesty PID at the very least is going to be necessary. I can point you towards some good tutorials if you would like to read into how to set it up. It is for the most part exactly what you were saying just continuous rather than discrete if statements. The central idea to PID is "if I am far away from where I want to be move more than if I was close to where I want to be".

If your goal is to balance then I would think you probably want to look at raw gyro data rather than accumulated gyro data so drift is a nonissue. (Velocity of angle change rather than angle) Most "real" robot applications do complicated stuff to get a better understand of the angle rather than just looking at the sensor data but I do not believe that is necessary.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group