The Adafruit L3GD20H Triple-Axis Gyro Breakout Board is a compact and versatile sensor designed to measure angular velocity along three perpendicular axes: pitch, roll, and yaw. This makes it an ideal component for applications in robotics, motion sensing, and stabilization systems. The board features the L3GD20H gyroscope chip, which provides high-resolution measurements and is capable of detecting rates with a high degree of accuracy.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Supply voltage (2.4V to 3.6V) |
2 | GND | Ground connection |
3 | SCL | I2C clock line |
4 | SDA | I2C data line |
5 | SA0 | I2C address selection pin |
6 | CS | Chip select for SPI (active low) |
7 | SDO | SPI data output (MISO) |
8 | SDA/SPI | SPI data input (MOSI) |
9 | SCL/SPC | SPI clock |
Powering the Board:
I2C Communication:
SPI Communication (Optional):
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_L3GD20_U.h>
Adafruit_L3GD20_Unified gyro = Adafruit_L3GD20_Unified(20);
void setup(void) {
Serial.begin(9600);
Serial.println("Gyroscope Test"); Serial.println("");
/* Initialize the sensor */
if(!gyro.begin())
{
/* There was a problem detecting the L3GD20 ... check your connections */
Serial.println("Ooops, no L3GD20 detected ... Check your wiring!");
while(1);
}
}
void loop(void) {
/* Get a new sensor event */
sensors_event_t event;
gyro.getEvent(&event);
/* Display the results (angular velocity is measured in degrees per second) */
Serial.print("X: "); Serial.print(event.gyro.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(event.gyro.y); Serial.print(" ");
Serial.print("Z: "); Serial.print(event.gyro.z); Serial.print(" ");
Serial.println("deg/s");
/* Delay a bit to keep serial output from being too crazy */
delay(500);
}
This example initializes the L3GD20H sensor and continuously reads the angular velocity in degrees per second from the X, Y, and Z axes, outputting the results to the serial monitor.
Q: Can the L3GD20H be used with a 5V microcontroller? A: Yes, but ensure that the VIN pin is connected to a 3.3V supply, and use logic level converters for I2C/SPI lines if necessary.
Q: How can I change the sensitivity of the sensor? A: The sensitivity can be adjusted through software using the provided library functions.
Q: What is the default I2C address of the L3GD20H? A: The default I2C address is 0x6B when SA0 is high and 0x6A when SA0 is low.
Q: How do I calibrate the gyroscope? A: Calibration involves taking multiple readings at a known stationary state and averaging them to determine an offset. This offset is then subtracted from subsequent readings.