Shop OBEX P1 Docs P2 Docs Learn Events
How to - Accelerometer (1) Fundamentals and Tilt Measurement - Page 2 — Parallax Forums

How to - Accelerometer (1) Fundamentals and Tilt Measurement

2»

Comments

  • edited 2008-10-29 19:36
    Kunber,

    The MX2125 sends a pulse train for each sensing axis, and the duration of the pulses indicate the acceleration the axis senses. For tilt, the acceleration that can act on a given axis ranges from -1 g, which is 90 degrees clockwise of level, to +1 g, which is 90 degrees counterclockwise of level. For the -1 g to +1 g range, the accelerometer transmits pulses with durations ranging from 3.75 ms to 6.25 ms. If the accelerometer is flat, its axis senses 0 g, and sends pulses that last 5 ms, which is half way between 3.75 and 6.25 ms. Keep in mind that the more you tilt the accelerometer away from level, the further the pulse duration will deviate from 5 ms.

    1 g = the acceleration due to gravity.
    1 ms = 1/1,000 of a second
    1 us = 1/1,000,000 of a second

    In the SimpleTilt.bs2 example program, (see first post on this thread), the BASIC Stamp 2 measures the pulses transmitted by the MX2125 for each axis with a PULSIN command. One of the PULSIN commands stores a pulse measurement in a variable named x, and the other in a variable named y. For the BASIC Stamp 2, the results that get stored in the x or y variables are pulse measurements with units of 2 us. If the measurement is level, the axis measurements should both be about 0 g, which the MX2125 communicates with 5 ms pulses, which result in PULSIN measurements of 5000.

    2500 X 2 us = 2.5 X 2/1,000,000 = 2.5/1,000 = 2.5 ms.

    The same applies for -1 g (1875 -> 3.75 ms) and +1 g (3225 -> 6.25 ms).

    Yes, PAUSE can be used to adjust the sampling rate. You can copy and paste listed measurements from the Debug Terminal into a .txt file and then import into most software packages. The Smart Sensors and Applications text has an example of plotting acceleration over time and working back to velocity and position in MS Excel. See printed pages 230 to 240 (PDF page numbers may differ slightly, so check the top of the page for the printed page number.)

    The Smart Sensors and Applications textbook is available for free PDF download from this page:

    http://www.parallax.com/tabid/134/ProductID/418/Default.aspx

    Andy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
  • KunberKunber Posts: 2
    edited 2008-10-30 16:24
    Thanks Andy. You are the best. tongue.gif
  • km4hrkm4hr Posts: 2
    edited 2008-11-25 18:25
    Andy,

    You stated in one of your (very helpful) responses the pulse width output of a memsic 2125 accelerometer when tilted 90 degrees from horizontal.
    You said:

    "If the accelerometer is flat, its axis senses 0 g, and sends pulses that last 5 ms, which is half way between 3.75 and 6.25 ms."

    I just purchased a mx2125 from radio shack (part no 276-0029). I connected it to a pulse counter input on my data acquisition unit (ueidaq.com). When I tilt the mx2125 to a vertical position on either the X or Y axis I get outputs ranging from about 3.4 to 6.7 ms. These measurements seem to differ significantly from the values you stated. How precisely should my measurements agree with those you stated (3.75 to 6.25)? I feel that I have everything hooked up right because I measure exactly 5 ms when the mx2125 is lying flat. Should I be applying some scaling factors when tilting it away from a flat position?

    I thought my measurements were pretty good considering that the stated range of the mx2125 is +/- 3 G's. At a tilt angle of 90 degrees the mx2125 should indicate one G acceleration, right? One G would be one third of the three G range of the mx2125. So the output should be 6.67 mv ((1/3 * 5) + 5). at one G, right? An output of 6.25 mv would correspond to only one fourth of the output range (0-3G = 5-10 ms), no? This would suggest that the mx2125 should be able to measure up to 4 G's output, right? Does the mx2125 come in various output versions?

    I'm probably just confused. Please clear this up if you can.

    thanks
  • edited 2008-11-26 02:17
    km4hr,

    According to the datasheet, the axis Sensitivity can vary from 11.8%/g to 13.2%/g duty cycle over temperature, with 12.5%/g nominal. (The datasheet is available from the product page Memsic 2125 product page at http://www.parallax.com/tabid/134/ProductID/93/Default.aspx.)

    What is your cycle time measurement? I'm guessing it's pretty close to 10 ms because your measurements are fairly symmetric around 5 ms. So, my best guess is that the Sensitivity scale that is outside spec.

    Also, what values does the BASIC Stamp's PULSIN command return when monitoring the device at +90, 0, and -90 degrees?

    Andy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
  • km4hrkm4hr Posts: 2
    edited 2008-11-26 03:25
    Andy,

    Thanks for your response. After posting my question I realized this site may be just for Parallax customers. My apologies, I haven't purchased anything from Parallax yet. I have no problem buying from Parallax however. Perhaps I will be a customer soon.

    I located this site by Googling for help with the mx2125.

    Sounds like my mx2125 may be out of calibration. It's brand new but perhaps I should try another one to see if I get the same results.

    Please help me understand why 90 degree tilt should produce 6.25 ms pulse width. If 5ms represents zero tilt and 10ms represents 3g then shouldn't 1g be 6.66ms ? That is, 1/3 the way between 5 ms and 10ms? ( 1/3*5 + 5 = 6.66 ms ) Where am I going wrong?

    Am I correct in saying that 90 degree tilt is equal to one g?

    Does 10ms (max output) represent 3 g's for mx2125? Or what does 10ms represent?

    As far as my PULSIN response you asked about, I don't have a BASIC Stamp. I'm using another data acquisition system.

    thanks
  • siamsiam Posts: 1
    edited 2008-11-26 05:31
    Hi All

    Please help me.

    I'm doing project with MXD2125.It work unproperly as below.

    When i put down vetical· PWM read·around 2551 (X)· and Y =3225· then calculated will get 0 Degree (It correctly)

    but when i put up·whish will get·90 Degree ,unfortunately PWM read around· X= 3265· Y = 2570 then calculated will get only 88.4 Degree

    It not 90 degree or closely(I try to swap pin to see value) it result is a same.

    Who know please comment and suggestion.

    Thank gor advanced.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-11-26 10:46
    siam -

    That's within tolerance, and that's specified by the manufacturer in the datasheet. The data sheet is available for download on the Parallax web site right where you purchased the product.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When all else fails, try inserting a new battery.
  • edited 2008-11-26 19:21
    km4hr

    If you are working with the raw Memsic part or a non-Parallax board with a memsic 2125 accelerometer on it, there might be an issue with the circuit. If you'd like to test our Memsic 2125 Dual Axis Accelerometer Module with a BASIC Stamp for comparison's sake (or to get a prototype going quickly), you can get all the parts at Radio Shack, and most of the stores stock the parts. Here are links:

    What's a Microcontroller BASIC Stamp Kit ($89.99)
    http://www.radioshack.com/product/index.jsp?productId=2117994

    Memsic 2125 Dual Axis Accelerometer ($32.99)
    http://www.radioshack.com/product/index.jsp?productId=2909788

    We have lots of documentation on the Memsic 2125 Dual Axis Accelerometer Module on the Parallax product page. Just follow this link and look in the Downloads section.

    Memsic 2125 Dual Axis Accelerometer on the Parallax site
    http://www.parallax.com/tabid/134/ProductID/93/Default.aspx

    I would recommend downloading and reading the Stamps in Class Memsic Tutorial, and the Datasheet (MXD2125G&M) from the page link above. For additional information on how the accelerometer responds to gravity, tilt, and rotation, check chapter 3 in Smart Sensors and Applications. (Chapter 6 also has some good application material.) You can download the PDF version of the Smart Sensors and Applications from this page:

    Smart Sensors and Applications
    http://www.parallax.com/tabid/134/ProductID/418/Default.aspx

    Most of the documentation I just pointed you to just assumes that your pulses will range (from 3.75 ms to 5 ms to 6.25 ms) when the acceleration sensed by the axis ranges from (-1 g to 0 g to + 1 g). This is not exactly what the datasheet says, so here is a blurb that should help reconcile it:

    According to the datasheet, the MX2125 sends a 50% duty cycle pulses to indicate 0 g. Since the cycle time is nominally 10 ms, that means you can expect 5 ms pulses when the accelerometer is level (0 g). If +1 g is applied to one of the sensing axes, the datasheet states that the duty cycle will deviate from 50% by 12.5%. Assuming a 10 ms cycle time with 62.5% duty cycle, that would equate to each pulse lasting 6.25 ms. Or, if you tilt the other direction (-1 g), the duty cycle would be 50% - 12.5% = 37.5%, and each pulse would last 3.75 ms. If you apply +2 g, you can expect 75% duty cycle (7.5 ms) and so on.

    Andy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.

    Post Edited (Andy Lindsay (Parallax)) : 11/26/2008 7:27:16 PM GMT
  • FireHopperFireHopper Posts: 180
    edited 2009-02-02 23:17
    what about the 3 axis acellerometer that you guys sell.. do we have any really good help on that one?
  • aj1808aj1808 Posts: 3
    edited 2010-01-27 08:52
    Hi,

    I read one of the student project for smart backpack using BS2. The project description mention, he used accelerometer to detect the movement. In more specific,
    if he take out his belonging outside the bag, then suddenly he moved without putting back his belonging, then this accelerometer would detect.

    How would it works in that sense?
  • AN2AN2 Posts: 5
    edited 2010-02-14 04:12
    Hi,

    Don't know whether this is a stupid q [noparse]:([/noparse]
    Anyway I need to know it.

    I have problem. How do they mark the X and Y axis? both X and Y output terminals/pins are on same side of the IC.
    Is there a particular rule for that or we can mark them as we wish????

    Waiting for a soon reply.

    Thanks.
    AN2

    Post Edited (AN2) : 2/14/2010 5:55:10 AM GMT
  • hover1hover1 Posts: 1,929
    edited 2010-02-14 13:33
    If you look on the first page of the documentation, you will see an arrow on top of the chip. This arrow points in the direction of the X axis.
    http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/28017-Memsic2Axis-v2.0.pdf
    Jim
    AN2 said...
    Hi,

    Don't know whether this is a stupid q [noparse]:([/noparse]
    Anyway I need to know it.

    I have problem. How do they mark the X and Y axis? both X and Y output terminals/pins are on same side of the IC.
    Is there a particular rule for that or we can mark them as we wish????

    Waiting for a soon reply.

    Thanks.
    AN2
  • AN2AN2 Posts: 5
    edited 2010-02-15 05:06
    Hi Jim,
    First I must thank you for ur reply.

    What I really want to know is this is.
    Given a data sheet of a particular dual axis accelerometer we can recognise its Xout and Yout pins. But they donot provide the X and y directions in the data sheet. I want to know the way in which we have to determine the axis direction on such an occasion.

    Thanks.

    hover1 said...
    If you look on the first page of the documentation, you will see an arrow on top of the chip. This arrow points in the direction of the X axis.
    http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/28017-Memsic2Axis-v2.0.pdf
    Jim
    AN2 said...

    Hi,

    Don't know whether this is a stupid q [noparse]:([/noparse]
    Anyway I need to know it.

    I have problem. How do they mark the X and Y axis? both X and Y output terminals/pins are on same side of the IC.
    Is there a particular rule for that or we can mark them as we wish????

    Waiting for a soon reply.

    Thanks.
    AN2
  • hover1hover1 Posts: 1,929
    edited 2010-02-15 15:17
    The link I posted to the data sheet doesn't seem to work. Got to the product page:

    ·http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/memsic/List/0/SortField/4/ProductID/93/Default.aspx

    and take a look at the pdf's at the bottom- right of the page.
    It will show these pictures:
    410 x 280 - 68K
    604 x 284 - 87K
Sign In or Register to comment.