MPU-6050 accelerometer reading of one direction

26 vues (au cours des 30 derniers jours)
Nguyen Trieu
Nguyen Trieu le 11 Avr 2020
Modifié(e) : Gayatri Menon le 24 Avr 2020
Hi!
I am using these line of code to continuously read the real-time acceleration values from the IMU(MPU-6050):
clear;
a = arduino('COM5','Uno','Libraries',{'I2C','SPI'});
imu = mpu6050(a,'SampleRate',50,'SamplesPerRead',5,'ReadMode','Latest');
accelReadings = readAcceleration(imu);
display(accelReadings);
It will returns one sample of the acceleration data on x, y, and z axes read from the sensor in units of m/s2 like this:
accelReadings =
-2.3399 -0.5377 3.0201
Is there any possible way for me to retrive only the value of the x axis (the first value only)? I tried to treat it as an array but it is not working.
Also, can I fuse the data (estimate the orientation, quaternion, determine roll, pitch and yaw angles) of this type of this 6DOF sensor(MPU6050) as there is no magnetometer?
Thanks!

Réponse acceptée

Gayatri Menon
Gayatri Menon le 21 Avr 2020
Hi
accelReadings(1) should give you the x values. If you have a license for Sensor Fusion and Tracking toolbox or Navigation toolbox, try using read() for more capabilities. For usage and examples, please refer link for read() .
If you have the above-mentioned licenses, you can use imufilter to determine orientation.'imufilter' uses only accelerometer and gyroscope values. Refer to the example here.
Hope this helps
Thanks
Gayatri
  2 commentaires
Nguyen Trieu
Nguyen Trieu le 22 Avr 2020
Thank you for your response, however I am only interested in retrieving the values appeares on the axes seperately to plot the graph of the accelerometer values on x, y and z axes. The read fuction always generate the result as a set of 3x1 matrix.
And regarding the gyro and accel value fusion, I can't figure out how to get the value of accelerometor noise of 0.0061m/s^2 in this piece of code in the example:
displayMessage(['This section uses IMU filter to determine orientation of the sensor by collecting live sensor data from the \slmpu9250 \rm' ...
'system object. Move the sensor to visualize orientation of the sensor in the figure window. Keep the sensor stationery before you'...
'click OK'],...
'Estimate Orientation using IMU filter and MPU-9250.')
% GyroscopeNoise and AccelerometerNoise is determined from datasheet.
GyroscopeNoiseMPU9250 = 3.0462e-06; % GyroscopeNoise (variance) in units of rad/s
AccelerometerNoiseMPU9250 = 0.0061; % AccelerometerNoise (variance) in units of m/s^2
viewer = HelperOrientationViewer('Title',{'IMU Filter'});
FUSE = imufilter('SampleRate',imu.SampleRate, 'GyroscopeNoise',GyroscopeNoiseMPU9250,'AccelerometerNoise', AccelerometerNoiseMPU9250);
stopTimer=100;
Would you mind clarify?
Best Regards.
Gayatri Menon
Gayatri Menon le 23 Avr 2020
Modifié(e) : Gayatri Menon le 24 Avr 2020
Please refer the below link.This link explains how the noise is calculated for MPU9250. A similar approach can be used for mpu6050 as well
Thanks
Gayatri

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by