Lesson 04

Learn how to detect the position and acceleration in space using an the MPU-6050 module

LiveStream video

What you’ll learn

In this lesson you will learn how to measure the pitch and roll of the SMARS robot using the MPU-6050 sensor module.

Things’s you’ll needs

Before you begin, you’ll need to make sure you have a couple of things before you start this lesson:


  1. Connect the SMARS to the USB cable, and the USB Cable to your computer
  2. Launch the Arduino IDE on your computer
  3. Create a new Sketch, by clicking the New Sketch button

Lets code!

You can download the code below from GitHub, but its better to type it in yourself line by line, as you will get to understand what each line means.

The Pitch and Roll program

This page was first created on 15 July 2020, and was last updated on 15 July 2020