L3G4200D 3 axis gyroscope
botninja
Posts: 6
I just bought a L3G4200D 3 axis gyroscope module. I plan to use this module to determine the rotation of my robot. However I need help. I do not know how to turn the output from the sensor into degrees or radians.
Comments
I'm pretty sure what you need to do is integrate the measurements from the sensor.
There will be maximum rotation speed for the gyro and maximum output. You can use these values to figure out how to convert the reading to angular speed.
You need to multiply the angular speed by the time between each measurement to compute the total angle turned. You'll have a hard time coming up with a precise angle measurement just from the gyro since this sort of integration is prone to an accumulation of errors.
A gyro can be combined with a magnetometer to help correct for these accumulated errors.
There's lot of other documentation available on the product page.(under "Downloads & Documentation")
Sensors like these generally use a set of registers which need to be set to put the sensor in the desired mode and then then the data registers are read. The registers can be written to and read from using either I2C or SPI.
The sample Spin code used I2C so that's what I used when I experimented with the L3G4200D. I just used the default settings.
I notice there isn't code for the Arduino available on the product page but Google returned a bunch of results when I did a search there.
I know you already have the L3G4200D sensor (as do I) but you might want to think about getting one of these inexpensive MPU6050 chips. It does the angular integration for you. I tried one with an Arduino and I was amazed at how well it combined the sensor readings. There are some links to Arduino code for the MPU6050 in this thread.
Also I am a little confused by the explanation you gave in your first post Duane Degn(It's been a while since I took a calculus course if the integrating you reefer to is of the calculus type). Do you mind sending some form of detail instructions or psuedocode
I uploaded a video the other day (really poor quality). I was trying to use feedback from the L3G4200D with my omni bot. The video is unlisted but here's a link. I was comparing the L3G4200D to a helicopter gyro with heading lock. The heading lock gyro worked pretty well.
I didn't have good enough low speed control of the omni wheels to be able to make good use of either gyro. I'm planning on changing the motors on my omni bot to ones with encoders. Hopefully motors with encoders will allow me to make better use of these gyros.
Here's what I think some integration code would look like.
Again, this sort of calculation is very prone to errors.
thanks in advance for your help!
Do we need a Due board to test the code? I have an Uno and I'm willing to try out some code but I don't know if that will prove anything unless you also have a Uno compatible board.
I don't use Arduino boards a lot so I'm not sure what the best way to help.
Do you have an Uno?
Do you have links to these sketches you've tried?
Here is the link:
http://forums.parallax.com/showthread.php/127868-Gyro-lisy300