Gyro Sensor Questions

I have a few questions about gyro sensors. First off, while browsing the Parallax site I found this http://www.parallax.com/detail.asp?product_id=28017 This is a gyro sensor right? I need something that can balance a personal transportation vehicle (on one axis) in the configuratuion of two side-by-side wheels. Will this do it? it says it will measure in the range of + or - 2 g’s. Is that enough. I guess what I’m not understanding is how the terms gyro, angular rate sensor, and accelerometer are related or unrelated – will someone please explain it to me?

Also, what happens if say this is balancing a vehicle and there is a lot of vibration or bumps in the road. Will this cause jerky throttle or does it know the difference between vibration and tilting? Would adding another sensor and taking the average reading help this problem if there is a problem?

What I want is to make something that does this: the more the machine tilts, the more it tries to compensate, like a segway I guess.

Thanks in advance for your help with this topic that is so new to me.

I’m pretty sure that the link you posted describes something that could do what you want.

The difference between an accelerometer and a gyro sensor would be that the gyro measures the angular acceleration (how fast is the rate at which an object rotates changes) and the accelerometer measures how much something is accelerating (not angular) .

You could use the 2 axis accelerometer to determine the direction of gravity on your balancing device. This information would tell you how the device is tilted and therefore you could (as you say) compensate. Although theoretically this can be done with a gyro as well, it would have be to be extremely accurate and undetered by spikes of large vibrations to work at all and would be subject to eventual drifts and your segway would eventually be running all over the place. The accelerometer doesn’t have to be as accurate since all of its readings independently can say something about the tilt of the device; in a gyro you would need to deduce the tilt given a past of angular acceleration values.

As for the spikes, the device itself doesn’t know if your riding on a bumpy road or if it is tilting, therefore (as you say) its probably a good idea to implement some software that is capable of determining over several past readings if it is riding a bumpy road or is tilting more than it is tilted already.

Also, although your describe your devicse as 1-axis, the 2 axis on the sensor are required here to determine direction, with 1 you would only be able to determine magnitude. If your balancing device could know of only magnitude, it could possibly know if it is tilting (for example the magnitude of acceleration drops if sensor is mounted straight downwards), but would not know if it is tilting forwards or backwards as both of these events would produce the same sensor readings.

Hope this helps; good luck…

Please remember that an accelerometer measures acceleration. (i.e. changes in speed) It does not give an output when the speed has remained constant. These devices use two machined bars with peizo elements mounted to them. When there is acceleration in one axis, the bar deflects in an opposite direction and the peizo outputs a proportional voltage. With a two axis device, you can sense the direction of the acceleration or deccelleration. (negative acceleration) These devices do need some filtering to damp out vibration and other interference. You may want to consider using multiple devices in a bridge configuration to null errors and give the feedback you need for your application. There are some accelerometers available in Digikey and I would recommend reading the manufacturers literature for a more indepth explanation.

Sorry to drag this slightly offtopic, but I heard that accelerometers could be used to measure tilt when the device is not moving. I think it worked on detection the acceleration ofgravity or something…anybody else know about this?

*Originally posted by Matt Krass *
**Sorry to drag this slightly offtopic, but I heard that accelerometers could be used to measure tilt when the device is not moving. I think it worked on detection the acceleration ofgravity or something…anybody else know about this? **

*Originally posted by piotrm *
You could use the 2 axis accelerometer to determine the direction of gravity on your balancing device. This information would tell you how the device is tilted and therefore you could (as you say) compensate.

Yes, thanks to einstein for figuring out that gravity is basically the same thing as acceleration. To measure gravity you measure acceleration. For example I am sitting here in a chair accelerating 9.8 M/s^2 upwards to countereffect the force of gravity on me which does the same but in the downward direction.

At least I think thats how it goes.

I would first like to clear up something. If you don’t want to read this part and would like to jump into the “hows and whys”, skip down past the %%%%% line below.

An angular rate sensor is NOT a gyro, nor does it act like one. I know it is common slang to refer to an angular rate sensor as an “electronic gyro”, but they are fairly different. One can be made to act like the other, which is what I try to explain below.

Angular rate sensors measure (you guessed it) angular rate, i.e. how fast (degrees per second or radians per second) something is rotating. (it actually outputs a voltage that needs to be converted into physical units, but that is beside the point).

A gyroscope is typically used to measure angular position (not rate), using the principal of “rigidity in space” of the gyroscope. This is how the attitude indicator (artificial horizon) of an aircraft works. You can use a real gyro to measure the inclination of your Segway clone. You will actually need to hook up a potentiometer to one of the gymbals to actually measure the angular position.

A gyroscope can be made to measure angular rate (using the principal of “precession”), but that requires a finely calibrated spring. This is how the turn-rate portion of a Turn Coordinator works on an aircraft.

An angular rate sensor can be made to measure angular position. To do this, you must integrate the signal (yeah! a use for calculus) over time.

So, an angular rate sensor can be made to act like a gyro, and a gryo can be made to act like an angular rate sensor, but they don’t act the same by themselves. They actually measure different things, but using calculus, they can be made to measure the same thing.

(by the way, the “GryoChip” that comes in the kit is an angular rate sensor - not a gyro)

Lastly, an accelerometer is NOTHING like a gyro, and cannot be made to act like one. An accelerometer measures linear acceleration. Using calculus, this can be integrated into linear velocity and position.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

On to the question at hand:

An accelerometer can probably be used to measure inclination (tilt), but it would require a LOT of study, research, and some trial and error to do it well. If you just place the accelerometer on a platform and rotate the platform, it is easy - just use the measured acceleration and some trig and you can calculate the inclination.

However, that all breaks down when you start accelerating the platform in a horizontal direction. Then, part of the horizontal acceleration will now be read by the accelerometer (since the accelerometer is now tilted) and it will become difficult to determine how much acceleration is due to gravity and how much is due to the platform accelerating horizontally - especially when they change simultaneously.

I would suggest buying an ANGULAR RATE SENSOR (see above). You can use calculus to integrate the angular rate into angular position. The angular position is the inclination (tilt) of the Segway-clone. Horizontal acceleration will not affect this measurement.

%%%%%%%%%%%%%%%%%%%%%%%%%%%

Whew - sorry for the length of this post.

-Chris

<Reference to other post> BE WISE!!! </Reference to other post>

*Originally posted by piotrm *
**Yes, thanks to einstein for figuring out that gravity is basically the same thing as acceleration. To measure gravity you measure acceleration. For example I am sitting here in a chair accelerating 9.8 M/s^2 upwards to countereffect the force of gravity on me which does the same but in the downward direction.

At least I think thats how it goes. **

Ops, did that sound like an insult? What I meant is that Einstein was the one who proposed that acceleration is the same thing as gravity. Sorry if it came off wrong.

actually if you integrate the output from the yaw rate sensors they give us in the kit, you end up with rotation (degrees turned)

and if you are using something like the robot controller, which reads the sensor at fixed intervals, you dont have to convet it to degrees, just use whatever scale it comes out to be.

Then integrating is nothing more that added the sensor number and accumulating the result.

Lets say you start with the sensor centered pointing upwards, and its ‘zero’ output is 128

you would subtract 128 from each reading (to normalize ‘zero’ to equal 0, then add it to the accumulated number.

if the sensor starts rotating forwards, the output will go 128, 129, 132… as it accelerates in that direction

and your accumulator will read 0, 1, 5… indicating the amount you are away from center.

the only problem is that after a while the errors will creep into your accumulator, and zero wont be straight up - but its a start anyway.