Shop OBEX P1 Docs P2 Docs Learn Events
Accelerometer help — Parallax Forums

Accelerometer help

SunflowerSunflower Posts: 48
edited 2010-03-05 02:01 in BASIC Stamp
I bought a Memsic 2125 from Parallax and can not resolve accuracy better than +/- several degrees. Is this normal or am I doing something wrong?

Comments

  • kf4ixmkf4ixm Posts: 529
    edited 2010-03-04 22:20
    How do you have it wired up? what does your code look like? i would really need to see a schematic of how you have it connected and attatch your code to your post to be of any help.
  • SunflowerSunflower Posts: 48
    edited 2010-03-04 23:04
    The wires are simple MEMS Xout to Zin pin, 5V and GND. Battery power supply on MMC carrier board with capacitors. No vibration and stable room temperatures. Output is +/- 2 brads when level. Is that the expected performance of the MEMS?


    Zin PIN 11 ' Tilt Z Accelerometer MEMSIC 2125

    work4 = 0
    FOR work.HIGHBYTE = 1 TO 64
    PULSIN Zin, HiPulse, zRaw
    zRaw = (zRaw */ Scale) '$0C0=Scale pulse to uSeconds 0.75 BS2p
    zRaw = zRaw/10
    work4 = work4 + zRaw
    NEXT
    zRaw = ((work4 / 64) - 500) 'Binary SIN -127 to 127
    DEBUG SDEC zraw," "
    NEXT
  • hover1hover1 Posts: 1,929
    edited 2010-03-05 00:32
    An Accelerometer outputs in terms of g's, not degrees.

    Jim
    Sunflower said...
    I bought a Memsic 2125 from Parallax and can not resolve accuracy better than +/- several degrees. Is this normal or am I doing something wrong?
  • kf4ixmkf4ixm Posts: 529
    edited 2010-03-05 00:43
    i think you're using code for the compass module instead of the accelerometer code found here...

    http://www.parallax.com/Portals/0/Downloads/src/prod/3rd/Memsic2125Demo.zip
  • SunflowerSunflower Posts: 48
    edited 2010-03-05 01:17
    I left out the "8" factors for g force as I only need the SIN(angle) for relative tilt. From Memsic2125Demo.zip below. MEMS resolution is discussed in detail in small parts of a degree tilt, but are the actual measurements only good to a couple of degrees on each axis?


    GOSUB Read_G_Force ' read X and Y

    brads = (xmG / 8) ATN (ymG / 8) ' calculate angle
    degrees = brads */ 360 ' convert to degrees

    Read_G_Force:
    PULSIN Xin, HiPulse, pulse ' read pulse output
    pulse = pulse */ Scale ' convert to uSecs
    xmG = ((pulse / 10) - 500) * 8 ' calc 1/1000 g
    RETURN
  • hover1hover1 Posts: 1,929
    edited 2010-03-05 01:48
    @Sunflower

    I stand corrected. I have not followed the Basic Stamp software for this unit. I'm more familiar with the interface on the Propeller Chip.

    The demo software does indeed report back degrees of tilt.

    I will have to load up my BOE and try this out.

    Jim
  • SunflowerSunflower Posts: 48
    edited 2010-03-05 02:01
    Using ATN from two pins (X&Y) does smooth out the data to +/- 1 degree. I am running out of pins and would like the Z axis from one additional MEMS to one Stamp pin to measure dish tilt +/- 45 degrees, well within MEMS capability. But the Binary SIN rapidly fluctuates +/- 5 (a couple degrees) on just one axis. I guess I can accept that and still love the MEMS.
Sign In or Register to comment.