The DFRobot Gyroscope Sensor Module (Part ID: GYRO) is a versatile and reliable component designed to measure and maintain orientation and angular velocity. This sensor is widely used in various applications, including robotics, drones, gaming devices, and motion tracking systems. Its ability to provide precise rotational data makes it an essential component for projects requiring accurate motion sensing and control.
Parameter | Value |
---|---|
Operating Voltage | 3.3V to 5V |
Current Consumption | 3.6mA (typical) |
Measurement Range | ±250, ±500, ±1000, ±2000 °/s |
Communication Interface | I2C/SPI |
Operating Temperature | -40°C to +85°C |
Dimensions | 20mm x 20mm x 1.6mm |
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground |
3 | SCL | I2C Clock Line |
4 | SDA | I2C Data Line |
5 | CS | Chip Select (used for SPI communication) |
6 | INT | Interrupt Pin (optional, for motion detection) |
#include <Wire.h>
// I2C address of the gyroscope sensor
#define GYRO_ADDRESS 0x68
void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(9600); // Initialize serial communication
// Wake up the gyroscope sensor
Wire.beginTransmission(GYRO_ADDRESS);
Wire.write(0x6B); // Power management register
Wire.write(0); // Set to zero to wake up the sensor
Wire.endTransmission(true);
}
void loop() {
int16_t gyroX, gyroY, gyroZ;
// Request 6 bytes of data from the gyroscope sensor
Wire.beginTransmission(GYRO_ADDRESS);
Wire.write(0x43); // Starting register for gyroscope data
Wire.endTransmission(false);
Wire.requestFrom(GYRO_ADDRESS, 6, true);
// Read the gyroscope data
gyroX = Wire.read() << 8 | Wire.read();
gyroY = Wire.read() << 8 | Wire.read();
gyroZ = Wire.read() << 8 | Wire.read();
// Print the gyroscope data to the serial monitor
Serial.print("Gyro X: "); Serial.print(gyroX);
Serial.print(" Gyro Y: "); Serial.print(gyroY);
Serial.print(" Gyro Z: "); Serial.println(gyroZ);
delay(500); // Wait for 500 milliseconds before the next reading
}
By following this documentation, users can effectively integrate the DFRobot Gyroscope Sensor Module into their projects, ensuring accurate and reliable motion sensing capabilities.