View Single Post
  #6   Spotlight this post!  
Unread 29-01-2004, 10:06
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
Re: Yaw Rate Sensor.. Questions

This has been said a bunch of times already, but if you do decide to order that part from Analog you need to get the one with "EB" appended to the part number. You can only use the ADXRS150EB anyways because the 300 is more than $100.00 at FutureActive. The part number is ADXRS150EB. You can get a 20 pin socket at radio shack and have it working in about 5 minutes. Its a nice part, but will kill your budget if you're using packaged encoders as well.

The accumulator for the heading can be a signed int initialized to 0. On each iteration of the ISR you add (current gyro - gyro bias) to the value. If you sample at 100Hz, the time between samples is 10ms. At max scale in the clockwise direction the gyro will output 150 degree/sec, converted to 512 by the ADC. Since it hasn't been a full second, the output is really 1.5 degrees/sample. Since 512 = 1.5 degrees, 1 degree = 512/1.5 = 341. If you add up the value of (current gyro - gyro bias) on each loop, whenever the sum is greater than 341 you've moved 1 degree.

Each time through the ISR you want to keep the accumulator between -341 and 341. If you're moving clockwise then each loop you'll add one degree to the heading and subtract 341 from the accumulator until its less than 341. Only two subtractions or additions at the most per loop is needed because it can't go faster than 1.5 degrees per sample. 341 is a constant that will need to be verified experimentally.

Last edited by seanwitte : 29-01-2004 at 10:29.