Go Down

Topic: MPU6050 Z-AXIS (Read 429 times) previous topic - next topic

Delphir

Hi all,

I`m trying to get a Z-axis position with help of my MPU6050.
I`m using code from this sample: https://github.com/helscream/MPU6050_Arduino

X and Y axes are ok, but Z axis is constantly drifting to something around "~90" after rotation..
If someone can help me getting Z-axis value not just from gyro or accel, but "corrected" to be a real Z value with errors fixed?



michinyon

what do you mean by "position" ?

This device measures apparent acceleration and angular velocity.

Peter_n

X, Y and Z are all the same.
Did you try an other sketch to test ?

Delphir


X, Y and Z are all the same.
Did you try an other sketch to test ?


I have tried an i2cdev lib for DMP readings (https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050/Examples/MPU6050_DMP6)
this one is getting better values (e.g. is able to detect the direction of rotation, and is +/- precise) but it collects an error very quickly and sometimes continue to slowly drift values a little when the sensor motion is stopped.

Btw. How precise is MPU6050 YAW(Z) Axis ?

Delphir


what do you mean by "position" ?

This device measures apparent acceleration and angular velocity.


That`s really cool that you are so clever and know the "angular velocity" word, but you should also know that in real world most people are interested in the actual sensor positions in a X/Y/Z angular dimension.

michinyon

It is very difficult to give you useful advice,  when your question seems vague and confused.

michinyon

"Position" of a device generally refers to the location of it.   If you are interested in the orientation of the device,   then use the word "orientation".

Gyroscopic sensors enable you to estimate the orientation of a device.   They are of no use for estimating position.

Any gyroscopic sensor has an accuracy error ( called "drift" ),  which varies with time and temperature and varies from device to device.

The variation in the apparent orientation of the device calculated by continuous integration of the apparent rotational velocity,  will appear to drift slowly around in three dimensions due to the drift error of the individual angular velocity measurements.

The calculated orientation can be corrected by knowing the direction of "up" ( or down ),  using the accelerometer reading combined with an assumption that the device is not subject to actual linear acceleration.

However,   the apparent rotation of the device about the vertical axis,  cannot be corrected by knowing the direction of up or down,   because an change in the position of the device by rotation about the vertical axis,  does not give rise to a discrepancy between the predicted and actual direction of gravity,  which would enable the estimate to be corrected.

If your device operates so that it generally has a constant axis orientation,    so that it presents only one axis of motion to the vertical direction,    then you can measure the rate of drift manually by experiment,   and adjust the readings from the gyroscopic sensor by a corresponding, offsetting,  amount,   which will reduce the apparent motion for as long as the device's drift error remains approximately constant.    This method won't work very well for a device where the orientation changes a lot in all directions, like a stunt aircraft or a football.

The other method for correcting orientation drift is to use another orientation reference,  for terrestrial application,  this would be a geomagnetic field sensor.   



Peter_n

michinyon +1 for politeness.

raschemmel

Delphir: -1 for politeness
michinyon: +1 for patience.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Go Up