IMU-6050 6-Axis Sensor Interphase with Arduino

HELLO WORLD,


This is the project of IMU-6050 interphase with Arduino UNO for measuring 6-axis (acceleration, gyro) i.e, 6 degrees of freedom with Temperature sensor.

OVERVIEW,

IMU-6050,  is an 6-axis sensor having 3-axis accelerometer and 3-axis gyroscope with tempertaure sensor embedded.

It looks so,

















It is an 8-pin sensor with accelerometer, gyro and temperature sensor.

CIRCUIT / WORKING,

Connect the circuit as shown below.........,
The pinout is shown below.















CODE,

Execute the following code on Arduino IDE.


#include "Wire.h"
const int MPU_ADDR = 0x68;
int16_t accelerometer_x, accelerometer_y, accelerometer_z;
int16_t gyro_x, gyro_y, gyro_z;
int16_t temperature;
char tmp_str[7];
char* convert_int16_to_str(int16_t i)
{
sprintf(tmp_str, "%6d", i);
return tmp_str;
}
void setup() {
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);
}
void loop() {
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU_ADDR, 7*2, true);
accelerometer_x = Wire.read()<<8 | Wire.read();
accelerometer_y = Wire.read()<<8 | Wire.read();
accelerometer_z = Wire.read()<<8 | Wire.read();
temperature = Wire.read()<<8 | Wire.read();
gyro_x = Wire.read()<<8 | Wire.read();
gyro_y = Wire.read()<<8 | Wire.read();
gyro_z = Wire.read()<<8 | Wire.read();
Serial.print("aX = "); Serial.print(convert_int16_to_str(accelerometer_x/16384.0));
Serial.print(" | aY = "); Serial.print(convert_int16_to_str(accelerometer_y/16384.0));
Serial.print(" | aZ = "); Serial.print(convert_int16_to_str(accelerometer_z/16384.0));
Serial.print(" | tmp = "); Serial.print(temperature/340.00+36.53);
Serial.print(" | gX = "); Serial.print(convert_int16_to_str(gyro_x/131.0));
Serial.print(" | gY = "); Serial.print(convert_int16_to_str(gyro_y/131.0));
Serial.print(" | gZ = "); Serial.print(convert_int16_to_str(gyro_z/131.0));
Serial.println();
delay(1000);
}

OUTPUT

The output can be easily dragged at serial monitor if arduino IDE.

That data can be exported to LCD or some real world funcions or even VPyhon 3-axis representaion of sate of body .

The data looks something like this.












GALLERY ;;;;;


HAPPY TIME!!!

Any queries,  drop here on comments.................

Comments

Popular posts from this blog

Infineon IFX007T BLDC Shield + XMC4700 Relax Kit + Nanotec BLDC Motor RoadTest

MicroPython #2: Triggering I/O's