Wednesday, October 27, 2010

ITG-3200 Gyroscope Library for Arduino

Here's the first revision of a library I made for the ITG-3200 3-Axis Gyroscope made by Invensense.

The sensor communicates using the I2C protocol with other devices, for which I'm making use of the Wire library.

You will have to include Wire.h in your sketches if you plan to use this library.

Here's an example of how to use it (assuming you have already made the electrical connections):

#include "itg3200.h"
ITG3200 gyro;

void setup(){
Serial.begin(9600);
gyro.begin(0x69); // as for SparkFun breakout, all default values
delay(1);
}

void loop(){
Serial.print("X=");
Serial.println(gyro.getX());
Serial.print("Y=");
Serial.println(gyro.getY());
Serial.print("Z=");
Serial.println(gyro.getZ());
delay(400);
}

Running this sketch will make the Arduino transmit the readings for each axis through the first serial module every 400 milliseconds.

To download the library, visit the GitHub repository.

UPDATE: This library has been updated as of January 16th, 2011.

Thursday, October 21, 2010

SMD Resistors Cheat Sheet

Here's cheat sheet for reading SMD Resistors that I came up with recently.
If you have trouble reading these components, try using a magnifier.
Here's the link to view it.

If you think you can't solder these think twice, these are actually pretty easy after you practice a couple of times. Here's an 8-part tutorial from the folks at Sparkfun Electronics.