![]() Open the Serial Monitor window so that you can see the program’s output. Open the Arduino IDE and select File > Examples > MPU6050 > IMU_Zero from the main menu to open the example sketch. This essentially “resets” the sensor readings to the current orientation of the module. Once the libraries are installed, let’s utilize the IMU_Zero example sketch from the MPU6050 library to calibrate the module with new offsets for the onboard accelerometer and gyroscope data registers. Go into the library’s Arduino directory and copy the I2Cdev and MPU6050 directories to your Arduino contributed libraries location. Clone or download the top level library from the URL. This is typically located in the libraries directory of your default sketchbook location. ![]() Let’s manually install the I2Cdev and MPU6050 libraries into your Arduino contributed libraries location so that they can be found by the Arduino IDE. The library also contains sub-libraries devoted to various I 2C enabled devices. The top level I2Cdev library focuses specifically on I 2C serial bus communication. I researched various libraries that can be used with MPU6050 sensor modules and settled on the I2Cdevlib library by Jeff Rowberg because of its popularity. You can now connect your Arduino to your computer with the USB cable. This avoids accidental damage during wiring.Īttach the sensor module via the pin header to the breadboard.Ĭonnect the VCC and GND pins of the sensor module to the 5V and GND power pins respectively on the Arduino board with the jumper wires.įor the I 2C serial bus connection, use the jumper wires to connect the SDA and SCL pins of the sensor module to the SDA ( A4) and SCL ( A5) pins respectively on the Arduino. I soldered the straight pin header to the bottom of the module so that when the module is plugged into a breadboard, the positive z-axis points to the ceiling.īefore connecting the sensor module to your Arduino board, disconnect the Arduino from power and your computer. The vendor did, however, include both straight pin and right-angle pin headers in the shipping package. My MPU6050 sensor module did not have a pin header already attached to the module. If you are using different Arduino or MPU6050 sensor models, the vast majority of this tutorial should still apply, however, some minor changes may be necessary. My development board is the Arduino Uno R3 and my sensor module is the SunFounder MPU6050 Module for Arduino and Raspberry Pi, 3-axis Gyroscope and 3-axis Accelerator that communicates over an I 2C serial bus interface. The module provides more advanced configuration and functionality than what is covered in this tutorial, but for those interested in learning more about its capabilities, please check out the datasheet and register map documents for the MPU-6050 device for detailed information. and provides acceleration, rotation, and temperature sensor readings over an I 2C or SPI serial bus interface. ![]() MPU-6050 Motion Sensor Module With I 2C Interface (available on Amazon and SunFounder)Īn MPU6050 sensor module contains the MPU-6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTracking Device by InvenSense Inc. ![]() 4 x Male-Male Jumper Wires (available on Adafruit and Arrow).Solderless Breadboard (available on Adafruit and SparkFun).Arduino Uno (available on Arduino and SparkFun) With Compatible USB Cable.Linux, macOS, Or Windows Based Computer With A USB Port.Detailed versions of all source code used in this tutorial are available on GitHub for your reference. If you are new to the Arduino platform or would just like to refresh your knowledge, please see our Blink: Making An LED Blink On An Arduino Uno tutorial before proceeding with this one. A basic understanding of electronics and programming is expected along with some familiarity with the Arduino platform. This tutorial teaches how to connect an MPU-6050 based accelerometer and gyroscope sensor module to an Arduino Uno using the I 2C bus interface along with retrieving and displaying sensor readings from the module.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |