How to Interface MPU6050 with the Arduino - Robu.…
How to Interface MPU6050 with the Arduino - Robu.…
Robu.in
MACFOS INSTALL NOW
Free - On the App Store
| | " | # | $
Introduction
Have you ever wonder how your mobile screen adjusts
automatically in a frame when you move your smartphone
vertically or horizontally? We can achieve this task with the
help of IMU(Inertial Measurement Unit) MPU6050. In this
tutorial, we will talk about MPU6050 and its interfacing
with Arduino. MPU6050 has been developed by
InvenSense company. It is designed for obtaining values of
accelerometer and gyroscope.
What is MPU6050?
3- axis gyroscope
3- axis accelerometer
16-bit ADC conversion for each channel
1024 bit FIFO buffer
Digital output temperature sensor
Integrated Digital Motion Processor
Inbuilt temperature sensor
Pinout
Arduino MPU6050
5v/3v VCC
GND GND
pin 2 INT
Programming
You can download both the libraries from the following link:
MPU6050
Wire.h library
#include <Wire.h>
const int MPU = 0x68; // MPU6050 I2C address
float AccX, AccY, AccZ;
float GyroX, GyroY, GyroZ;
float accAngleX, accAngleY, gyroAngleX,
gyroAngleY, gyroAngleZ;
float roll, pitch, yaw;
float AccErrorX, AccErrorY, GyroErrorX,
GyroErrorY, GyroErrorZ;
float elapsedTime, currentTime, previousTime;
int c = 0;
void setup() {
Serial.begin(19200);
Wire.begin(); // Initialize
comunication
Wire.beginTransmission(MPU); // Start
communication with MPU6050 // MPU=0x68
Wire.write(0x6B); // Talk to
the register 6B
Output
GetAllData
GetAngle
#include <MPU6050_tockn.h>
#include <Wire.h>
MPU6050 mpu6050(Wire);
long timer = 0;
void setup() {
Serial.begin(9600);
Wire.begin();
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
}
void loop() {
mpu6050.update();
Applications
3D remoter controller
In 3D mice controller
In wearable health-tracking, fitness-tracking devices
In drones and quadcopters, MPU6050 is used for
position control.
Used in controlling Robotic Arm
Hand gesture control devices
In Self-balancing robot
In Humanoid robot for tilt, rotation, and balancing
In smartphones for adjusting the frame
Used in gimbals system for stabilization on drones
Final Words
& % ' (
About Robu
Related Posts
Leave a comment
Comment *
Name *
Email *
Website
Post Comment
Email id
Subscribe me
Information !
My Account !
Why Choose us !
Policies !
! % " # $