Shop OBEX P1 Docs P2 Docs Learn Events
accelerometer issues and questions (Parallax/Memsic dev... — Parallax Forums

accelerometer issues and questions (Parallax/Memsic dev...

ArchiverArchiver Posts: 46,084
edited 2003-05-03 00:31 in General Discussion
Thanks to both of you who responded to my questions. I realize the
limitations and nonlunearities above 60 degrees. I undwerstand that the
experiment and code provided in the Parallax/Memsic demo kit takes this
feature into account. The application is for 0-360 degrees range. This is
accomplished by using both axis outputs from the accelerometer. This way (I
assume) when one sensor is least sensitive the other axis unit is at maximum
sensitivity. I am not real clear on the reasons for the ArcTan function
(ATN).
I was hoping Parallax or Memsic or EMEsytems would respond to my post since
the part is made by Memsic, the kit is sold by Parallax, and EMEsytems wrote
the code.
Thanks Again !


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-04-24 21:06
    As I often remind list users ... you should download the data sheet for the
    Memsic device. The calculation of angle using both axis of the 2125 is comes
    directly from Memsic data. It works because the PBASIC ArcTan function
    returns a vector angle for a line that extends from 0, 0 to X, Y -- the
    Memsic 2125 returns X and Y in g-force (that's why both sensors are
    required). Since the sensor returns positive and negative g force values,
    all quadrants of a circle can be covered.

    To be fair, ArcTan was not previously documented but is included in the new
    PBASIC Help File that will be provided with the compiler update that will be
    out soon. Since we're discussing it though, ArcTan returns Brads (0 - 255),
    not degrees, so a conversion to degrees is required.

    -- Jon Williams
    -- Parallax


    In a message dated 4/24/2003 2:09:54 PM Central Standard Time, azeasi@a...
    writes:

    > Thanks to both of you who responded to my questions. I realize the
    > limitations and nonlunearities above 60 degrees. I undwerstand that the
    > experiment and code provided in the Parallax/Memsic demo kit takes this
    > feature into account. The application is for 0-360 degrees range. This is
    > accomplished by using both axis outputs from the accelerometer. This way (I
    >
    > assume) when one sensor is least sensitive the other axis unit is at
    > maximum
    > sensitivity. I am not real clear on the reasons for the ArcTan function
    > (ATN).
    > I was hoping Parallax or Memsic or EMEsytems would respond to my post since
    >
    > the part is made by Memsic, the kit is sold by Parallax, and EMEsytems
    > wrote
    > the code.
    > Thanks Again !



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-26 16:45
    Thanks for your response. I did download the Memsic documentation but am
    still a little unclear on the outputs from the accelerometer. One last
    question...why the difference in the divisor for the demo kit source code.
    One has divide by 8 the other divide by 16. What are the implications from
    using 8 or 16? Is the acrtan function available in the Version 1.33 compiler?
    Is it different in the version 2 compiler? Thanks again!


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-26 17:28
    Your question on divisor is not clear to me. I wrote the demo source code
    and didn't use 16 as a divisor anywhere. Please double-check to make sure
    you're not missing something basic [noparse][[/noparse]no pun intended] and then re-ask your
    question.

    ATN is available in all versions of the BS2 compiler -- it just wasn't
    documented. It takes two inputs: X and Y which are signed bytes (-127 to
    +127). The output is the angle in Brad (0 - 255) to the point specified by
    X, Y. You can convert Brads to Degrees by multiplying by multiplying Brads
    by 1.406. In PBASIC:

    degrees = brads */ $0168

    or

    degrees = brads + (brads ** $6800)


    -- Jon Williams
    -- Parallax

    In a message dated 4/26/2003 10:47:44 AM Central Standard Time,
    azeasi@a... writes:

    > Thanks for your response. I did download the Memsic documentation but am
    > still a little unclear on the outputs from the accelerometer. One last
    > question...why the difference in the divisor for the demo kit source code.
    > One has divide by 8 the other divide by 16. What are the implications from
    > using 8 or 16? Is the acrtan function available in the Version 1.33
    > compiler?
    > Is it different in the version 2 compiler? Thanks again!



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-26 22:07
    Thanks again. The fact that ypu did not use 16 as a divisor is exactly my
    question! In the documentation posted in the 2003 catalog the formula for
    tilt is "tilt=(xmg?16) ATN (ymg/16)" hence a disisor of 16
    BUT in the documentation listed with the demo kit that arrived with the
    Memsic accelerometers the formula is listed as " tilt= (xmg/8) ATN (ymg/8)"
    thus a divisor of 8!
    So to post my question again. What is the reason for the different divisors?
    What will be the differences in the result using the tilt formula with the
    disor of 8 versus the tilt formula with the divisor of 16?
    Thanks again!


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-04-27 00:04
    Here's the raw truth: The catalog formula was a quickie -- that works -- and
    yet a quickie nonetheless. After thinking about it a while and checking the
    numbers, we changed to eight to preserve some resolution while bringing the
    tilt value into the range required by ATN (-127 to +127).

    When in doubt always use the data that comes with the product; that will
    likely be the best code we'll have at the moment for a given device.

    -- Jon Williams
    -- Parallax


    In a message dated 4/26/2003 4:08:01 PM Central Standard Time, azeasi@a...
    writes:

    > Thanks again. The fact that ypu did not use 16 as a divisor is exactly my
    > question! In the documentation posted in the 2003 catalog the formula for
    > tilt is "tilt=(xmg?16) ATN (ymg/16)" hence a disisor of 16
    > BUT in the documentation listed with the demo kit that arrived with the
    > Memsic accelerometers the formula is listed as " tilt= (xmg/8) ATN (ymg/8)"
    >
    > thus a divisor of 8!
    > So to post my question again. What is the reason for the different
    > divisors?
    > What will be the differences in the result using the tilt formula with the
    > disor of 8 versus the tilt formula with the divisor of 16?
    > Thanks again!



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-05-03 00:31
    Jon,

    Can you shed more light in this ATN function? It appears that it is
    supported by all the BS2 editors for all the BS2 versions, but the
    fact that it has been undocumented until now makes me suspicious.

    Were there bugs in early implementations? Is that why its existence
    was hidden from us for so long? If this is the case, can you tell us
    what versions of the Stamp we should refrain from using ATN on?

    Or if ATN was not supported on some early BS2s, which ones can we not
    use it on?

    And if ATN is not supported on certain BS2s, you wouldn't do
    something tricky like detecting the firmware version, and emulate the
    function in EEPROM, would you?

    --- In basicstamps@yahoogroups.com, jonwms@a... wrote:
    > As I often remind list users ... you should download the data sheet
    for the
    > Memsic device. The calculation of angle using both axis of the
    2125 is comes
    > directly from Memsic data. It works because the PBASIC ArcTan
    function
    > returns a vector angle for a line that extends from 0, 0 to X, Y --
    the
    > Memsic 2125 returns X and Y in g-force (that's why both sensors are
    > required). Since the sensor returns positive and negative g force
    values,
    > all quadrants of a circle can be covered.
    >
    > To be fair, ArcTan was not previously documented but is included in
    the new
    > PBASIC Help File that will be provided with the compiler update
    that will be
    > out soon. Since we're discussing it though, ArcTan returns Brads
    (0 - 255),
    > not degrees, so a conversion to degrees is required.
    >
    > -- Jon Williams
    > -- Parallax
    >
Sign In or Register to comment.