Shop OBEX P1 Docs P2 Docs Learn Events
ADXL202 Module — Parallax Forums

ADXL202 Module

NewzedNewzed Posts: 2,503
edited 2005-10-31 15:39 in BASIC Stamp
I got my ADXL202 accelerator chip working pretty good with a BS2E.· I played around with the math in the program a bit and the tilt shows 0 degrees for both X and Y, which is not what it was displaying when I initially fired it up.· I was wondering, does your location on the earth's surface have any bearing on the static readings.· If it reads 0, 0 here in West Florida would it read the same in Seattle, Washington?

Sid

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-10-24 06:19
    Sid -

    The outputs of this accelerometer are based on the relationship (angle) betwen the measurement axis of the chip, and the Earth's gravitational field. Thus, the location on the Earth's surface is insignificant to whether·the measurement axis of the chip·is parallel or not to the gravitational field.

    Here are a couple of thoughts on incorrect readings. I hope one of them hits the mark.

    AD suggests a .1 µfd de-coupling cap between Vcc and ground to reduce any power supply (PS) noise. This is not noise generated by the PS per se, but rather from (perhaps) the onboard oscillator or resonator on the microprocessor coupling to the Vcc line, or by any other local oscillator which may be present.

    For tilt applications, it is the user's responsibilty to zero set, null, or compensate the accelerometer. The data sheet suggests a procedure for obtaining an offset value which is later stored in EEPROM for future use.

    Lastly, there is a brief start-up period of 1.5 ms which must be considered, although on the Stamp this really shouldn't be terribly significant, unless you were to take readings immediately upon power up. Usually there is some sort of "housekeeping" which would automatically cause at least that much delay. This would probably be more significant if one were using an SX processor in native mode, or something similar.

    AD also has an applications note on using the ADXL202 with a Basic Stamp (BS-2). If you can't find it, let me know, as I have it on my hard drive and can easily send it off to you. WARNING: In that application note, the X and Y inputs are backwards, as I remember <sigh>.

    Regards,

    Bruce Bates

    Post Edited (Bruce Bates) : 10/24/2005 6:22:59 AM GMT
  • NewzedNewzed Posts: 2,503
    edited 2005-10-24 12:30
    Thanks for the response, Bruce.

    This chip confuses me a bit.· Right now I have it sitting on my desk, so that Pin 1 is north and Pin 7 is south.

    Here are the debug command lines:

    DEBUG "X·· ", DEC (xRaw / 500), ".", DEC3 xRaw, "ms ",
    ·········· (xmG.BIT15 * 13 + " "), DEC (ABS xmG / 1000), ".",
    ·········· DEC3 (ABS xmG), "g ", (xTilt.BIT15 * 13 + " "),
    ·········· DEC ABS xTilt,· " degrees", cr

    DEBUG "Y·· ", DEC (yRaw / 500), ".", DEC3 yRaw, "ms ",
    ·········· (ymG.BIT15 * 13 + " "),
    ·········· DEC (ABS ymG/ 1000), ".", DEC3 (ABS ymG), "g ",
    ·········· (yTilt.BIT15 * 13 + " "),
    ·········· SDEC ABS yTilt, " degrees", cr, cr

    If I tilt the left-to-right axis (east to west) the Y axis on my screen changes, not the X axis.· If I tilt the top-bottom axis (north-south) the
    X axis changes.· This is 90 degrees from what I expected.

    Here is what my debug screen says when the chip is at rest:

    X·· 5.515ms· 0.008g 0 degrees
    Y·· 4.442ms· 0.004g· 0 degrees

    On the X axis, the 0.008g, which is really a negligble amount, alternates between .008 and .000 - never any in-between values.

    On the Y axis, the 0.004, which is even less significant, alternates between .004, .008 and .012 - again, no in-between values.

    I added the .1uf across Vdd and Vss right at the chip and could detect no change in the displayed values.

    I can make the X axis read 0.000g by tilting the board ever so slightly, but not the Y axis - that reads either 0.004 or -0.004.

    I got the X axis to read .000/.008 by adding the -16 to this line:

    Read_G_Force:
    ·· xmG = (((xRaw / 5) - 500) * 8)-16

    I got the Y axis to read .004/.008·and 0 degrees by adding the +100 to this line:

    ymG = (((yRaw / 5) - 500) * 8)+100··

    So there you are, Bruce.· My big question is why are the axes apparently 90 degrees off?

    Sid·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-10-24 18:18
    Sid -

    You may have missed or skipped over the last paragraph of my last post. Here it is for emphasis:

    "AD also has an applications note on using the ADXL202 with a Basic Stamp (BS-2). If you can't find it, let me know, as I have it on my hard drive and can easily send it off to you. WARNING: In that application note, the X and Y inputs are backwards, as I remember <sigh>."

    If you were using that AD Applications Note as a gude, that's how the axes became reversed. I have attached that applications note for your perusal.

    The actual ADXL202 data sheet contains the information on how to effect the "zeroing" compensation which appears to be required, and will probably dispense with your non-zero initial readings, as your last post indicates that you are using it (at least at the moment) in a tilt application.

    Regards,

    Bruce Bates
  • NewzedNewzed Posts: 2,503
    edited 2005-10-24 20:56
    Thanks for the attachment, Bruce.

    Your comments indicated that the results from the Application Note would be 90 degrees off.· I couldn't correlate the A, B, C, etc., pins to the actual pins on the chip so it was hard for me to follow.

    On my own circuit, the X input is connected to Xout and the Y input is connected to Yout.· With the chip oriented north and south, tilting the chip on the north-south axis changed the X display, not the Y.· So....
    I reversed the pin assignments - X input goes to Yout and Y input goes to Xout.· Now if I tilt the chip on the north-south axis, the Y display changes, which is what I would expect.· Something tells me I am approaching this wrong merely to get the results I expected, or, the output pins on the chip are labeled wrong in the data sheet.

    One other thing -·I get a full 90 degree tilt on the X axis with the pins reversed, but only about 70 degrees on the Y axis.· Before, I was getting about a 65 max tilt on both axes.

    Am I missing something, Bruce?

    Sid
  • NewzedNewzed Posts: 2,503
    edited 2005-10-24 22:27
    Correction to my last post, Bruce.

    If I rotate the chip on the X axis (with Xout and Yout reversed) counter-clockwise to the vertical position, I get 90 degrees tilt.· If I rotate it clockwise to the vertical I only get 69 degrees tilteyes.gif

    Sid
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-10-24 22:36
    Sid -

    This is almost beginning to sound like a bum chip. Do you happen to have another one you can try?

    You don't have this merely wire wrapped dead bug style, or anything like that, do you?

    Regards,

    Bruce Bates
  • NewzedNewzed Posts: 2,503
    edited 2005-10-24 22:57
    Bruce, everything on the board is SMD.· I have a couple of more chips coming in, so I'll build up another board and see what it says.
  • NewzedNewzed Posts: 2,503
    edited 2005-10-31 15:39
    I have two ADXL boards.· I plug one ion and get the following readings:

    X = 2408· Y = 2500
    X·· 4.408ms -0.152g -9 degrees
    Y·· 5.500ms· 0.000g· 0 degrees

    I plug the other board in and I get:

    X = 2329· Y = 2163
    X·· 4.329ms -0.280g -16 degrees
    Y·· 4.163ms -0.544g -33 degrees

    I have attached the code I am using.· Can anyone explain why I get different readings?· Are one or both ADXLs defective?

    I have ordered a Memsic 2125 from Parallax to see what kind of readings I get from that.

    Sid
Sign In or Register to comment.