Plotting output of three MPU6050 sensors in Matlap in three different graphes
37 views (last 30 days)
Show older comments
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 Comment
Ajwad Wa'ie
on 1 Dec 2019
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
Answers (1)
Gayatri Menon
on 7 Jan 2022
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
or
execute
>>help mpu6050
Hope this helps
Thanks
Gayatri
0 Comments
See Also
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!