Society of Robots - Robot Forum

General Misc => Misc => Topic started by: jailsellgren on November 25, 2006, 12:56:10 AM

Title: segway style robots
Post by: jailsellgren on November 25, 2006, 12:56:10 AM

I've recently joined the forum and am looking to build a balancing robot. A tall, lightweight, 2 wheeled balancing robot like the segway. Not very big either. Around 2-3 feet tall and a maybe 8 by 8 inch base(like the shadow below it)

So im going to ask for most of the parts for christmas. So from what i understand i need  ( please make reccomendations and comments, i am new to this and would just like to get all tha parts i need so i can then begin working on it after xmas)

Battery                        rc battery pack? how many volts and how much (mah?) or something
Gyro and Accelerometer          i read about something like this and a kalman filter, will i be able to achieve this, give me your best reccomendation

Wheels and body and other body parts                          where do i buy?
Motors                     dc brushless    i have no idea here so point me to some options  heres one i looked at but i have to build this thing  and i dont know that i would be able to program and use it correctly

Motor Controller?   if its brushless i guess i need one, what if its not brushless,  please help here
Microcontroller         a 10$ atmel?  i dont know it needs to run fast to be able to do the balancing algorithm many times a second so that it does not fall over     do i have to have another chip to do the balancing so as not to slow everything else down?

I need pretty much a good parts list and places to buy things. Any helps would be greatly appreciated
anything i forgot or that can point me in the right direction would be great

here is an example of what i want to build

thank you so much in advance you guys rock

erik :D
Title: Re: My Balancing Robot
Post by: Admin on November 25, 2006, 10:44:19 AM
hi jailsellgren

i believe one or two other people on SoR is also interested in building a segway-like robot. search the forum for 'segway,' you might be able to help each other.

so i have never built one myself, but i might be able to help you along some . . . check the robot parts list ( page to find everything you need to buy. if you cant find what you want, let me know.

for battery, choose a NiMH type, rated between 6V and 8V. you will want at least 1000mAh, which will probably give your bot about 1 to 2 hours of continuous runtime. ~$15

as for sensors, we discussed sensors on this post

so you will probably need two encoders ( (can be homemade for like $3/each), an accelerometer ( (~$20), and a gyro (~$40). I believe they now have gyro IC's for cheap, but I have never used one so cant really help you there . . . control programming will be a little hard for a beginner, just let us know when you have it built and we can help you with that.

chassis parts will cost you around ~$30, frame material and wheels. i recommend using HDPE ( 1/8th" should be fine. its really cheap, just buy a lot of extra in case you mess up.

for motors (~$30 each), only use geared types. get one with a rating of about 6V. im not really sure what torque you might need . . . 1 pound-foot sounds decent. if you arent sure, always opt for higher torque than you think you need. !!! anyone know how to calculate torque for segway bots? its dynamic so its tricky . . .

for motor controller, you want a dual driver (handles two motors) that does at least 12V and at least 2A continuous. ~$70

microcontroller, depends on your experience. if you are a beginner, i recommend buying something pre-assembled and simple ~$40. or a development board ~$20 if you dont mind being occasionally frustrated and lost. in the long term the development board route will be better.

if you have more questions, feel free to ask.
Title: Re: My Balancing Robot
Post by: jailsellgren on November 25, 2006, 09:49:06 PM
Ok so, to the admin or any other well experienced ..roboticist..?

Here are 2 batteries, which should i pick if any

I decided for an encoder to use the sharp ir range finder since its pre assembled, i could make one but it would be hard to get it to always sit right.  if anyone could give me a link to the right one (link to a store) that i need it would be great, i found a couple versions of it.

For microcontroller, right now i have a boe-bot with a bs2 stamp that i have learned to program, what exact microcontroller would you reccomend for the job, point me to a couple of reccomendations with links.  I dont mind the complexity, thats what makes it fun.

I found some gyros and accelerometers, could you point me to some options around the prices you mentioned. I foun some pretty fancy stuff but it was way too expensive. ( anyways this seems to be the most puzzling piece of the project to me so if anyone could tell me about this all and the "kalman filters" that would help a lot     i found a page with 1 acceleromter and gyro but i dont know what i need in conjunction with that and if these are even the right or accurate enough for my use
do i need a seperate processer to run and calculate these things

For base i will take your suggestion and use hdpe, but im bad at designign this, how do i mount these round dc motors to a sheet of plastic. Il let you tell me after you see my motor ideas.

For motors i suppose you meant that i dont need brushless so here are some things i found, tell me what you think.
what rpm and ratio of gear should i have, i got these picks from robot  On this page the ml 30 or the ml 50
theres also all the gearhead motors on this page
out of all of these which would you reccomend

Heres a motor controller i found, suitable?

I know your reply will take time and thought and i really really appreciate all the help you have and i hope will give me. Thanks
Jailsellgren  ;D

Title: Re: My Balancing Robot
Post by: JonHylands on November 26, 2006, 06:43:00 AM
I don't know about the rest of it, but the Sharp IR rangefinders are worthless as encoders. Check out this page:

for some encoder ideas.

For accelerometers, check here:

and for gyros, look here:

The motor controller has to be matched to the motors...

- Jon
Title: Re: My Balancing Robot
Post by: Admin on November 26, 2006, 09:44:29 AM
Here are 2 batteries, which should i pick if any
Althought it really depends on your motor current draw, Id say go with the 7.2V because both have the same price. Dont forget the charger!  :P

what rpm and ratio of gear should i have
Use this tutorial to calculate rpm. You really dont need more than like 200rpm.
Segway-like bots is a weird special case, so Im really not sure how to calculate torque for it . . . I guess just assume your robot is a long beam, with a weight at the end. Calculate the torque required to balance that weight:
Its basically weight of robot * height of robot /2 = required maximum torque. The reason I divide by two is because you have two motors, so you only need half the torque. Yes, you will have to guestimate the robot weight and height . . . After you know this, you can decide on your motor.

Heres a motor controller i found, suitable?
Again, it really depends on your motors. Make sure the motors you choose have full load currents less than the maximum current rating of your driver. I think this driver will be fine, though.

Just one more thought, buy your components with the idea that one day you will scrap them for future robots you make.  :P
Title: Re: My Balancing Robot
Post by: dunk on November 26, 2006, 12:39:19 PM
hi jailsellgren,
i don't want to put you off but you are aware that getting a balancing robot to work is really tricky?

so most of the successful balancing bots (including the segway) use input from 2 different kinds of sensors.

first they use an accelerometer that will tell you which direction is up on an object that is traveling at a constant speed (or is stationary for that matter).
the problem with accelerometers in this aplication is they measure acceleration. so you will have to take into account the effect changes in speed have on the readings.

the other sensor in use are angular rate sensors. these cannot tell you which way up is. what they can tell you is how fast an object is rotating.

you will have to come up with an algorthm that takes input from these 2 sensor types as well as wheel speed to determine how to keep your bot upright.

happy building and let us know how you get on!

Title: Re: My Balancing Robot
Post by: JesseWelling on November 26, 2006, 03:11:11 PM
I've been reading about how to do this and I think he's going to want to use what it called a kalman filter.

You can start by reading up here:
This is also usefull for what they call 'dead-reckoning'. The more inputs you have the more
accurate Kalman filtering should be.

Another software solution could be PID bassed on angular rotation speed.
First you cause a tilt by saying you want some angular rotation. So the robot tilts, then you tell it you want no angular rotation, and it stops rotating forward, but to keep this angle it has to move at some speed. The timing of this would be rather tricky I think, but not impossible. I'm not much for Dynamics such as this but maybe admin or some one else could shed some light on that approach (I just made it up ;D)
Title: Re: My Balancing Robot
Post by: JesseWelling on November 26, 2006, 04:32:29 PM
To measure angle why not use a plumb joint that hangs down (with a weight), and make sure to use some really smooth ball bearings, then just slap an quadrature encoder on the joint, then you have angular acceleration (and direction) and absolute angle.... Sounds easier than all that analog stuff to me...

or better yet you could use a servo with a lever arm and a weight on the end to also actively balance ,or use in conjunction with the pid controll to initiate movement the way a human does on a segway. But this seems like a Rube Goldberg to me, and while 'cute' is not desireable in an engineering sense.
Title: Re: My Balancing Robot
Post by: JesseWelling on November 26, 2006, 04:36:40 PM
Yea that really depends on the weight of the pendulum. The better your bearing is the lighter the weight can be though.
Although your solution once you get the bugs worked out is more solid state and scaleable. but for DIY at the hoby level I think the encoder would be an easier solution.
Title: Re: My Balancing Robot
Post by: JesseWelling on November 26, 2006, 04:44:57 PM
yea well it wasn't my idea really ::)
Title: Re: My Balancing Robot
Post by: jailsellgren on November 26, 2006, 05:33:37 PM
Here is how I am doing it, I have researched this a lot and I am combining a gyroscope with an accelerometer in a kalman filter to tell tilt. I will work out the algorithms later when i have all my supplies, but for now i need your guys help deciding which parts i need,

does the voltage of the battery(7.2) need to match some requirements? do all my motors need to be at or above 7.2 and do microcontrollers have a limited input(will i break it with too big a battery or will i break anything) or does it figure out what it needs.
Also what type and which modle of microcontroller should i get i havent gotten a real answer on that.  So mainly i want to know if all my equipment needs to be a certain voltage, if i can im going to move up to a 10-12 volt battery for my motors because it asks for that i think. So will it be ok to have that high voltage with all the other stuff??

ive been looking for wheels and cant find any slim, large diameter wheels, like on the balbot, (  if you see any tell me

So far, I'm Sure im getting these, If you see a problem please point it out  12v 2000mah nimh battery  Dual H-Bridge Motor Driver           2x   ML-50 50:1 Gearhead Motor Accelerometer Breakout Board - ADXL311 +/-2g Gyro Breakout Board - ADXRS300 - 300 degree/sec
Some wiring connectors for battery and mc
Also some hdpe plastic, some rods and a flat piece, 4 rods going up with levels of the 1/8'' 
how do i mount those round motors on the plastic, edit: i think i have an idea with the L or U shaped aluminum bracket but any reccomendations are good

So what microcontroller should i get, just pick 2 and give me links, then il pick one or something
  <---important, please give an answer you guys havent said much on mc's

THANKS!!!! ;D ;D ;D

edit: is this motor controller better? its  cheaper
Title: Re: My Balancing Robot
Post by: JonHylands on November 26, 2006, 07:15:06 PM
It really depends on what language you're comfortable programming with...

If you're a BASIC guy, then there are one set of solutions that can work for you. If you're a C programmer, there are a different set.

- Jon
Title: Re: My Balancing Robot
Post by: JesseWelling on November 26, 2006, 10:09:47 PM
I think AVR's are the best micro controller to start on because they use a free compiler, are full of features, and are pretty versatile.

A lot of people like PICs but in my experience they are more limited than AVRs.
I've never worked with an ARM (not in this kind of context) but I haven't heard good or bad.

Those are the more general micro controllers that are commercially used.
There are a lot of hobby micro controllers, but I don't put much stock in those.
Title: Re: My Balancing Robot
Post by: jailsellgren on November 26, 2006, 11:56:14 PM
k so i looked around and foudn this
       Tini2106_DKit   at   its in the tini arm section 

60 mhz with a 32 bit processer, sooo im guessing thats fast enough but it doesnt say i can program in c, or anthing ive ever heard of heres what it says
Programming Tools & Languages:

    * GNU GCC, Examples & Documents. Last Updated 11/01/04
    * ECLIPSE, Development with Eclipse. Last Updated 6/27/05
    * IsoMax™, Preliminary Release now available . Signed license agreement is required. Click here for License detail
    * In-System Programming Flash Utility

soo whats that???  is there fast board that would suit my needs, please just tell me what to get, im tired of trying to find one
thanks, il be back in the morning
Title: Re: My Balancing Robot
Post by: JonHylands on November 27, 2006, 06:34:07 AM
Yes, that board is definitely fast enough. GCC is the gnu C compiler, Eclipse is a development environment that you can (if you want) set up to program with.

I'll tell you right now - if you've never built a robot before, and you've never programmed before, you're biting off a really big chunk. A two wheel balancer is not a trivial robot to build, at least not the way you're doing it (which is the right way, in my opinion). But I'll be perfectly honest - if you're getting discouraged at this stage, after only looking at available parts and stuff for two days, you're not going to make it, because you're going to run into much bigger problems when you're building this thing.

I would try and build something much simpler first that will get you closer to your goal. Build a 2-wheel balancing chassis, but then add "training wheel" castors front and back so you don't have to worry about actually balancing it. Get the thing working, with the micro-controller talking to the sensors and motors, and make it do something really simple like drive around a room without hitting any walls or obstacles.

Once you have a robot that works that way, then you'll be ready to take off the training wheels and start playing with balance algorithms.

- Jon
Title: Re: My Balancing Robot
Post by: onesandzeros on November 27, 2006, 05:15:48 PM
hey everyone, this is my first post here
nice forum, lotsa great infos..
Iam also trying to build a balancing bot. iam just fascinated by them :)
i started by playing with a viper from microbrik.
played with some simple code, but it isnt impressive.
i also want somethign like balbots..
my programming sux real bad, so this will be the worst part

here is a parts list iam working on
1 x netmedia Basicx-24 development station
1 x Pololu Micro Dual Serial Motor Controller
3 x Pololu Round Robot Chassis
2 x Sahrp Gp2d120 ir range sensor (4 to 3o cm)
1 x gws PG_03 Piezo Gyro
2 x Solarbotics GM8 - Gear Motor.
i also have 1 dimensions engineering accelerometer (2 axis
and 1 sparkfun tripple axis accelerometer
I should only need a dual axis accelerometer i beleive.

I believe in the october issue of "Nuts and Volt" there is an issue on building a balancing bot. (id ont have october issue :( )

This will be my first custom bot
Title: Re: My Balancing Robot
Post by: onesandzeros on November 27, 2006, 06:51:20 PM
check out the parts list from BBOT of Carnegie Mellon University

might help us some
Title: Re: My Balancing Robot
Post by: Admin on December 22, 2006, 10:58:03 PM
Title: Re: My Balancing Robot
Post by: Cognaut on December 23, 2006, 12:53:28 PM

I was thinking about building a unicycular robot with a Jestson's feel to it, so I was looking at hardware.  I ran across this guy and his electric unicycle.  Check this guy out.
Title: Re: My Balancing Robot
Post by: Admin on December 23, 2006, 01:00:20 PM
i think you should build a two wheel version first, then carry over the tech and parts when its working . . . its what the guy in the link did . . .

i think the unicycle idea is even harder, but would be cool if you could pull it off . . . so when are you making it?  :P
Title: Re: My Balancing Robot
Post by: Cognaut on December 23, 2006, 02:05:40 PM
I'm working on it right now, in the sense that I'm searching for available parts and making plans.

I'm looking at an idea that I got from an article about JeanPaul Jenack who had his world record for riding the smalliest unicycle disqualified because of it's unconventional design.  The tire is a drive belt, so it's more like a tread than a tire.

I've also been working out the concept for the arms.  I think that I can use the arms in two ways.  One, as the counter weight for rotation around the vertical axis and, two, as two legs of a tripod when the robot is at rest.  It should be able to start and stop from the tripod position.  As I'm typing this, I'm remembering that R2D2's two legs and base formed a tripod.  It's the same idea.
Title: Re: My Balancing Robot
Post by: Admin on December 24, 2006, 11:13:31 PM
robot unicycle:

the description i could find:
"a LEGO unicycle using one drive wheel and three other wheels moving in the air to maintain the robots balance.

Similar to two wheeled LEGO/Segway designs, the robot uses optical sensors for balance. However, since this is a unicycle, it required two additional optical sensors plus a center of gravity (COG) mechanism to adjust for tilt along the second axis."
Title: Re: My Balancing Robot
Post by: Cognaut on December 25, 2006, 01:04:31 AM
interesting.  I hadn't thought of that way of doing it.
Title: Re: segway style robots
Post by: Admin on January 05, 2007, 08:17:29 PM
another segway bot (has video, too)

it uses a single sharp IR rangefinder for balance

he also includes ATMega32 code for it here: