[1]
[1]
A gyroscope is a device measuring orientation and angular velocity (something's rotation speed). A classic gyroscope is a spinning wheel/disk mounte don moveable rings called gimbals.
It's often measured in degree per second (°/s).
It's often packaged alongside an accelerometer and a magnetometer to create an IMU.
A mechanical gyroscope is the most common type, being comprised of a spinning disk mounted on an axis, a rotor, gimbal, and a frame.
A IMU gyroscope is a smaller electric-mechanical gyroscope with MEMS technology to convert mechanic forces into electric readings,
An
A gyroscope like the LSM6DS3 chip can measure rotation due motion and gravity by being powered by a microncontroller.
[D1] Fig. 1 A LSM6DS3 gyroscope and accelerometer IMU chip manufactured by Adafruit.
[D1] Fig. 3
The axis whose values are intended to be altered depend on the direction the gyroscope is rotated.
For all x, y, z-axis, when the chip is rotated in their axis in CCW, each of their values will read positive values. When the chip is rotated CW their values become negative. (Fig. 3)
The following functions are used to control a MEMS gyroscope:
<IMUVariableName>.readFloatAcccelX(): x-axis measurement of angular speed
<IMUVariableName>.readFloatAcccelY(): y-axis measurement of angular speed
<IMUVariableName>.readFloatAcccelZ(): z-axis measurement of angular speed
[D1] Fig. 2
E.g., the following plots the x, y, z-axis values on the Arduino IDE's serial plotter as graphs:
/*ELE8941 Lab 8 Part 1: Accelerometer test
Steve Liu - July 19, 2026*/
#define MSB_FIRST MSBFIRST//force-fixes library typo if needed
#include "SparkFunLSM6DSO.h"
#include "Wire.h"//if using I2C
LSM6DSO myIMU;//default constructor is I2C, addr 0x6B
void setup() {
Wire.begin();//needed for I2C
delay(250);
Serial.begin(9600);
delay(250);
if(myIMU.begin())//verify connection
Serial.println("Start");
else
{
Serial.println("Couldn't connect to IMU");
while(1);
}
if( myIMU.initialize(BASIC_SETTINGS))//activates standard default gyroscope parameters to read immediately: enables accelerometer at ±2 g measurement range and enables gyroscope at ±2000 dps range
Serial.println("loaded basic settings");
}
void loop()
{
//these functions read raw sensor data and convert to float values representing real-world values: for an accelerometer(readFloatAccelX(), readFloatAccelY(), readFloatAccelZ()) return measured acceleraiton along axis in g-force units as floats
float X_acc = myIMU.readFloatAccelX();
float Y_acc = myIMU.readFloatAccelY();
float Z_acc = myIMU.readFloatAccelZ();
//Serial plotter
Serial.print("max:");
Serial.print(2);//max = 2g
Serial.print(",");
Serial.print("min:");
Serial.print(-2);//min = -2g
Serial.print(",");
//enables ONE axis at a time
Serial.print("X_Accel:");
Serial.println(X_acc, 2);
Serial.print("Y_Accel:");
Serial.println(Y_acc, 2);
Serial.print("Z_Accel:");
Serial.println(Z_acc, 2);
delay(50);
}
[D1] Week 12 Theory Accelerometers IMU Part 1 (Canva)
[D1.1] Week 12 Theory Accelerometers IMU Part 2