SparkFun: ITG-3200,Triple-Axis Gyro

Revision as of 19:21, 26 September 2012 by Ruff (Talk | contribs)

Jump to: navigation, search

thumb‎ Embedded Linux Class Ruffin White RHIT

Breakout board for InvenSense's ITG-3200


The ITG-3200 is a three-axis gyro that can be purchased from SparkFun. The datasheet describes it:

The ITG-3200 is the world’s first single-chip, digital-output, 3-axis MEMS gyro IC optimized for gaming, 3D mice, and 3D remote control applications. The part features enhanced bias and sensitivity temperature stability, reducing the need for user calibration. Low frequency noise is lower than previous generation devices, simplifying application development and making for more-responsive remote controls.

ITG-3200 breakout board pin-out

Inputs and Outputs

The ITG-3200 takes a supply voltage (Vs) of 1.8-3.6 V. The analog outputs are scaled proportionally to the supply voltage; at Vs = 3.6 V, the output will change by 2x for the same acceleration as compared to Vs = 1.8 V. Although the output sensitivity is scaled proportionally to the input voltage, noise is not, so higher supply voltages are advisable to reduce the impact of noise.

At all supply voltages, 0 g acceleration corresponds to an output voltage of Vs/2. At Vs = 3.6 V, the datasheet specs the typical sensitivity at 360 mV / g, with g as standard gravitational acceleration.

Connecting to the Bone

The Beagle Bone can be connected to the gyro via the I2C bus. Ground and Vcc on the breakout board should be connected to pins 1 and 2 respectively on the bone's P9 header, and the SCL and SDA pins should be connected to one of the I2C pairs on the bone. VIO should also be simply tied to Vcc, as this will be the same voltage the bone will use when acting as the master in the I2C buss. Two 4.7k resistors should used be connected between SCL and then Vcc and between SDA and Vcc. There are available resistor pads on the breakout board I you prefer to have surface mounts on the board instead of bread boarding them. I used I2C3 (P9, pins 19 and 20). The address of the magnetometer can be found by using the i2cdetect command from the shell. I get:

beagle$ i2cdetect -y -r 3
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

The address should be 0x69 (or 105 in decimal). This address can be changed by soldering an arrangement of resistors on the reserved pads on the breakout board.

Communicating with the HMC5883L Using the Shell

the HMC5883L has 13 8-bit registers:

Address Name Access
00 Configuration Register A Read/Write
01 Configuration Register B Read/Write
02 Mode Register Read/Write
03 Data Output X MSB Register Read
04 Data Output X LSB Register Read
05 Data Output Z MSB Register Read
06 Data Output Z LSB Register Read
07 Data Output Y MSB Register Read
08 Data Output Y LSB Register Read
09 Status Register Read
10 Identification register A Read
11 Identification register B Read
12 Identification register C Read

The sensor values for each axis are 16-bit and are stored across 2 registers each.

beagle$ i2cget -y 3 0x1e 3

beagle$ i2cget -y 3 0x1e 4

will get the two halves of the 16-bit signed measurement along the +x axis.

By default the magnetometer takes a single sample and enters idle mode.The lowest two bits of the mode register control the measurement mode. Setting these to 0x01 will cause the device to take one measurement and then enter idle mode again. Setting to 0x00 should cause the device to enter continuous measurement mode,

beagle$ i2cset -y 3 0x1e 2 1 will cause a single measurement to be taken.

The new values for each axis can be read from registers 03-08 as shown above. By default the measurements correspond to 1090 LSB/Gauss, but this can be changed by modifying the gain in Configuration Register B.

Note: reading a value of 0xF000 (-4096) in a data output register indicates an overflow or underflow error in the ADC or a math error.

Communicating with the HMC5883L Using the Shell

the HMC5883L has 14 8-bit registers:

Address Name Access
00 WHO_AM_I Read/Write
15 SMPLRT_DIV Read/Write
16 DLPF_FS Read/Write
17 INT_CFG Read/Write
3E PWR_MGM Read/Write

The sensor values for each axis are 16-bit and are stored across 2 registers each. GYRO_#OUT_H and GYRO_#OUT_L where # is just letter for the axis. Will have to get the two halves of the 16-bit signed measurement to read the entire value..


Digital-output X-, Y-, and Z-Axis angular rate sensors (gyros) on one integrated circuit Digitally-programmable low-pass filter Low 6.5mA operating current consumption for long battery life Wide VDD supply voltage range of 2.1V to 3.6V Standby current: 5μA Digital-output temperature sensor Fast Mode I2C (400kHz) serial interface Optional external clock inputs of 32.768kHz or 19.2MHz to synchronize with system clock Pins broken out to a breadboard friendly 7-pin 0.1" pitch header


0.70 x 0.55" (17.78 x 13.97mm)



Eagle Files

Quickstart Guide

ITG-3200 Datasheet

Code (ATmega328)



thumb‎ Embedded Linux Class Ruffin White RHIT