+ Reply to Thread
Results 1 to 8 of 8

Thread: Determining Acceleration from Memsic 2125

  1. #1

    Default Determining Acceleration from Memsic 2125

    In the Smart Sensors And Applications PDF pages 230-240 ( http://www.parallax.com/Portals/0/Do...nsors-v1.0.pdf ) the memsic 2125 provides pulse width data in the range of 1875 to 3150 whereby these values are scaled and offset to a range of -100 TO +100. This data is then considered to be the Acceleration data for a moving RC car whereby these -100 TO +100 figures are copied to the provided spreadsheet and used as the basis for further calculations, ie., velocity.

    I don’t understand how simply offsetting and scaling the memsic range data (provided by the BS2 PULSIN command) automatically makes these figures Acceleration figures when other documentation such as “Memsic 2125 Accelerometer Demo Kit (#28017) ( http://www.parallax.com/Portals/0/Do.../memsickit.pdf ) indicates that the raw memsic data must be converted to acceleration by use of the equation A(g) = ((T1 / T2) – 0.5 ) /12.5% ( where T1 is the sense pulse width, T2 is the total pulse duration).

    I have spent many hours pondering this one without success. Any help is greatly appreciated!

  2. #2

    Default Re: Determining Acceleration from Memsic 2125

    the range of 1875 to 3150 whereby these values are scaled and offset to a range of -100 TO +100.
    How is this scaled and offset? What formula is used?

  3. #3

    Default Re: Determining Acceleration from Memsic 2125

    Hi Franklin,

    Thank you for your reply.

    On page 225 of the Smart Sensors and Applications PDF is the offset and scaling BS2 code of:

    y = (y MIN 1875 MAX 3125) - 1875 ** 10538


    The complete program code may be found on p227-229

    I hope this helps.

  4. #4

    Default Re: Determining Acceleration from Memsic 2125

    Regarding the above quoted BS2 programming statement



    y = (y MIN 1875 MAX 3125) - 1875 ** 10538
    , the scale factor is determined using the scale factor equation on page 82 of the same PDF, which is:
    ScaleConstant=Int(65536( (output scale elements)/(input scale elements -1) ) )

    Output scale elements: -100 TO 0 TO 100 yields 201
    Input scale elements: 3125-1875-1 yields 1249
    ScaleConstant=Int( 65536 * (201/1249) ) yielding 10546

    As noted above, my calculation yields 10546, whereas, the PDF indicates 10538. I am not certain why the difference of 8 is occurring (any insight appreciated), however, as mentioned in the original post, I don't understand how scaling and offsetting the memsic raw output results in Acceleration values whereas other documentation indicates that the raw data must be put through the previous listed conversion equation in order to derive Acceleration.

    Your assistance is greatly appreciated.

  5. #5

    Default Re: Determining Acceleration from Memsic 2125

    robotics,

    I'll have to look at the code a little closer to explain it in further detail, but it seems that your only off by one tick...

    If you change the 1249 to 1250 and rework the equation...

    ScaleConstant=Int( 65536 * (201/1250) )

    ... you get 10538

    email - Beau Schwabe || BS Circuit Designs

    web - www.BScircuitdesigns.com
    IC's * Inductive proximity sensors * Misc * and more!!

    Do YOU need custom programming? PIC micro? Basic Stamp? Propeller? A custom PCB design? ... Then send me an e-mail lets talk, I have +20 years experience.



    Asked about the ramifications of his discoveries, Hertz replied, "Nothing, I guess." Hertz also stated, "I do not think that the wireless waves I have discovered will have any practical application."

  6. #6

    Default Re: Determining Acceleration from Memsic 2125

    robotics,

    SOLVED

    When you use the formula on page 82 to determine the ScaleConstant your first subtracting 1875 from 3125 and getting 1250 for your input scale elements when in fact the number of elements in your input scale are 1251 ... <- keep in mind this is before you subtract 1 as the equation indicates.

    In the example on page 82, the input scale of 0 to 10 is used. By your same notation that would be ...

    10 - 0 which gives an answer of 10, but there are actually 11 elements total.


    The same scenario is a common mistake when counting items from lined numbers...

    Suppose your data starts on line 9 and ends on line 26 and you wanted to figure out how many lines there were...

    26 - 9 = 17 ... but there would actually be 18 lines of data.


    ...The same is true for your input range of 3125 and 1875 ... subtracting yields 1250, but there are actually 1251 individual 'elements' there, so the equation for your scale constant should look like this...

    ScaleConstant = Int [ 65536 ( 201 / 1251 - 1) ]

    ScaleConstant = Int [ 65536 ( 201 / 1250) ]

    ScaleConstant = Int [ 10538.1888]

    ScaleConstant = 10538


    BTW) the output Scale is correct ... -100 to 100 is 201 individual elements counting Zero.

    email - Beau Schwabe || BS Circuit Designs

    web - www.BScircuitdesigns.com
    IC's * Inductive proximity sensors * Misc * and more!!

    Do YOU need custom programming? PIC micro? Basic Stamp? Propeller? A custom PCB design? ... Then send me an e-mail lets talk, I have +20 years experience.



    Asked about the ramifications of his discoveries, Hertz replied, "Nothing, I guess." Hertz also stated, "I do not think that the wireless waves I have discovered will have any practical application."

  7. #7

    Default Re: Determining Acceleration from Memsic 2125

    Beau,

    Many thanks for your detailed reply.

    If you could address the first part of my question(below) I would greatly appreciate it.

    I don’t understand how simply offsetting and scaling the memsic range data (provided by the BS2 PULSIN command) automatically makes these figures Acceleration figures when other documentation such as “Memsic 2125 Accelerometer Demo Kit (#28017) ( http://www.parallax.com/Portals/0/Do.../memsickit.pdf ) indicates that the raw memsic data must be converted to acceleration by use of the equation A(g) = ((T1 / T2) – 0.5 ) /12.5% ( where T1 is the sense pulse width, T2 is the total pulse duration).

    In advance, thank you!

  8. #8

    Default Re: Determining Acceleration from Memsic 2125

    robotics,

    The formula is derived from the manufacturer and can be found on their documentation here...

    http://www.parallax.com/Portals/0/Do...MXD2125G&M.pdf

    ... "The acceleration is proportional to the ratio T1/T2. The zero g output is set to 50% duty cycle and the sensitivity scale factor is set to 12.5% duty cycle change per g."

    A = (T1/T2 - 0.5) / 12.5%



    ...It a very similar formula to what you have been using.

    i.e.
    y = (y MIN 1875 MAX 3125) - 1875 ** 10538
    ... compared to ...
    a = (T1/T2) - 0.5 * 12.5%


    Where you have a 'raw value' (T1/T2) and you offset it by some amount to 'zero it out' (-0.5), and then you apply a scaling factor to make the data a little more human readable (* 12.5%)

    The reason for multiplying by 12.5% can be a little misleading the way it's written.

    12.5% = 1/8th of the Whole

    So essentially by multiplying by 12.5% you are really dividing by 8

    email - Beau Schwabe || BS Circuit Designs

    web - www.BScircuitdesigns.com
    IC's * Inductive proximity sensors * Misc * and more!!

    Do YOU need custom programming? PIC micro? Basic Stamp? Propeller? A custom PCB design? ... Then send me an e-mail lets talk, I have +20 years experience.



    Asked about the ramifications of his discoveries, Hertz replied, "Nothing, I guess." Hertz also stated, "I do not think that the wireless waves I have discovered will have any practical application."

+ Reply to Thread

Similar Threads

  1. Memsic 2125 converting raw data to Acceleration(G)
    By sccoupe in forum Propeller 1 Multicore Microcontroller
    Replies: 4
    Last Post: 11-08-2008, 05:53 AM
  2. Need help with Memsic 2125
    By arno in forum Javelin Stamp
    Replies: 13
    Last Post: 03-28-2006, 09:42 PM
  3. memsic 2125
    By stamp_demon in forum BASIC Stamp
    Replies: 2
    Last Post: 05-21-2005, 11:28 PM
  4. memsic 2125
    By Jiggs in forum Javelin Stamp
    Replies: 4
    Last Post: 04-02-2005, 08:45 AM
  5. Memsic 2125 and Acceleration Due To Gravity
    By Archiver in forum BASIC Stamps Archive
    Replies: 2
    Last Post: 01-15-2004, 05:23 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts