Log in

View Full Version : Self-Balancing 2 Wheeled Robot


Mike
01-05-2005, 21:33
Since build/official competitions are over I've been working on making my own robot. Currently, the frame is done (I'll try to post pictures later, for a CAD model see bottom of the post) and I'm looking at what electronic parts I should buy. Here's my current list:

Microcontroller (http://www.barello.net/ARC/index.htm) $85.95

6 AA Battery Holder (http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=127142) $0.75

Solarbotics GM8 Gearmotor (http://www.pololu.com/products/solbot/0187/) (2x) $12.00
Solarbotics Plastic Wheel (http://www.pololu.com/products/solbot/0184/) (2x) $8.00
Shipping: $4.95

12" PWM Cables (http://www.innovationfirst.com/FIRSTRobotics/accessories.htm) (2x) $18.94


What I need is a gyroscope, although of all the researching I've done of balancing robots people have used both gyroscopes and accelerometers. Will just a gyroscope be sufficient? Does anyone know a good/cheap gyroscope/accelerometer that I would need?

Thanks in advance.

CAD Model:
*Note: Those aren't the motors I'm using, and it's wood... not metal.*
http://img119.exs.cx/img119/8726/mikebot7wq.th.gif (http://img119.exs.cx/my.php?loc=img119&image=mikebot7wq.gif)


EDIT: Whoops, this was supposed to go in Technical Discussion, any mod feel free to move it. :o

colt527
01-05-2005, 23:15
Hmm, I think this is a quite a task to take on, You are basically reproducing a segway and Im pretty sure Human Like movement based on balance is not an easy thing to pull off both programming-wize and mechanical wize. Its going to take a lot of effort to pull it off.

On the hardware side:

Ive seen balancing done with distance sensors as well though. Where they point at the ground and measure the distance difference between the 2 sides and make movement decisions based on that. And, I dont know much about the speed of the microcontroller that you need to accomplish this feat but I imagine that it needs to be pretty fast and update often.

Sorry I couldnt be more help, but good luck! and I hope to see it working :)

sanddrag
01-05-2005, 23:59
I once tried my hand at a fullsize one with a Parallax BS2 and a Memsic Accelerometer (that parallax sells) but never really got too far with it. I'm not a programmer but even I I was, I'm not sure if the electronics and hardware are capable of balancing.

You may find some useful info at www.tlb.org

artdutra04
02-05-2005, 15:22
Hmm, I think this is a quite a task to take on, You are basically reproducing a segway and Im pretty sure Human Like movement based on balance is not an easy thing to pull off both programming-wize and mechanical wize. Its going to take a lot of effort to pull it off.
Let's not forget that Mike was the one who coded a working autonomous code that used the camera and capped the vision tetra. ;)

I think you may find this site very informative:
http://www.geology.smu.edu/~dpa-www/robo/nbot/

Also, people have built a "Legway" balancing robot using Lego Mindstorms:
http://www.generation5.org/content/2004/legway.asp

Paul H
02-05-2005, 15:40
I've got a gyro you can have, I got a few from the yardsale last year and I only really need one. It's the gyro that was in the kit from previous years. All I ask is that you pay shipping.

Kevin Watson
02-05-2005, 16:36
What I need is a gyroscope, although of all the researching I've done of balancing robots people have used both gyroscopes and accelerometers. Will just a gyroscope be sufficient? Does anyone know a good/cheap gyroscope/accelerometer that I would need?This is the classic inverted pendulum (http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2004-26,GGLD:en&q=inverted+pendulum) problem that is given to countless college students each year. You'll need to implement a Kalman filter (http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2004-26,GGLD:en&q=Kalman+Filter) that'll filter noise, perform sensor fusion and spit out a state estimation. As you've already found out, you'll need a gyro and an accelerometer that's sensitive down to zero Hertz (i.e., gravity). Sparkfun (http://www.sparkfun.com/) has a gyro/accelerometer board that looks good. The part number is ACL-IMU-203.

-Kevin

Mike
02-05-2005, 20:56
Wow, didn't realize it'd be this expensive/complicated.

I'm gonna think about maybe a lower cost/simpler alternative to a gyro, maybe a feeler attached to a pot? If you have any suggestions feel free to post =)

EDIT: Or anyone know how I can build something similar to http://www.sparkfun.com/shop/index.php?shop=1&cart=239249&match_criteria=all&rec=&keywords=ACL-IMU-203& for cheaper?

BrianBSL
02-05-2005, 21:30
Wow, didn't realize it'd be this expensive/complicated.

I'm gonna think about maybe a lower cost/simpler alternative to a gyro, maybe a feeler attached to a pot? If you have any suggestions feel free to post =)

EDIT: Or anyone know how I can build something similar to http://www.sparkfun.com/shop/index.php?shop=1&cart=239249&match_criteria=all&rec=&keywords=ACL-IMU-203& for cheaper?

The sparkfun IMU is neat in that it is all on one board, but you can get evaluation board versions of the same things from Analog Devices (www.analog.com). You can probably save $30-$50 by buying separate EB's instead, but you aren't going to get comparable performance for much less. Make sure you buy EB's or something with the devices mounted. The gyro's are all ballgrid and aren't worth the trouble of mounting yourself, you can solder the accelerometers as they are a small surface mount pitch but its still easier to buy EB's that have all the resistors and caps installed that you need.

As far as something simplier/cheaper, I've seen people attempt the same design using two IR distance sensors on each side.

Mike
04-05-2005, 15:25
As far as something simplier/cheaper, I've seen people attempt the same design using two IR distance sensors on each side.
I've decided to use a potentiometer connected to a "feeler" to sense the angle that the bot is at. Once I get that working, I'll buy some IR sensors and use those.

seanwitte
04-05-2005, 15:46
I've decided to use a potentiometer connected to a "feeler" to sense the angle that the bot is at. Once I get that working, I'll buy some IR sensors and use those.

You could use the pot as the pivot point for a small pendulum mounted inside the frame. It might have to be heavy to overcome the static friction of the pot, but it would be doable. The value of the pot would be proportional to the tilt angle.

Mike
04-05-2005, 19:18
You could use the pot as the pivot point for a small pendulum mounted inside the frame. It might have to be heavy to overcome the static friction of the pot, but it would be doable. The value of the pot would be proportional to the tilt angle.
Good idea, probably will try it after the feeler idea. Right now I'm kinda limited to my space/weight, but I'll be sure to check it out later.

Alan Anderson
04-05-2005, 23:26
I've decided to use a potentiometer connected to a "feeler" to sense the angle that the bot is at. Once I get that working, I'll buy some IR sensors and use those.
A feeler will work as long as the surface is flat and level. Without a true sense of "down", a Segway clone will want to accelerate downhill.

Mike
05-05-2005, 19:21
A feeler will work as long as the surface is flat and level. Without a true sense of "down", a Segway clone will want to accelerate downhill.
Yeah, I was thinking about that. So I might make a feeler design just to experience with using a pot as an angle measurement.

There's also a problem with the pendulum idea. If I am making constant adjustments to control the angle, then the pendulum will start swinging. The swinging will cause harder adjustments, which will just feed this repetition harder until the robot tips. I'm thinking of something along the classic pendulum lines, I'll try to make up a CAD drawing and post it later.

Alan Anderson
06-05-2005, 11:47
There's also a problem with the pendulum idea. If I am making constant adjustments to control the angle, then the pendulum will start swinging...
If you mount the pendulum to hang from the point of rotation of the platform (i.e. the axle), you'll have a lot less to worry about. You can account for the approximately known linear acceleration and compute something very close to the actual tilt. Modeling the dynamics of the pendulum might still be necessary, but you won't have to deal with the chaotic "double pendulum" system that would arise if the pivot point were somewhere above the axle.

Mike
06-05-2005, 14:38
If you mount the pendulum to hang from the point of rotation of the platform (i.e. the axle), you'll have a lot less to worry about. You can account for the approximately known linear acceleration and compute something very close to the actual tilt. Modeling the dynamics of the pendulum might still be necessary, but you won't have to deal with the chaotic "double pendulum" system that would arise if the pivot point were somewhere above the axle.
I can see how that would stop the pendulum from swinging wildly, but for the pot to take readings, it has to be mounted on the pot, right?

The way I'm thinking of designing a pendulum is for it to be less of a circular motion of swinging and more of a linear one. Think of a box with beads in it, when it's tilted the beads fall to one end of the box instead of swinging like a classic pendulum would. Of course, I wouldn't use beads.

[527]phil
14-05-2005, 10:46
You might want to try looking at the Robo fire fighting competitions because most of their robots look like that. Just find somones e-mail and ask them questions, thats how i got started with robo one.

Larry Barello
30-05-2005, 12:33
Mike, I have built a balancing robot (years ago) http://www.barello.net/gyrobot

You can't do it with a static linear accelerometer. The acceleration of the body, left, right, will change the observed gravity vector and the algorithms will fail. You need a gyroscope. Gyroscopes are insensitive to linear accelerations, and only sensitive to rotational acceleration. The old FIRST gyro is what I used on my balancing robot. Gyro's drift, so you need to correct them in some way. My original balancer used the wheel drift to compensate by feeding the position error back into the balance equation. It actually worked really well, but the math overflowed after a while.

A lot of other folks use a kalman filter to fuse a tilt sensor (linear accelerometers) and a gyro. The former is used to correct the gyro and the latter is used to handle rapid rotational changes. Microstrain FAS-G is an example of such a beast. I am math challenged, so I implemented my own lame version: I simply took a very small fraction of the difference between the tilt sensor and the integrated Gyro tilt and added that back into the integrated output. It was .01, IIRC. The effect was to essentially ignore short term noise from the accelerometer due to body movement and to cause any long term drift of the gyro to be "pushed" back towards whatever the tilt sensor indicated. I got my tilt sensors as samples from www.analog.com and the gyro from old FIRST kits, so I had a zero cost.

A third option is to use some sort of direct measurement, like a potentiometer with a tail that touches the ground, or optical distance measuring doodads like the sharp GP2D12. That approach makes it easy to balance since you have an absolute measurement of tilt without any drift, but, of course, they have their problems...

A pendulum on the potentiometer will have the same problems as a linear accelerometer: if the body accelerates left or right, the weight will shift and "down" will change and, again, the algorithms will fail.

The old FIRST gyros work really well and are easy to use. They are "too" sensitive for any serious movements as their output limits at 65 deg/sec. For our FIRST robots in 2004 & 5 we used the Analog devices ADXLR150 gyro chips. Get the "EB" (evaluation board) versions for $50 and worth every penny. The 150 will go to +/- 150 deg/sec which is more appropriate.

Good luck!

P.S. You found a vision tetra and capped? Way to go. We spent three weeks beating our heads on that one and gave up. We could find the tetra, pick it up 100% and always hit the center goal, but we couldnt actually get the dang thing on top! The speed needed to do it in 15 seconds made our position errors too large by the time we go to the goal and it never quite made it. We chose to do something simple and 100% reliable: Grab a goal from the auto loader and put it on the corner.

Mike
30-05-2005, 19:32
Thanks for the advice :D, I got my birthday money today and plan on buying your AVR controller soon (for this project and future ones). Odds are, for the current time, I'm going to be using a potentiometer attached to a stick with a ping pong ball at the end. Eventually I'll probably use an IR distance sensor.

[527]phil
12-06-2005, 17:15
http://robots.net/robomenu/995142345.html

Mike
12-06-2005, 23:24
Thanks for the link... as far as my robot is going I probably won't be able to get it done for a while. Still lacking in the funds department.

GhostInTheShell
27-06-2005, 11:05
i made this kick butt gyro thing w/ a joystick and a gyroscope and a motor,
i would put up pics, but never the less, my cad software is not working right

[527]phil
29-06-2005, 14:22
So let me get this strait, you made a gyro, with a gyro. lol just kidding, I used a gyro in two of my robo one robots, and i'll probably put one in on my third. I use the gyro made by parallax, seems to work well.

Mike
29-06-2005, 18:20
How did you guys do programming the Kalman filter?

mechanicalbrain
29-06-2005, 18:40
you know there are some guys at the university of Maryland working on something similar it involved a pendulum swinging and being able to counter balance it with electronics so a camera mounted on the end would have a perfectly level image..... of course i could just be blowing smoke out of my mmmmhhmmm *throat clearing*

Mike
29-06-2005, 21:23
you know there are some guys at the university of Maryland working on something similar it involved a pendulum swinging and being able to counter balance it with electronics so a camera mounted on the end would have a perfectly level image..... of course i could just be blowing smoke out of my mmmmhhmmm *throat clearing*
Heh, no your right. In most of the new cameras out, they use gyro's to stabilize the image.

Joe Johnson
02-08-2005, 15:12
FYI Look Here (http://www.balbots.com/) for a cool place to start to play with a balancing robot.

http://www.balbots.com/images/Products/Advance-L_side_240.jpg

Flat floor limitations (if you are clever, you can probably can find work around for this limitation) as well as other limits, but it is as good of a place as any to start.

Joe J.



P.S. I'm not here and you didn't read this ;-) I am much too busy at Robotic Amusements, Inc. (http://www.roboticamusements.com), getting ready for our product launch at the AMOA Show (http://www.amoashow.com/) in Sept. Wish us luck...