Gyro me this, Gyro me that.

When a gyroscope speaks, one must listen. Also, when an XYZ stage beckons, one must also listen. Ergo, the quadcopter gets a little dusty.

Working at the Jet Propulsion Laboratory is a lot of fun. It is so much fun, that I decided to spend my last two weeks off from university life at the lab. Of course, that means I actually have to do real work, although sometimes I do get away with sleeping on the couch.

This is where it all happens.

For anyone who follows all things JPL and Mars related, you know that JPL is going to launch another rover in the year 2020 (for the rest of you, know you know). This rover will be the same as Curiosity (MSL) but will have some different instruments. One of the new instruments is called SHERLOC, a really awesome Raman spectrometer that will scan for organics. It’s nondestructive, unlike the other instruments that have looked for organics on Mars. It is also the instrument that I have assisted on for nearly two years now.

Well, anyway, this is all great for Mars but tragic for my quadcopter because it means I haven’t spent nearly as much time working on it as I had intended. My work at the lab currently involves programming an XYZ-stage for the spectrometer. I’m working in LabVIEW, but I figured out a way in which I could do it using a joystick and a microcontroller like the Arduino! Still, I made some progress today on the ‘copter that I wanted to write about.

Last time I wrote, I was fiddling with the accelerometer. Today, I managed to make first contact with the gyroscope (ITG-3200). I was having trouble at first because I had the wrong address. There are a couple of ways the gyro could be wired, and mine was wired so pin 9 (AD0) is connected to ground. The data sheet says this:

The slave address of the ITG-3200 devices is b110100X which is 7 bits long. The LSB bit of the 7 bit address is determined by the logic level on pin 9. This allows two ITG-3200 devices to be connected to the same I2C bus. When used in this configuration, the address of the one of the devices should be b1101000 (pin 9 is logic low) and the address of the other should be b1101001 (pin 9 is logic high). The I2C address is stored in register 0 (WHO_AM_I register).

Well, the issue turned out that in my notes I wrote that pin 9 was wired to VCC, so I thought it was high, and my address was 0x69 instead of 0x68. So make note! If you are using Sparkfun’s 9DOF sensor stick (SEN-10724), your gyro is wired to low and the address is 0x68.

The other neat thing I discovered is that I can communicate between the gyro and the accelerometer using the same two custom read and write functions. This is my first time doing anything using I2C, so I don’t know that this can be generalized for all devices, but at least it can be in this case. The only major difference is that the gyro outputs the least significant bit second and the accelerometer gives it first. So when you combine the bits to get your full length 16bit ADC value, you have to flip it.

I now have the angular velocity readings and it looks like, yes, my gryo and accelerometer are thinking in the same coordinate frame.

My next steps are to combine the gyroscope and accelerometer readings, communicate with the compass, and then create a simple program in Processing to visualize the data. After that, I’ll work on calibrating the values, which I will use Processing to help with. Before all that, of course, I have to read more about how filtering and calibration works.

I’ll leave you all with this nice picture of Curiosity’s twin, I made it last week while showing a friend around the lab.

What beautiful eyes you have, little robot.
Show your support

Clapping shows how much you appreciated Babe in Robotland’s story.