Presentation MEMS

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Interfacing of

MPU-6050 with Arduino


Group Members

 Submitted To:
Dr. Farooq Ahmad
 Submitted By:
Hamza. 2022-MSEE-04
Naeem 2022-MSEE-08
Farooq 2022-MSEE-13
Zeeshan 2022-MSEE-50
Arduino
 Arduino is an open-source hardware and software platform.
 The Arduino platform includes:-
 Microcontroller board
 Integrated development Environment (IDE) for programming the board
What is IMU
 An Inertial Measurement Unit (IMU)
 A device that can measure and report specific gravity and angular rate of
an object to which it is attached.

 Roll: movement along x-axis


 Pitch: movement along y-axis
 Yaw: movement along z-axi
Application of IMU
 IMUs are typically used in:
 Vehicles
 Missiles
 Aircraft (an attitude and heading reference system)
 Spacecraft
 Satellites
 Mobile Phone
 Video Games
 etc.
MPU-6050
 MPU-6050 is a popular MEMS sensor module that combines:
 3-axis accelerometer
 3-axis gyroscope into a single package.
Interface of MPU-6050 & Ardunio
Steps to interface the MPU-6050 with an Arduino:
 Gather the required components: Arduino board, MPU-6050 module,
breadboard, jumper wires.
 Connect the MPU-6050 module to the Arduino board using jumper wires.
 Connect the VCC pin to the 5V pin on the Arduino board,
 GND pin to the GND pin on the Arduino board,
 SDA pin to the A4 pin on the Arduino board,
 SCL pin to the A5 pin on the Arduino board.
 Download and install the "MPU6050" library for Arduino.
 Upload the code from the MPU6050 library to the Arduino board.
Code – (Library Include in main code)
 #include <Wire.h> //Wire library
 #include <MPU6050.h> //MPU library
 MPU6050 mpu; //MPU designation
 int16_t ax, ay, az; //defining of integers for axis
 int16_t gx, gy, gz; //defining of integers for gyro
 struct MyData { //data structure
 byte X;
 byte Y;
 byte Z;
 };
Code – (Serial Communication)
 MyData data; // Serial Communication
 void setup() Arduino and laptop to read and
write data to and from Arduino
 {
 Serial.begin(9600);
Bit rate 9600
 Wire.begin();
 mpu.initialize();
 Serial.println("MPU6050
Initialized!");
 }
Code – (Main Loop and data define)
 void loop() //Main Loop to run the program
 { logic

 mpu.getMotion6(&ax, &ay,
&az, &gx, &gy, &gz);
 data.X = map(ax, -17000, // X axis data
17000, 0, 255 );
 data.Y = map(ay, -17000,
17000, 0, 255);
 data.Z = map(az, -
17000, 17000, 0, 255); // Y axis data
Code – (Main Loop and print the data)
 float ax_g = ax / 16384.0; //Main Loop to run the program
 float ay_g = ay / 16384.0; logic

 float az_g = az / 16384.0;


 float gx_deg = gx / 131.0;
 float gy_deg = gy / 131.0;
 float gz_deg = gz / 131.0;
 int16_t temperature =
mpu.getTemperature();
 Serial.print("Acceleration
[g]: ");
 Serial.print(ax_g);
 Serial.print(", ");
Code – (Main Loop and print the data)
 Serial.print("Gyroscope [deg/s]: //Main Loop to run the program
"); logic
 Serial.print(gx_deg);
 Serial.print(", ");
 Serial.print(gy_deg);
 Serial.print(", ");
 Serial.print(gz_deg);
 Serial.println();
 Serial.print("Temperature [C]:
");
 Serial.println(temperature /
340.00 + 36.53);
Physical Circuit
Video
Outcome
 The whole working setup of the experiment is when code is run
and the sensor is detected and showing its features is shown in
next pictures. The interfacing of the Arduino and MPU-6050
sensor is sensing the acceleration of the objects as objects
accelerates.
 Gyroscope sense the desired orientation, and structure required by
different. The sensors have very interesting features of providing
different sensing functionalities by using one sensor.
Simulation
Conclusion
 Through experimentation, one can learn how to write in the
Arduino compiler. By connecting the Arduino to the compiler via
a laptop and a sensor, one can determine the purposes for which
the sensor is intended. Such sensors are simple to use and can be
incorporated into many household items and applications.
Thank You

You might also like