Go Down

### Topic: gyro sensor (Read 1 time)previous topic - next topic

#### hcwickz

##### Dec 17, 2011, 04:27 am
Hi everyone

I am using two gyro sensor-lisy300al for the two brushless motor to stabilise my helicopter.
I had designed the graph showing deg/s for the motor . But how can i make use of the graph to do something to stabilise it ?
The speed of the brushless motor is controlled by manually adjusting the voltage.
As the gyro sensor is only calculating the angular velocity( how fast it is spinning) , what does it got to do with stabilising?

#### WizenedEE

#1
##### Dec 17, 2011, 04:53 am
If you add up all of the speeds (the output of the gryo) you'll get the angle. It's called integrating (from calculus, but it's not difficult at all). You can use the angle to tell the helicopter to lift up one side more or less so that it's always horizontal.

#### hcwickz

#2
##### Dec 17, 2011, 05:17 am
can u give me an actual formula of getting the angle? so how to use the angle to tell the helicopter to lift up one side more or less ?
On my project , i am using a tail motor which is on the far right and a main motor which is on the far left . the tail motor has a faster speed , so which side to lift more or less? left or right?
Thanks , this is my  first time doing this.

#### WizenedEE

#3
##### Dec 17, 2011, 06:40 am
Code: [Select]
`void loop() {  static unsigned int angle = 0;  static unsigned long lastTime = 0;  static unsigned long time;  anglerate= analogRead(2);  /*Scale anglerate so that it's in degrees per millisecond, centered around 0 - depends on specific gyroscope*/  time = millis();  angle += anglerate * (lastTime - time); /* This is the important part */  lastTime = time;}`

If you look up integrals, the second to last line (angle +=...) is what is doing the integration. anglerate is the height of the rectangle, and (lastTime - time) is dx. In a real integral, they say that dx is infinitely close to 0, but in real life, you can only get so accurate so dx is just the time per loop.

#### Fenestron

#4
##### Dec 17, 2011, 08:24 am
I think it will be better if you dont use integral to stabilze your helis
because while you integrating the signal there will be a drift which
leads a big error after a while. It will be better if you only use the angular
velocity of the gyro to stabilize your helis. But if you wanna actually take the control
you may also use a magnetometer.

#### hcwickz

#5
##### Dec 17, 2011, 05:10 pm

I think it will be better if you dont use integral to stabilze your helis
because while you integrating the signal there will be a drift which
leads a big error after a while. It will be better if you only use the angular
velocity of the gyro to stabilize your helis. But if you wanna actually take the control
you may also use a magnetometer.

Ya i know i will be using the angular velocity of the gyro to stabilize
But angluar velocityt only tell me the speed of the motor , but what does it do with stabilizing ?

#### Fenestron

#6
##### Dec 25, 2011, 11:29 pm
?f you consider the gyro output is equal to zero while helicopter is standing at a constant
heading. and if you multiply the output of the rate gyro with a constant which you tune during flight test
( if the gyro rate is positive the motor will get faster and if it has a minus sign it will slow down)
. this can be damp the oscillations and stabilize your helis.

#### MarkT

#7
##### Dec 26, 2011, 02:11 am
[ Firstly just say the gyro knows nothing about the speed of the motor, it measures to turning of the vehicle framework ]

This is a standard problem in flight control, the keywords to search for are "inertial navigation", "6DOF", "9DOF", "IMU", "kalman filter".

Basically you combine the rate-gyro and accelerometer signals to determine the current attitude of the craft and use this to determine the correction amounts for each motor.  You can also add compass and GPS sensors into the mix for full navigation.

In the short term integrating the gyro will provide attitude information, but unless you have a 3-axis gyro it won't be very accurate for complex flight (and drifts anyway because you are integrating).  A lower bandwidth correction from accelerometer is used to cancel the drift.  Alternatively this could be done via RC, since humans can react in that timescale (so a gyro-only system stablilises only in short term, but this really is useful!).

A quadcopter is easier than an aeroplane in that it doesn't have to stray much from horizontal, which makes the maths easier I believe - for simple stabilization 2-axis gyro is probably fine (if you don't mind it spinning slowly about the vertical axis!)  To control the latter (yaw) you need a means of altering the thrust vector from one or more rotors, BTW

To calibrate your integration method you can always just set it running and turn the sensor 360 degrees, whatever value your integrating variable reaches must represent 360 degrees(!)

[aside silicon gyros are actually "rate gyros" - measure rotation rate, not angle, which is not the same thing as a standard navigation gyro (which is stable on timescales of weeks)]
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up

Please enter a valid email to subscribe

To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy