Forum: µC & Digital Electronics L3G4200D Gyro rotation angle

Author: Fin Wood (finwood)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Good afternoon,

currently I am facing several difficulties calculating the rotation 
angle from a L3G4200D gyroscope.
But let's start from the beginning.

I retrieved the sensor on a 10dof-module from ebay (links below). I2C 
communication works, retrieving data from the sensor works, writing 
values into the control registers works as well.
This is my current setting:
twiSetVal(L3G_CTRL_REG4, 0b10000000); // enable Block Data Update
twiSetVal(L3G_CTRL_REG1, 0b00001111); // 100Hz, cut-off 12.5, switch on, enable all axes
twiSetVal(L3G_CTRL_REG2, 0b00000000); // High-pass cutoff 8Hz, normal mode
twiSetVal(L3G_CTRL_REG5, 0b00000001); // enable High-pass filter for DataReg

Now strangely, although the device is described as an angular rate 
sensor in the datasheet, I seem to get angular acceleration data from 
it, as you can guess from the attached 'Winkelmessdaten.pdf':
Page 1 shows the raw sensor data, pages 2 and 3 display the cumulative 
sums representing angular velocity and rotation angle, respectively.

Therefore, my main question is: Why?
Why does the sensor output angular acceleration data instead of, as 
specified, measure the angular rate? Is it some misconfiguration on my 
behalf, or was the china module a little too cheap?

Another problem is the zero-rate offset. As you can clearly see, I am 
facing a serious drift. When I'm averaging the first 2.5 seconds (250 
samples), as suggested in the application notes to measure the offset, 
it makes things even worse ('rotang-corr.pdf', channel 'a_c2'). 
Averaging the whole series surely works ('a_c1'), but definitely not in 
real-time applications. Any ideas?

I'd appreciate your help, for I seem to be kind of stuck here.

Kind Regards,

-------- Links --------
10dof module on ebay: Ebay-Artikel Nr. 351195062122
L3G4200D resources: 

Author: adenin (Guest)
Posted on:

Rate this post
0 useful
not useful
disable the high pass filter. ^^

Author: Fin Wood (finwood)
Posted on:

Rate this post
0 useful
not useful

I guess, it actually was misconfiguration on my behalf.

Thanks, it's working! :-)


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.