Home > Projects > Bluetooth Projects > DIY Arduino Inclinometer using MPU6050

DIY Arduino Inclinometer using MPU6050

Summary of DIY Arduino Inclinometer using MPU6050


The article describes building a digital inclinometer using an MPU6050 (3-axis accelerometer + gyroscope), an Arduino Pro Mini, and a Bluetooth module to remotely monitor tilt on an Android phone. It explains wiring (I2C for MPU6050 to A4/A5, serial for HC-05/06 to D11/D10), powering options (FTDI, 9V battery, or 12V to RAW), and using Korneliusz Jarzebski’s MPU6050 library with the Arduino example sketch to obtain pitch/roll/yaw readings.

Parts used in the Digital Inclinometer:

  • Arduino Pro Mini (5V)
  • MPU6050 gyro/accelerometer sensor
  • HC-05 or HC-06 Bluetooth module
  • FTDI programming board
  • Breadboard
  • Connecting wires
  • Smartphone (Android)
  • Optional 9V battery or 12V adapter

The MPU6050 is an IC 3-axis accelerometer and a 3-axis gyroscope combined into one unit. It also houses a temperature sensor and a DCM to perform a complex task. The MPU6050 is commonly used in building Drone and other remote robots like a self-balancing robot. In this project we will learn how to use the MPU6050 is built an Inclinometer or Spirit Leveller. As we know an inclinometer is used to check if a surface is perfectly leveled or not, they are available either as sprit bubble ones or as digital meters. In this project, we are going to build a Digital Inclinometer which can be monitored using an Android application. The reason for using a remote display like a mobile phone is that we can monitor the values from MPU6050 without having to look at the hardware, this would come very handy when the MPU6050 is placed on a drone or some other inaccessible locations.

DIY Arduino Inclinometer using MPU6050

Materials Required:

  1. Arduino Pro-mini (5V)
  2. MPU6050 Gyro Sensor
  3. HC-05 or HC-06 Bluetooth module
  4. FTDI board
  5. Breadboard
  6. Connecting wires
  7. Smart Phone

Circuit Diagram:

The complete circuit diagram for this Arduino Tilt Sensor Project is shown below. It just has only three components and can be easily built over the breadboard.

The MPU6050 communicates with the help of I2C and hence the SDA pin is connected to the A4 pin of Arduino which is the SDA pin and the SCL pin is connected to the A5 pin of Arduino. The HC-06 Bluetooth Module works with the help of Serial communication hence the Rx pin of Bluetooth is connected to pin D11 and the Tx pin of Bluetooth is connected to pin D10 of the Arduino. These pin D10 and D11 will be configured as Serial pin by programming the Arduino. The HC-05 module and the MSP6050 module operates on +5V and hence they are powered by the Vcc pin of the Arduino as shown above.

I used some breadboard connecting wires and built the set-up over a small breadboard. Once the connections are done my board looks like this below.

Powering your setup:

You can either power your circuit through the FTDI programming board as I have did, or use a 9V battery or 12V adapter and connect it to the Raw pin of the Arduino pro mini. The Arduino Pro-mini has an in-built voltage regulator which would convert this external voltage regulated +5V.

Programming your Arduino:

Once the hardware is ready, we can start programming our Arduino. As always the complete code for this project can be found at the bottom of this page. But to understand the project better I have broken the code to small chinks and explained them as steps below.

DIY Arduino Inclinometer using MPU6050 schematics

The first step would be interfacing the MPU6050 with Arduino. For this project we are going to use the library developed by Korneliusz which can be downloaded from link below

MPU6050 Liberty – Korneliusz Jarzebski

Download the ZIP file and add it to your Arduino IDE. Then head on to File->Examples->Arduino_MPU6050_Master -> MPU6050_gyro_pitch_roll_yaw. This will open the example program that uses the library that we just downloaded. So click on upload and wait for the program to be uploaded to your Arduino Pro mini. Once that is done open your serial monitor and set your baud rate to 115200 and check if you are getting the following.

Read more: DIY Arduino Inclinometer using MPU6050

Quick Solutions to Questions related to Digital Inclinometer:

  • What is the MPU6050 used for in this project?
    The MPU6050 provides 3-axis accelerometer and 3-axis gyroscope data used to compute pitch, roll, and yaw for the inclinometer.
  • How is the MPU6050 connected to the Arduino Pro Mini?
    The MPU6050 uses I2C: connect SDA to A4 and SCL to A5 on the Arduino Pro Mini.
  • How does the Bluetooth module connect to the Arduino?
    The HC-05 or HC-06 uses serial communication: connect its Rx to D11 and Tx to D10, which are configured as serial pins in the sketch.
  • Can the setup be powered without the FTDI board?
    Yes; you can power via a 9V battery or a 12V adapter connected to the RAW pin of the Arduino Pro Mini.
  • Which library is recommended to interface the MPU6050?
    The MPU6050 Liberty library by Korneliusz Jarzebski is recommended and used in the example.
  • Where do I find the example sketch to get pitch, roll, and yaw?
    After adding the library to the Arduino IDE, open File->Examples->Arduino_MPU6050_Master->MPU6050_gyro_pitch_roll_yaw.
  • What baud rate should the serial monitor use to view data?
    Set the serial monitor baud rate to 115200 to view the MPU6050 output as shown in the example.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top