Plotting output of three MPU6050 sensors in Matlap in three different graphes

조회 수: 20 (최근 30일)
Marvikov
Marvikov 2019년 6월 14일
답변: Gayatri Menon 2022년 1월 7일
Hey guys.
I want to plot my programming code from the arduino/teensy in matlab to see the real time data in a diagram. So what I already have now is the programm code to read out the values of three MPU6050 sensores as a change of the angle in x-, y- and z-axis.
So, now I would like to plot three different diagrams for each axis. And in every diagram, there should be all the three sensors over the time. I am not really used to Matlab workspace, so I would like to get some help here.
I am thankful for every kind of help! :)
  댓글 수: 1
Ajwad Wa'ie
Ajwad Wa'ie 2019년 12월 1일
Bro if you don’t mind, can you share the code for three mpu-6050 on Arduino, because I got the same problem as you

댓글을 달려면 로그인하십시오.

답변 (1개)

Gayatri Menon
Gayatri Menon 2022년 1월 7일
Hi,
For Arduino board, you could use mpu6050() to connect MPU6050 sensor
a = arduino;
imu = mpu6050(a);
xlabel('Count');
ylabel('Acceleration (m/s^2)');
title('Acceleration values from mpu6050 sensor');
x_val = animatedline('Color','r');
y_val = animatedline('Color','g');
z_val = animatedline('Color','b');
axis tight;
legend('Acceleration in X-axis','Acceleration in Y-axis','Acceleration in Z-axis');
stop_time = 100;
count = 1;
tic;
while(toc <= stop_time)
[accel] = readAcceleration(imu);
addpoints(x_val,count,accel(:,1));
addpoints(y_val,count,accel(:,2));
addpoints(z_val,count,accel(:,3));
count = count + 1;
drawnow limitrate;
end
For more help
For more help refer MPU6050 - Arduino
or
execute
>>help mpu6050
Hope this helps
Thanks
Gayatri

카테고리

Help CenterFile Exchange에서 I2C Devices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by