Shop OBEX P1 Docs P2 Docs Learn Events
Memsic 2125 in Matlab with Arduino board — Parallax Forums

Memsic 2125 in Matlab with Arduino board

jomillejomille Posts: 2
edited 2011-03-10 17:47 in Accessories
I have a Memsic 2125 chip hooked up to a Arduino board that is reporting raw acceleration data back to Matlab. Using the code here (http://arduino.cc/en/Tutorial/Memsic2125?from=Tutorial.AccelerometerMemsic2125) I read the accelerationX and accelerationY in Matlab via the serial port. Now I need to convert this into an actual degree angle for X and Y. Using the data I am getting from the board in acceleration, how can I convert this into an angle?

Thanks

Comments

  • FranklinFranklin Posts: 4,747
    edited 2011-03-08 20:46
    http://arduino.cc/en/Tutorial/Memsic2125 recommend you go here and the Arduino forums.
  • jomillejomille Posts: 2
    edited 2011-03-09 04:32
    Yep, got that..As you see from my post, I am already familiar with that tutorial and that code. My question lies with getting tilt angle from the raw acceleration data. This seems like a question that would be more suited for this forum.
  • FranklinFranklin Posts: 4,747
    edited 2011-03-09 07:53
    My question lies with getting tilt angle from the raw acceleration data
    You are using Matlab and an arduino. All code will be for those devices. Why do you think basic stamp/propeller code will work with your setup?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-03-09 10:44
    Well, maybe someone who has PBASIC or SPIN experience/s could share and the OP could extrapolate.
  • WhitWhit Posts: 4,191
    edited 2011-03-10 07:35
    @jomille - did you see the Nuts and Volt article "Its All About Angles" that is linked on the Memsic 2125 page on the Parallax site? As PJ suggested, you might be able to do a bit of extrapolating from that.

    Article - http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol3/col/nv92.pdf

    Code - http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol3/code/nv92.zip
  • Mike GMike G Posts: 2,702
    edited 2011-03-10 17:47
    I'm not sure how you would go about converting a change in velocity to an angle.

    But converting a linear range to an angle is fairly straightforward. If you have a 1000 unit range through 180 degrees then 180/1000 = 0.18 units per degree. Or [step = pi/units]; therefore

    f(x) = (sin(x*step) + 1) * offset

    If it's not linear than you need to a conversion factor.

    Edit: read the article in whit's post. It has the conversion information.
Sign In or Register to comment.