MPU-6050 3 Axis gyroscope + acce​lerometer module COM33, R26

Fr5,600

In stock

SKU: SEN5369 Category:

Description

IMU sensors(such as MPU-6050) help us get the position of an object attached to the sensor in three-dimensional space. These values are usually in angles to help us to determine its position. They are used to detect the orientation of smartphones, or in wearable gadgets like the Fitbit, which uses IMU sensors to track movement.

Features

  • Chip: MPU-6050
  • Power supply: 3v-5V power
  • Gyroscope range: + 250 500 1000 2000 ° / s
  • Acceleration range: ± 2 ± 4 ± 8 ± 16 g
  • Communication: standard I2C communication agreement
  • Chip built-in 16 bit AD converter, 16 bits of data output
  • Pin spacing 2.54 mm

Getting started with MPU-6050 and Arduino UNO

The MPU 6050 is a 6 DOF (degrees of freedom) or a six-axis IMU sensor, which means that it gives six values as output: three values from the accelerometer and three from the gyroscope. The MPU 6050 is a sensor based on MEMS (micro electro mechanical systems) technology. Both the accelerometer and the gyroscope are embedded inside a single chip. This chip uses I2C (inter-integrated circuit) protocol for communication. The next 2 steps we will see the working principle of the accelerometer and gyroscope so that we understand the working principle of the MPU-6050

Step1: How does an accelerometer works?

An accelerometer works on the principle of the piezoelectric effect. Imagine a cuboidal box with a small ball inside it, like in the picture above. The walls of this box are made with piezoelectric crystals. Whenever you tilt the box, the ball is forced to move in the direction of the inclination due to gravity. The wall that the ball collides with creates tiny piezoelectric currents. There are three pairs of opposite walls in a cuboid. Each pair corresponds to an axis in 3D space: X, Y, and Z axes. Depending on the current produced from the piezoelectric walls, we can determine the direction of inclination and its magnitude.

Step2: How does a gyroscope works?

Gyroscopes work on the principle of Coriolis acceleration. Imagine that there is a fork-like structure that is in a constant back-and-forth motion. It is held in place using piezoelectric crystals. Whenever you try to tilt this arrangement, the crystals experience a force in the direction of inclination. This is caused as a result of the inertia of the moving fork. The crystals thus produce a current in consensus with the piezoelectric effect, and this current is amplified. The values are then refined by the host microcontroller. Now we can start interfacing the MPU-6050 with the Arduino UNO

Step3: Hardware required

Step4: Connecting the Hardware

The MPU 6050 communicates with the Arduino through the I2C protocol. The MPU 6050 is connected to Arduino as shown in the following diagram. If your MPU 6050 module has a 5V pin, then you can connect it to your Arduino’s 5V pin. If not, you will have to connect it to the 3.3V pin. Next, the GND of the Arduino is connected to the GND of the MPU 6050.

The program we will be running here also takes advantage of the Arduino’s interrupt pin. Connect your Arduino’s digital pin 2 (interrupt pin 0) to the pin labeled as INT on the MPU 6050.
Next, we need to set up the I2C lines. To do this, connect the pin labeled SDA on the MPU 6050 to the Arduino’s analog pin 4 (SDA), and the pin labeled as SCL on the MPU 6050 to the Arduino’s analog pin 5 (SCL). That’s it! You have finished wiring up the Arduino MPU 6050.

Step5: Making the sketch and Testing

To test the Arduino MPU 6050, first download the Arduino library for MPU 6050, you can find it here. Next, you have to unzip/extract this library, take the folder named “MPU6050”, and paste it inside the Arduino’s “library” folder. To do this, go to the location where you have installed Arduino (Arduino –> libraries) and paste it inside the libraries folder. You might also have to do the same thing to install the I2Cdev library if you don’t already have it for your Arduino. Do the same procedure as above to install it. You can find the file here.

If you have done this correctly, when you open the Arduino IDE, you can see “MPU6050” in File –> Examples. Next, open the example program from File –> Examples –> MPU6050 –> Examples –> MPU6050_DMP6.

Next, you have to upload this code to your Arduino. After uploading the code, open up the serial monitor and set the baud rate as 115200. Next, check if you see something like “Initializing I2C devices …” on the serial monitor. If you don’t, just press the reset button. Now, you’ll see a line saying, “Send any character to begin DMP programming and demo.” Just type in any character on the serial monitor and send it, and you should start seeing the yaw, pitch, and roll values coming in from the MPU 6050.

Step6: Documents

MPU-6050 Library download it here

I2Cdev library download it here