ITG3200 Gyro breakout from SparkFun

Getting this gyro up and running was easy – using it to receive practical information was not! Here’s how I did it.

I purchased a SparkFun sensor pack that included the ITG3200 3-axis gyroscope breakout. Following the hookup guide was very easy, as was interfacing via I2C.

Unfortunately, the numbers you get out of that tutorial mean nothing really! You need to convert their readings in to a useful setting. This conversion rate depends upon the mode of the sensor, and even the voltage it is providing logic at! These details can be found in the ITG3200 datasheet, but are non obvious to decipher.

Here’s the issues you have:-

  • Some electronics foo is required
    • It’s a 3.3V sensor – not a problem for my 3.3V Arduino Pro Mini 8MHz, but would be for other 5V Arduinos
    • Interface via I2C (Actually pretty damned easy)
    • Requires soldering on the board itself (to use the internal oscillator for timing)
    • Connect VIO to VCC (so VIO is 3.3V just like VCC)
  • You have to ‘calibrate’ the sensor
    • Set it’s reading modes and accuracy
      • Set sampling rate to 100Hz (100 times per second)
      • Set FP_SEL to 3 for normal operation (so you don’t get junk data)
    • Then keep it still for a few seconds and read the average readings. Then correct future readings by subtracting the calibration readings
  • You then need to convert the numbers it gives you to degrees rotation per second
    • In my set up you time the time between each individual sensor readings (100 HZ = 0.01 seconds), and MULTIPLY this by the LSB factor. (14.375 for the modes above – see page 7 of the datasheet for the ITG3200)
    • Don’t multiply this against a single reading, but again average it out over a period of time. At least 0.1 seconds for accuracy (10 readings at 100 Hz)
    • This gives you degrees rotation per second

In short, it’s a pig to use! The math is pretty simple though.

I’ll post code soon too – this is part of my AJ Airbot project – I’m building an Inertial Navigation System (INS) using COTS (Common Off The Shelf) electronics products. I won’t share that code though – could be used for nefarious uses. Happy to share the raw ‘how to use the sensor’ code though.

FYI Most of the above I figured out from reading the ARM mbed example on the ITG 3200. This is an excellent set of code.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s