Adafruit Triple Axis Gyro Breakout Created by Bill Earl Last updated on 2018-10-25 06:21:39 PM UTC
Guide Contents Guide Contents Overview 2 3 How it Works: What can it do? Ladyada's Triple Gyro Special! (http://adafru.
Overview The Adafruit Triple Axis Gyro Breakout is based on the STMicro L3GD20 MEMS digital output gyroscope chip (https://adafru.it/aV1). We include a 3.3v regulator on board for compatibility with 5v controllers like the Arduino. And there are 4 holes so that it can be rigidly mounted. How it Works: The triple-axis gyro sensor is a MEMS (Micro Electrical Mechanical System) device consisting of 3 micro-machined 'tuning fork' structures on a silicon wafer.
Ladyada's Triple Gyro Special! (http://adafru.it/1032) 3 micro-machined gyros with I2C, SPI and a 3v regulator on a bite-sized breakout board. (Tomato, onion and tzatziki sauce extra.) © Adafruit Industries https://learn.adafruit.
Assembly and Wiring Assembly: The board comes with all surface-mount components pre-soldered. The included header strip can be soldered on for convenient use on a breadboard or with 0.1" connectors. However, for applications subject to extreme accelerations, shock or vibration, locking connectors or direct soldering is advised. Prepare the header strip: Cut the strip[ to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down.
Add the breakout board: Place the breakout board over the pins. (You can prop up the free edge of the board with some extra pins to better align it for soldering.) And Solder! Be sure to solder all pins for reliable electrical contact. (For tips on soldering, be sure to check out our Guide to Excellent Soldering (https://adafru.it/aTk)).
'Classic' Arduino Wiring: On pre-R3 Arduinos, the I2C pins are: SDA = Analog 4 SCL = Analog 5 For the Mega SDA = Digital 20 SCL = Digital 21 R3 and Later Arduino Wiring: Although the 'classic' wiring will still work, All R3 and later Arduinos (including Mega, Due and Leonardo) have SDA and SCL pins on the extended header next to AREF for compatibility. Wiring for SPI: The SPI interface requires 4 wires (in addition to VCC and Ground).
Arduino The Adafruit L3GD20 Library for the Arduino implements a convenient device class to handle the the low-level device communication with the Gyro module. The programming interface is described below: Install Arduino Libraries Before you can use the L3GD20, you'l need to install the required libraries using the Arduino Library Manager, which you can open via the menu entry shown below: You will need to install the Adafruit Unified Sensor library ... ...
SPI Example: (use with SPI wiring (https://adafru.
void loop() { gyro.read(); Serial.print("X: "); Serial.print((int)gyro.data.x); Serial.print(" "); Serial.print("Y: "); Serial.print((int)gyro.data.y); Serial.print(" "); Serial.print("Z: "); Serial.println((int)gyro.data.z); Serial.print(" "); delay(100); } Alternate Units: The values reported by the read() function are in degrees-per-second (dps) For some calculations, it may be more convenient to work in radians. To convert dps to radians-per-second (rad/s), simply multiply by 0.
Python & CircuitPython It's easy to use the L3GD20 sensor with Python or CircuitPython and the Adafruit CircuitPython L3GD20 (https://adafru.it/CSq) module. This module allows you to easily write Python code that reads the angular momentum from the sensor. You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-for-Python compatibility library (https://adafru.it/BSN).
Pi 3V3 to sensor Vin Pi GND to sensor GND Pi SCL to sensor SCL Pi SDA to sensor SDA And an example on the Raspberry Pi 3 Model B wired with SPI: Pi 3V3 to sensor Vin Pi GND to sensor GND Pi MOSI to sensor SDA Pi MISO to sensor SA0 Pi SCLK to sensor SCL Pi #5 to sensor CS (or use any other free GPIO pin) CircuitPython Installation of L3GD20 Library You'll need to install the Adafruit CircuitPython L3GD20 (https://adafru.it/CSq) library on your CircuitPython board.
You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready (https://adafru.
import import import import time board busio adafruit_l3gd20 # Hardware I2C setup: I2C = busio.I2C(board.SCL, board.SDA) SENSOR = adafruit_l3gd20.L3GD20_I2C(I2C) # # # # # Hardware SPI setup: import digitalio CS = digitalio.DigitalInOut(board.D5) SPIB = busio.SPI(board.SCK, board.MOSI, board.MISO) SENSOR = adafruit_l3gd20.L3GD20_SPI(SPIB, CS) while True: print('Angular Momentum (rad/s): {}'.format(SENSOR.gyro)) print() time.sleep(1) © Adafruit Industries https://learn.adafruit.
Python Docs Python Docs (https://adafru.it/CaE) © Adafruit Industries https://learn.adafruit.
Downloads Files L3GD20 Data Sheet (https://adafru.it/aV1) Technical Article: Everything about STMicroelectronics’ 3-axis digital MEMS (https://adafru.it/aV4)gyroscopes (https://adafru.it/aV4) Adafruit L3GD20 Library driver for Arduino (https://adafru.it/cZ4) EagleCAD PCB files on GitHub (https://adafru.it/rga) Fritzing object in Fritzing library (https://adafru.it/aP3) Schematic & Fabrication Print © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.
F.A.Q.