Shop OBEX P1 Docs P2 Docs Learn Events
Question on sample code for LISY300 Gyro — Parallax Forums

Question on sample code for LISY300 Gyro

crazyarch93crazyarch93 Posts: 9
edited 2010-12-09 11:16 in Accessories
I was wondering what the units of the variable raw is from this code. The code comes from the sample code you download from the product page for the BS2. Is it reading degrees per second? If so I'm getting some huge numbers for some reason. This is the code:

Read_Gyro:
LOW CSn ' Enable communication with sensor (active low)
SHIFTIN Dout, SCLK, MSBPOST, [raw\13] ' Get the data
HIGH CSn ' Disable communication with sensor (active low)
RETURN

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2010-12-09 11:16
    crazyarch93,

    The RAW data has a value associated to it but there is no real weight or meaning to that value. It's just an arbitrary unit of measurement until you integrate time into the equation. So the values returned will not be in Deg per second.

    Taken from the datasheet ...
    The LISY300 Gyroscope has a sensitivity of 3.3 mV/°/s.
    The ADC is 10-bits providing approximately 3.22 mV per step.
    Each step is approximately 1 degree of change on the gyroscope.


    In order to get actual deg you need to integrate time into the equation. That is, take as many RAW readings as you can in a fixed or known amount of time.

    Once you have an accumulative value over a specific amount time it becomes a matter of dividing the delta or change in the accumulative value over the elapsed time to determine the actual Deg.

    This without saying, there will also be 'normal' drift as well as 'bias' drift. The normal amount of drift would be associated the the orientation of the Gyro with respect to the Earths rotation (15 Deg per Hour). Bias drift can be associated to component tolerances, temperature, truncation error, missed data reading, etc.

    For the BS2 this is a complex task, and even for the Propeller it's a complex task. Timing is critical, and any time where you are not able to read data from the Gyro, you introduce error (drift) because the values were simply missed.
Sign In or Register to comment.