Plotting (Graphing) Accelerometer + Gyro MPU6050 using Arduino and Processing

preview_player
Показать описание
GET CODE HERE:

The InvenSense MPU-6050 sensor contains a MEMS accelerometer and a MEMS gyro in a single chip. It is very accurate, as it contains 16-bits analog to digital conversion hardware for each channel.

The gyro+ accelerometer simultaneously puts out 6 readings : g, gy, gz, ax, ay, az,

Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Processing was actually one of the programs that Arduino was originally based on and is a great way to visualise arduino sensor outputs

There are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning and prototyping.

SOCIAL:

WEBSITES:

code Arduino:
#include "I2Cdev.h" // include the I2Cdev library
#include "MPU6050.h" // include the accelerometer library
MPU6050 accelgyro; // set device to MPU6050
int16_t ax, ay, az, gx, gy, gz; // define accel as ax,ay,az
int baselineX = 0;

void setup() {
baselineX = ax;
}
void loop() {
delay(2);
}

code Processing:

Serial myPort; // The serial port
int xPos = 1; // horizontal position of the graph
float inByte = 0;

void setup () {
// set the window size:
size(1000, 600);

// List all the available serial ports

// I know that the first port in the serial list on my Mac is always my
// Open whatever port is the one you're using.

// don't generate a serialEvent() unless you get a newline character:

// set initial background:
background(0);
}

void draw () {
// draw the line:
stroke(127, 34, 255);
line(xPos, height, xPos, height - inByte);

// at the edge of the screen, go back to the beginning:
if (xPos greater= width) { //careful with this line requires a symbol that is not allowed in YouTube
xPos = 0;
background(0);
} else {
// increment the horizontal position:
xPos++;
}
}

void serialEvent (Serial myPort) {
// get the ASCII string:

if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// convert to an int and map to the screen height:
inByte = float(inString);
println(inByte);
inByte = map(inByte, 0, 1023, 0, height);
}
}

-~-~~-~~~-~~-~-
Latest and Best Arduino Playlist in Collaboratio with DFRobot:
-~-~~-~~~-~~-~-
Рекомендации по теме
Комментарии
Автор

You are one of the best teacher for Arduino tutorial.

sudinroy
Автор

Sir, can we see the graphic picture at Arduino IDE serial monitor or use other IDE software for viewing this graph ?

sudinroy
Автор

Bro, I'm having one doubt in the waveform graph the x axis and the y axis are mentioned as Amplitude and Time or not?

juneharkevin
Автор

Hi, nice job, one question: can this code be compatible or appliable to LSM6DS3-Arduino Uno Wifi rev 2?

swugcdmx
Автор

Which is the best sensor between MPU6050 and ADXL335 in your opinion?

TheBannasak
Автор

I go to the link to download the file...and its broken...can u upload again pliz

aimansebir
Автор

would this work with an ESP32-pico and MPU 6050?

carlosalonzo
Автор

Very nice video and well explaining
vedio also.Thank you sir.

sudinroy
Автор

is ther a way to pring more than one line

schiggo
Автор

Indeed, you’re really gifted teacher. You are the best 🤭. Can u help me to get the code. It isn’t available in thy link.

mrmatias
Автор

Sir, I could not able to get the Plotting code, Pls will you help me. i have checked the Robotix site also

rameshchandrakasan
Автор

Whats the rate at which data is plotted....how many samples per second? If 8000 samples per second feasible?

parulaggarwal
Автор

Thank you sir. This is very simple, clear and distinct. But can you tell me why the MPU6050 gives sometimes NaN(Not a Number) value as its output?? It sometimes disturbs the processing graph and it freezes the graph. And again I am helpful that you uploaded the source code. Not just uploaded the demo video like a lot of other videos.

hjedpej
Автор

can not download the file. showing me no file

yasirshahzad
Автор

Could the Electronic Schematic Diagram be made available?

animeshanand
welcome to shbcf.ru