Thread: Capi's Gyro 101
View Single Post
Old 05-30-2008, 07:18 PM   #1 (permalink)
The Capi
Posts: 25,185
My HF Map location
Join Date: Oct 2006
Default Capi's Gyro 101




This gyro 101 has been written to complement my Brushless 101 located at




Until the wide spread use of the so called gyro in R/C helis flying was very limited due to the constant corrections required on the tail. With modern gyros our helis are able to do just about anything and the tail will hold where we put it, leaving the pilot free to concentrate on other things like cyclic. While many are able to setup a gyro to perform great very few will understand what is inside that magical box. This 101 will NOT be covering setup issues, many such tutorials exists else where and are very brand/model specific. This 101 will serve to teach the average hobbyist what is inside the gyro which will allow him/her to better solve any problems as well as impress their buddies at the flying field. Before we get started i must first get alittle house keeping out of the way, i will be referring to gyros as the mechanical sensor that will measure the rotation and gyro systems as the complete system we strap to the heli (the GY401 is a gyro system). The topics to be covered will be.

** Servo control signals

-- Pulse Width and Frame Rate
-- Analog vs Digital Servos

** Coriolis Force

** Gyroscopes

** MEMS Angular Rate Sensors

-- Fabrication of Angular Rate Sensors
-- Tuning Fork Sensor
-- Vibrating Ring Sensor

** PID Controllers

-- Proportional Path
-- Integral Path
-- Derivative Path

Well dust off your pencils and take a seat we are about to get started


Servo control signals

**** _____Pulse Width and Frame Rate_____****

So whats this talk about pulse width and frame rate ?? Well first let me be the bearer of bad news, regardless if your using a 72MHz or 2.4GHz radio the signals from the rx to your servos are the same. The same applies if your using digital or analog servos, the signal from the rx has NO idea what type of servo your using. The signal being sent to the servo is an analog signal NOT digital (PCM, PPM .... doesn't matter, this is what allows us to mix and match rx and servo brands), do not make the mistake of thinking that any signal that can only exist in two states (HIGH/LOW, GND/VCC, 0/5V) is digital. In a digital signal the information is stores in the logic level sequence. Our servos and rx communicate with PWM (pulse width modulation), this means the information is stores in the position (aka time) of the edges/transitions from HIGH to LOW (or vice versa). Lets first start with what is a frame rate ?? Our radios do not communicate with the servos in a continuous manor but rather make periodic updates to the servo position. In the case of analog servos the servo gets a position update every 20ms. Digital servos typically have a higher frame rate such as 333/250Hz (20ms = 50Hz), you can run a servo with a higher frame rate than the frame rate of the signal but not the other way around. That little DS switch on your GY401 that tells the gyro system the tail servo is a analog or digital servo, with the DS switch set to the digital servo it outputs a higher frame rate meaning it sends a position update more often. The more often the gyro system sends a position update the better the servo is able to maintain its position.

Okey lets move on to pulse width. Typically servos have a 1520us (1000us = 1ms) servo pulse, which means that when the width of the pulse is 1520us the servo is centered. For an analog servos the lower end (full negative throw) is 1000us and the top end (full positive throw) is 2000us. So the difference between a full positive and full negative throw is 1000us. If we assume the servo can travel -60 to +60 degrees then each degree translates to about 8us. This is where resolution comes into play, the latest buzz is about 2048 resolution ( 11bits, 2^11=2048) which means that that 1000us is divided into 2048 evenly spaced steps (1000us/2048resolution = .488us). With a 2048 resolution system the smallest resolvable change in the servo position change is a 17th of a degree (2048resolution/120degrees).

**** _____Analog vs Digital Servos_____****

So if analog and digital servos get the same signal why on earth am i using expensive digital servos on my cyclic ???!?!?! Well the signals the servos gets from the rx may be the same the way they handle the signal is different. Lets start with an analog servo, every 20ms the rx sends the servo its desired position in the form of a pulse width, the servo will take the difference between the desired position and the actual position and will move the servo to minimize the difference. Under load the servo position will be moved to an undesired position and will only be able to correct the movement during the next update from the rx (20ms). A digital servo on the other hand can remember the desired position and can do the correction more often. An example below shows an analog and digital servo. The graph on the left is an analog servo, the height pulses are a representation of the servo position. The green is the actual location of the servo, at every pulse the servo forces the actual position to match the desired location. Between pulses the actual location can drift. The right graph is a digital servo, between the update pulses the digital servo remembers the desired location and does a correction more often, with a shorter time between updates the actual position isnt able to drift as much.


Coriolis Force

The Coriolis effect is an apparent deflection of moving objects when they are viewed from a rotating frame of reference. First off you must understand that the coriolis force is NOT a real force its a virtual force. The best way to understand the coriolis force is with a simple example. Imagine you are standing on a marry go round and you visualize a spot off the marry go round. The merry go round starts to spin at some speed and you begin to walk to opposite the rotation of the marry go round so that you stay in aline with that spot. If the marry go round spun at a faster speed you would have to walk faster so that you stayed in that one spot. The change in your walking speed is an acceleration, and since newton;s law of motion

Force = Mass* Acceleration

there had to have been a force, but there was no real force pushing you to walk faster, this is the coriolis force. All gyros are based on the coriolis force, they measure rotational rates by measuring deflection in some other axis.



Mechanical gyros consist of a rotating rotor (i told you before engineers are not that creative when it came to naming things) that is free to rotate in two other axis. The rotor consists of a large rotating mass that will spin freely and maintain a constant angular velocity (how fast it turns). When an external rotation acts on the gyro the rotor will resist this movement and will maintain its plane of rotation, meaning the disk will remain in the same place but the frame holding the rotor will move. Any rotation in the sensing axis (the axis that is normal to the surface of the rotor, aka shooting out perfectly straight from the flat surface) will cause a rotation in the 2nd axis (the axis that points straight out from the edge of the rotor) due to the coriolis force.

The link above is a nice GIF from wikipedia. The spinning axis is the direction the rotor will spin and will resist change in. The input axis is the green arrow, this is the axis that the gyro is able to measure rotation in. Finally the blue arrow is the output axis, Any rotation in this this axis is proportional to the angular velocity of the rotor (aka how fast it turns) and the rotation on the input axis. Mechanical gyro have almost completely been replaced by non mechanical gyro such as the ring laser gyro for precision application, but due to their insanely high cost are impractical for our heli gyro systems.


MEMS Angular Rate Sensors
**** _____Fabrication of Angular Rate Sensors_____****

Laser ring gyros are just too expensive for use in our helis so we have gone back to mechanical sensors. Traditional mechanical gyros are still very expensive and difficult to make. To reduce the cost of gyros our heli gyro systems almost exclusively use MEMS based gyros. Whats a MEMS ?? It stands for Micro ElectroMechanical System which is a really fancy name for a mechanical system built onto the surface or into the surface of an integrated circuit. MEMS use the same techniques that are used to build integrated circuit which allows allows for a batch process (you can make ALOT at the same time) as well as being able to make them VERY small. The mechanical sensors are built onto the surface of the integrated circuit by selectively patterning and removing sections from the stacked layers. Basically integrated circuits are interchanging layers of insulator (dielectrical layers typically silicon dioxide) and metal layers (alum/copper/Ti used for routing of power and signals). The metal layers are patterned to form the structure of the mechanical parts and the insulator layers are removed from below them to release the metal parts. Below are two examples of MEMS systems

**** _____Tuning Fork Sensor_____****

The first MEMS sensor we will look at is based on a tuned fork. The tuned fork is conceptually the same as the tuning fork used to tune musical instruments. The tuned fork is forced to oscillate with the two prongs vibrating back and forth so they move closer and further apart only, this is called the radial movement. If we rotate the tuned fork the coriolis force causes some of the energy from the radial movement to be transfered to the coriolis movement given by

coriolis acceleration = 2*Rotational rate X radial acceleration (X is NOT multiplication its the CROSS PRODUCT)

The cross product is a fancy bit of math but all you need to know is that the coriolis acceleration/force is perpendicular to the radial acceleration (happens at 90degrees) and proportional to the rotational rate (they both increase and decrease together). The faster the tuning force rotates the more of the radial movement gets transfered to the coriolis movement.Typically the tuning forks are composed of piezo electrical material, piezo material has a rather interesting property. When an mechanical force is applied to a piezo material a voltage is created, and when a voltage is applied to the material it cause a movement. By applying a oscillating voltage to the peizo material it will vibrate, by controlling the where the voltage is applied the tuning force is forced to vibrate in the radial movement. By measuring the voltage on the other edge of the peizo fork we can measure the coriolis vibration.

**** _____Vibrating Ring Sensor_____****

MEMS gyros are technically not even gyros ! Gyros have a rotating mass that resists movement, unfortunately MEMS are so small you can't build a large mass and friction doesn't scale down. Instead of a rotating mass the mass is forced to vibrate, this is why they are more accurately called angular rate sensors. The most popular gyro used in our helis are based on ring structures. The ring gyro consists of a outer ring suspended by flexible spokes connected to a hub in the center,the center hub is a fixed point where the outer ring is fixed to the surface of the integrated circuit. Surrounding the outer ring are electrodes, these electrodes serve a dual function. If a voltage is applied to the electrode it will repel or attract the section of the outer ring thats close by. The second function of the electrodes is to sense the distance between itself and the section of the outer ring close by. The electrodes are driven to force an oscillation that causes a deformation of the ring from a circle to an ellipse shown below. The deformation causes nodes (this part of the ring doesn't move) and anti nodes (this part of the ring moves the most) as shown below.

The coriolis axis will be the same as the driven deformation oscillation but shifted by 45degrees as shown below.

As the gyro is rotated in plane with the ring some of the energy from the driven oscillation will be transfered to the coriolis axis. The electrodes near the anti nodes (the part that moves the most) will measure the oscillation in the coriolis axis (remember that dual purpose i mentioned). The rotation rate is simply a measure of how much deformation there is on the coriolis axis. Normally these gyros are built into a closed loop system, basically the electrodes in the coroilis axis force the deformation in the coroilis axis to STOP, and the rotation rate is simply a measure of how much force is required to stop the deformation. The closed loop system increases performance (Servo and gyro systems are another example of closed loop systems).


PID Controllers

The most common control system utilizes some form of a PID controller. A PID controller is a closed loop system, this means that the output is feed back into the input in an attempt to minimize mistakes or errors. Controllers can be as simple as a P (Proportional), PI (Proportional and Integral) or the full PID (P, I and Derivative). This is only a very simple coverage of the topic, there is an endless amount of material to cover in control systems.

**** _____Proportional Path_____****

The most basic feedback control system is a proportional system shown above. The first stage (the circle) is called an error amp, its job is to take the difference between the desired rotational rate from the rx and the actual rotational rate from the gyro. The difference is called the error (i bet you didn't see that coming), the error is further amplified by the gyro gain (gyro sense gain !!!). The amplified gain is then converted to a PWM signal to control the tail servo. The tail servo changes the pitch on the tail blades that generates a torque in the proper direction. This new torque will cause a new rotational rate. The new rotational rate will again be compared to the desired rotational rate and the error will again be amplified. The system will continue to do this until the error is zero, the heli will stop rotating if there is no input from the pilot (no tail input means the desired rotational rate is zero). The diagram below shows a basic example.

Lets assume the heli has been settled for awhile and the desired rotational rate is the same as the actual rotational rate (green represents the actual rotational rate and the lines indicated the desired rotational rate, they are at the same height so they are the same). At some point the pilot wants a new rotational rate (notice the step up in the lines), at this point the actual and desired rotational rates will differ. the error will be amplified until the desired and actual rotational rate match again. The red area shows the difference between what the pilot demanded and what actually happened.

Lets take another example where the pilot desired a fixed rotational rate but some wind or external force is trying to push the heli to rotate. Again the green area is the actual rotational rate and the lines are the desired rate. The red section is the difference between the desired rotational rate and the actual rotational rate. During the red section the heli actually rotated (area of the red section will tell you how much it turned) because this system ONLY trying to reduce the error between the desired and actual rotational rates NOT the direction the heli points. This is what we refer to as a RATE GYRO SYSTEM. One may ask why don't we just crank the gain up until the error gets corrected so fast that it acts like a heading hold gyro system. Well below is an example of what happens when the gain is too high.

The tail wags !!!!!!!!!!!!

**** _____Integral Path_____****

Adding an integrator into the system creates a heading hold gyro system !! The integrator's job is to keep track of error and reduce that to zero over time, this will have the effect of maintaining a constant heading. Below is another example of how the gyro responds to a external force (it will behave the EXACT same to a change in heading). The integrator will force the yellow and red areas to be equal, when these areas are equal the heli will maintain its original heading !!!!!

**** _____Derivative Path_____****

The problem with adding the integrator is that the heli will "bounce", when you do a nice piro move and stop the tail will bounce around for a bit. That bouncing is from the yellow and red sections from above, it will continue to bounce until they are equal. Adding a derivative to the above controller will help to reduce that bouncing (we refer to the bouncing as overshooting in engineering). While the derivative component seems to be simple its actually the hardest part to implement because it exasperates any noise in the system.

The derivative is basically the slope of the line or the tangent at the instantaneous point. So imagine the case where you have just a PI controller. As the I portion causes the response to overshoot (an inherent property of any 2nd order system)the slope of the line increases, the derivative section starts to output a correction signal thats proportional to the slope. The increased output causes the system to track faster. So this means that when the system needs to respond quickly the D section kicks in, when the output needs to move slow the D section doesn't provide any output. The I section is rather slow to respond so the larger its portion of the correction the slower the system will be to change, because the D section is helping the system to track faster there is no overshoot as the I section doesn't build up.

The trouble with a derivative section is best proven by example, lets say out input is a sin wave

x(t) = Asin(wt)

where A is the amplitude and w is the angular frequency (related to frequency by 2*pi). If we take the derivative we get

x'(t) = Awcos(wt)

Notice the angular frequency (w) is now part of the amplitude ! This means that higher the frequency of the signal the larger the output. Any real world signal is composed of the desired signal and unwanted noise. This noise consists of a white noise signal which contains energy at all frequencies . Even the smallest high ferquency noise will produce a LARGE output on the D section which will cause the wanted output to be saturated. This requires careful design to limit the input frequency to the D section as well as trading off its advantages to remain on the safe side.

Well there is alot more material that can be covered on this topic but there is alot to absorb here. Again if i have made any mistakes or omissions (I write these things in one day) please PM me.
Attached Thumbnails
Click image for larger version

Name:	PULSE.jpg
Views:	55296
Size:	16.0 KB
ID:	49746   Click image for larger version

Name:	SERVO.jpg
Views:	54745
Size:	11.3 KB
ID:	49747   Click image for larger version

Name:	COR.jpg
Views:	54946
Size:	4.9 KB
ID:	49753   Click image for larger version

Views:	55262
Size:	15.1 KB
ID:	49754   Click image for larger version

Name:	mems1.jpg
Views:	55804
Size:	13.1 KB
ID:	49755  

Click image for larger version

Name:	figure02.jpg
Views:	55608
Size:	8.0 KB
ID:	49756   Click image for larger version

Name:	delcosensor.jpg
Views:	55304
Size:	8.5 KB
ID:	49757   Click image for larger version

Name:	gyrodeform.jpg
Views:	55119
Size:	8.0 KB
ID:	49758   Click image for larger version

Name:	Node.jpg
Views:	54731
Size:	8.8 KB
ID:	49759   Click image for larger version

Name:	Node2.jpg
Views:	55227
Size:	9.1 KB
ID:	49760  

Spreading capibara awareness since 2006

Last edited by DominicD; 06-30-2010 at 07:41 PM..
DominicD is offline        Reply With Quote