Shop OBEX P1 Docs P2 Docs Learn Events
Memsic 2125 converting raw data to Acceleration(G) — Parallax Forums

Memsic 2125 converting raw data to Acceleration(G)

sccoupesccoupe Posts: 118
edited 2008-11-07 22:53 in Propeller 1
Hi all,

I am having trouble trying to figure out out to convert the raw xy data from the Memsic 2125 to acceleration(g-force). I get 0.400.000 on each axis at level, 0.300.000 at 90 degrees in one direction per axis and 0.500.000 at 90 degrees per axis in the other direction. These values are from acc.Mx and acc.My. I tried using the formula from the demo for acc.ro, but that doesnt work the same. Any clues?

Thanks.

Jason

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-11-06 17:07
    sccoupe,

    Please post your code, or a URL link to the exact code that you are using.

    All of the pins are properly connected to the Memsic 2125 correct?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • sccoupesccoupe Posts: 118
    edited 2008-11-06 22:17
    Im using the Memsic 2125 graphic demo v1.0 by Beau Schwabe right from the object xchange. The demo shows the use of the ro and theta info and that is understood. What I dont understand is the data that comes back from the memsic2125 object used by the demo for the xraw and yraw data. I semi understand what the output is from the memsic data sheet, but cannot totally put together how to convert that output to something meaningful.

    Thanks
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-11-07 07:09
    sccoupe,

    I think I can answer your question... or at least I can explain the numbers that you are seeing.

    First it might help to know that the resolution of the RAW values if the Propeller is running at 80MHz is 12.5ns or (0.0000000125 seconds)
    At Zero g, the pulse width generated from the Memsic 2125 is 5ms (page 2 of this PDF www.parallax.com/Portals/0/Downloads/docs/prod/acc/memsickit.pdf ) .... 5ms = 0.005 seconds

    0.005 seconds divided by 0.0000000125 seconds = 400,000 <- Zero G returned RAW value

    For every 'g' the pulse width varies by 1.25ms, so if you tilt the sensor on one axis the Memsic 2125 generates a pulse of 6.25ms ... tilting it in the other direction the Memsic 2125 generates a pulse of 3.75ms.

    6.25ms = 0.00625 seconds ... divided by 0.0000000125 seconds = 500,000 <- Indicating +1g
    3.75ms = 0.00375 seconds ... divided by 0.0000000125 seconds = 300,000 <- Indicating -1g


    If you want to display the mg from the RAW values then apply the formula below...

    mg = (RAW - 400000) / 100

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • sccoupesccoupe Posts: 118
    edited 2008-11-07 22:53
    Thanks Beau,· thats exactly what I was looking for. The conversion was much more simple than I expected. It also helps to understand exactly how the raw data is derived.

    Thanks much!

    Jason
Sign In or Register to comment.