Gyro (Position) sensors (MPU6050) with Arduino – How to access Pitch, Roll and Yaw angles

The video below goes through the details, underneath the video you will find the sample code, a circuit diagram and an affiliate parts list.

The MPU6050 is a versatile unit that can measure its orientation and it’s acceleration in all three dimensions. However did have difficulty in finding a user friendly working library. The one I eventually settled on (after trying around 4 others) was the MPU_6050_light library. This is available from within the Arduino IDE – shown in the video.

Affiliate Parts List
Note: You do not need the OLED display for basic checking, the results can be sent through the serial monitor of you wish. I use it as it makes things easier to see rather than a scrolling list of numbers on the serial monitor. The Arduino can be any, doesn’t need to be a Nano. I’ve listed three options.

MPU6050 : https://amzn.to/31UhdBU
Arduino Nano : https://amzn.to/37Q6E6s
Arduino Uno (Official) : https://amzn.to/31Ur36B
Arduino Uno (clone) : https://amzn.to/35JjW23
OLED (SSD1306) : https://amzn.to/2TyZfjB
Bread Board : https://amzn.to/35Kd0lc
Wires : https://amzn.to/3jMePmV

The Circuit Diagram
Note, as mentioned you do not need the OLED if you do not need it.


Demo Code Shown

To use this demo code with the screen you will need two additional libraries, these are both available through the “manage libraries” feature of the Arduino IDE and they are both from Adafruit. You will need “Adafruit SSD1306” and “Adafruit gfx” library. If you do use the OLED