# Gyro/Balance question

A couple of us on 131 where chatting about building a balancing platform (similar to the platform on the segway) but with no handle bars and such.

I have a couple of questions,

If you have something on this platform, and you play it in front of the axle it will go forward correct? Now if you leave it in the same spot, will it gather speed as it moves forward or will it keep a constant speed?

Does anyone know of any balancing code that is available?

Does anyone know how to program or how to go about programing a “Speed limiter”. Lets say the object is going to fast the platform will tilt back to keep it going below the top speed?

Thanks,
Matt

You have to increase speed with the tilt enough ot keep the platform balanced but not enough to stop it from “falling”. A speed limiter requires a kick in the power to the motor so the platform can catch up, a capaciter could be used to charge it and release or you can keep a certain area of power “roped off” in the programming and make it max out when you reach the speed limiter. I think Team 45 has a whitepaper with code they used to balance their robot on the ramp in 2001 (I think) using the gyro, take a look at that.

*Originally posted by Matt Krass *
**You have to increase speed with the tilt enough ot keep the platform balanced but not enough to stop it from “falling”. A speed limiter requires a kick in the power to the motor so the platform can catch up, a capaciter could be used to charge it and release or you can keep a certain area of power “roped off” in the programming and make it max out when you reach the speed limiter. I think Team 45 has a whitepaper with code they used to balance their robot on the ramp in 2001 (I think) using the gyro, take a look at that. **

Thanks, I’ll take a look.

I would love as much feedback as possible!

The Segway is basically a standard inverted pendulum problem with a couple of new features put in. The reason I say it is a “standard” problem is because this is a problem that EVERY student in control engineering studies in their first control course. This is the most common problem of making an inherently unstable system stable through the use of automatic feedback control.

There is a great inverted pendulum tutorial on the web that was created by the University of Michigan, Carnegie Mellon University, and Ohio State Universtiy. You can see the tutorial at:

http://rclsgi.eng.ohio-state.edu/matlab/examples/pend/invpen.html

If you plan on making any self-balancing platforms, I would suggest that you start by looking through this tutorial.

Have fun!

-Chris

I had a couple of student try to get a balancing platform working. Their goal was design a home built segway.

This link takes you to the current web site:

http://wihs.no-ip.com:8181/~willum/craigway.htm

Currently the platform will increase speed in the direction of tilt but the drive train is not yet strong enough to support a human rider. The rider must support his/her own balance.

All we were able to demonstrate is that the FKOP gyro/robot controller can be programmed to respond appropriately to a tilt provided by the rider.

We plan on working on a metal version with CIM motors this fall and spring (in the "off-season, if one really exists)

What the project does not yet do is “hold balance”.

That is an immediate goal once we get the new platform working.

If you have programming questions e-mail the creator of the web site, he was our lead programmer and has spent many hours working on this project.

A segway-like machine should go a constant speed appropriate (or balanced) for the tilt of the machine. As the tilt changes the speed must change to maintain balance. Instead of thinking about a “speed limiter” you should think about a “tilt limiter”. Speed limitation will follow naturally.

Limiting the power output to your motors would be bad because the motors may need all the power they can get to maintain balance. Instead set an allowed range of tilt and allow your motors to keep it from going out of that range by speeding up more at the extremes of the range. It will probably take a lot of tweaking to figure out the correct function to calculate speed based on tilt. I suggest you start with a small range and work your way up.

As for the tilt sensor itself, I assume you want to use the gyro from the kit. Unfortunately that thing is no match for the 5 gyros on the actual Segway. It is a yaw rate sensor (gives the rate of angular change) so you can integrate the gyro to determine the tilt. Our autonomous program last year used the gyro on the yaw axis (left to right) of our bot. We integrated the gyro during a dead reckoning turn and then switched to correction mode. During this mode we compared the integrated value to a stored value we determined to be about 145 degrees. We turned the robot until the two values matched. After it achieved its angle, it was constantly correcting to make sure the robot stayed straight (even while pushing bins or other bots autonomously). You could use a similar system to keep it from going past the tilt limit.

The gyro has a small flaw which may create major problems in a balancing. The analog value giving by the gyro has a tendency to move up or down by one digit without moving. This could cause your integration to drift off center and your machine to lose balance during extended running periods. For example say your gyro had 127 for a neutral value. It may jump to 128 for a few cycles and then back down to 127. This would make your integration value a little too high. If it does this enough, the value may become way too high and fail (and fall :ahh: ). If this is a problem then a re-centering button might become necessary. This brings up another problem: If you don’t have handle bars, where will you put steering and other controls? I suggest wrist watch controls . It would be so Bond-like to twist a potentiometer on your wrist to turn your machine. Maybe team 007 should consider that for their operator interface next year!

Technokat’s website (www.teachnokats.org), under resources, has all the autobalance stuff in the archive section. Their’s is somewhat specific to their implementation of “balancing,” so be sure to look at everything carefully. Their robot crawled up the ramp and then returned when it started to tip.

I’m sure that if you start programming such a platform, your intuition and trials will lead you toward something like what you want. Keep up updated on how it goes.

*Originally posted by The Lucas *

As for the tilt sensor itself, I assume you want to use the gyro from the kit. Unfortunately that thing is no match for the 5 gyros on the actual Segway. It is a yaw rate sensor (gives the rate of angular change) so you can integrate the gyro to determine the tilt.

I agree, but I didn’t even think they would have gotten this far. I would like to look into integrating a real gyro to hold balance, but have not yet had the time to research a part yet.

The gyro has a small flaw which may create major problems in a balancing. The analog value giving by the gyro has a tendency to move up or down by one digit without moving. This could cause your integration to drift off center and your machine to lose balance during extended running periods. For example say your gyro had 127 for a neutral value. It may jump to 128 for a few cycles and then back down to 127. This would make your integration value a little too high. If it does this enough, the value may become way too high and fail (and fall :ahh: ). If this is a problem then a re-centering button might become necessary. This brings up another problem: If you don’t have handle bars, where will you put steering and other controls? I suggest wrist watch controls . It would be so Bond-like to twist a potentiometer on your wrist to turn your machine. Maybe team 007 should consider that for their operator interface next year!

hahahaha, yes this is a BIG issue. What we do is hold the platform “level” during power up, and a rider “jumps” on staying as balanced as possible and then can tilt left and right, there are no controls for turning yet, but we were going to build a comntrol shaft and handle bars like the segway, although the wrist watch controls would be a great idea as well :-), but i think the handle bars will make the initial design device easier to control.

I wish we had the time and money to work on this project every day… it will have to wait until time permits…

*Originally posted by MrB *
**I had a couple of student try to get a balancing platform working. Their goal was design a home built segway.

This link takes you to the current web site:

http://wihs.no-ip.com:8181/~willum/craigway.htm

Currently the platform will increase speed in the direction of tilt but the drive train is not yet strong enough to support a human rider. The rider must support his/her own balance.

All we were able to demonstrate is that the FKOP gyro/robot controller can be programmed to respond appropriately to a tilt provided by the rider.

We plan on working on a metal version with CIM motors this fall and spring (in the "off-season, if one really exists)

What the project does not yet do is “hold balance”.

That is an immediate goal once we get the new platform working.

If you have programming questions e-mail the creator of the web site, he was our lead programmer and has spent many hours working on this project. **

So what you are saying is that IF you had a stronger drive train that it could balance a human?

*Originally posted by MattK *
**…
If you have something on this platform, and you play it in front of the axle it will go forward correct? Now if you leave it in the same spot, will it gather speed as it moves forward or will it keep a constant speed?

Does anyone know of any balancing code that is available?

Does anyone know how to program or how to go about programing a “Speed limiter”. Lets say the object is going to fast the platform will tilt back to keep it going below the top speed?

Thanks,
Matt **

When you tilt forward or backward you apply a force to the robot that is tan(tilt)g. When vertical (0 deg tilt) you have zero force parallel to the ground. At a 45 deg tilt you have ‘g’ force.

As you know from physics Acceleration = Force * mass. So, with a constant tilt, your platform will accelerate at a constant value determined by ‘g’, the tilt and the mass of your platform.

My balancing robot http://www.barello.net/Robots/Gyrobot uses a FIRST supplied gyro. I augmented it with an Analog Devices tilt sensor so long term drift would not affect the balance.

I am not great with the math, but do a search on “Joe Pendulum” to see an excellent balancing platform that uses just one gyro and wheel encoders to do the job. Other balancing robots you can search for: nbot and “fire marshall bill”

Cheers!