## Introduction

When things rotate around an axis, they have what's called angular velocity, which is a measurement of how fast it is spinning around that axis. A gyroscope can be used to measure angular velocity.Â

In this guide, learn to use the ShakeUp's built-in gyroscope with the Arduino IDE and plot its measurements in the Serial Plotter.

Complete this guide to get started with using the gyroscope.

1. ## Step 1 Overview

• They're useful when you want to know the orientation of an object in motion. That is to say, where it is pointing.

• Usually, the measurements are in units of rotations per minute (RPM) or degrees per secondÂ  (Â°/s).Â  Â  Â  Â  Â  Â  Â Â

• In this guide, we'll show you how to get started with using the ShakeUp's built-in 3-axis gyroscope.

• When things rotate around an axis, they have what's called angular velocity, which is a measurement of how fast it is spinning around that axis.

• For example, a spinning wheel can be measured in revolutions per second (RPS), or in degrees per second (Â°/s).

• So how can we measure this? By using a gyroscope!

• There are three axises that the ShakeUp's built-in gyroscope can measure:Â
x-axis, y-axis, and z-axis.

3. ## Step 3 Gyroscope example sketch

• Next, in the Arduino IDE, open up the example sketch for the Accelerometer:
File > Examples > ShaKey > Demo > ICM20689 Motion Sensor > Gyro

4. ## Step 4 Gyroscope values on x-axis

``````#include <LittleBird_ICM20689.h>

LittleBird_ICM20689 motion;

void setup() {
Serial.begin(115200);
motion.begin();
motion.init();
motion.calibrate();
}

void loop() {
Serial.print(motion.getGyroX());
delay(10);
}``````
• Let's remove some code to focus on the rate of change in angular velocity along the X axis. Upload this code to your ShakeUp!

5. ## Step 5 Serial Plotter

• Open up the Serial Plotter by going to Tools > Serial Plotter

• Make sure the baud rate is set to 115200. This can be found at the bottom right hand corner of the Serial Plotter window.

• Move the ShakeUp along its x-axis and watch the graph.

6. ## Step 6 Gyroscope values on 3-axises

``````#include <LittleBird_ICM20689.h>

LittleBird_ICM20689 motion;

void setup() {
Serial.begin(115200);
motion.begin();
motion.init();
motion.calibrate();
}

void loop() {
Serial.print(motion.getGyroX());
Serial.print(" ");
Serial.print(motion.getGyroY());
Serial.print(" ");
Serial.println(motion.getGyroZ());

delay(10);
}
``````
• Next, let's get measurements from all three axises. In order to plot multiple variables simultaneously, a 'space' is printed between the print statements. Upload this code to the ShakeUp.

7. ## Step 7 Serial Plotter - 3-axis Gyroscope

• Go to Tools > Serial Plotter again. This time you should see three lines corresponding to the angular velocity measurement along the:

X-axis = Blue

Y-axis = Red

Z-axis = Green

• You might notice that the gyroscope measurements may include negative values. It will output positive or negative value measurements depending on whether the applied angular velocity along the sensing axis is counterclockwise or clockwise.

8. ## Step 8 Conclusion

• So when do you use a gyroscope? You've probably used a gyroscope when using your mobile phone, tablet, a drone, a motion-based game controller or a wearable sensor for health and fitness. They're also commonly used in high tech stuff such as motion-capture, gesture detection, space navigation, missile control, and flight guidance.

• Now that you have a basic understanding of how a gyroscope works, if you haven't already, check out our guide on how to use the built-in accelerometer on the ShakeUp. You could also get started with motion control over in Processing where you'll learn to rotate a 3D cube with the accelerometer.