Shop OBEX P1 Docs P2 Docs Learn Events
MEMSIC object - HELP PLEASE — Parallax Forums

MEMSIC object - HELP PLEASE

ALIBEALIBE Posts: 299
edited 2006-09-13 14:57 in Propeller 1
Beau,
I am having some wierd behavior w/ the MEMSIC reading I am getting from the object calls.
acc.start(5, 4) 'start memsic 2125 
waitcnt(clkfreq/10 + cnt) 'wait for things to settle 
acc.setlevel 'assume at startup that the memsic2125 is level 

repeat 
  raw := acc.ro 'Get raw value for acceleration 
  theta := acc.theta 
  deg := theta >> 19 'scale 32-bit value to a 13-bit value 

  lcd.str(num.decf( deg,3 ) ) ' Print Fractional Part 
  waitcnt(clkfreq/10 + cnt)

·The reading I'm showing when leveled is 2459 and when tilting to:

L: 6283
R: 1270
B: 646
F: 4266

I don't understand these readings - pardon my ingnorance.

can you help me understand these readings and how to interpret them please

thanks in advace

ALIBE

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,547
    edited 2006-09-12 19:29
    The deg value is a 13-bit value ranging from 0 to 8191. To convert this into something "human readable", take 'deg' and multiply it by 360, then devide the result by 8191.


    L = 6283 Raw = 276 Deg   (270)
    R = 1270 Raw =  56 Deg   ( 90) <-- The difference is probably in the way you were tilting the sensor
    B =  646 Raw =  28 Deg   (  0) <-- The difference is probably in the way you were tilting the sensor 
    F = 4266 Raw = 187 Deg   (180)
    
    Detective hat on:
    Based on the differences between R and B I would guess that you are right handed.
    Left handed tilting would cause F and R to be very close, while B and L would be slightly off.
    Detective hat off:
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • ALIBEALIBE Posts: 299
    edited 2006-09-13 12:25
    thanks Beau - appreciate your quick response and help.

    I'm a lefty [noparse]:)[/noparse]
  • Beau SchwabeBeau Schwabe Posts: 6,547
    edited 2006-09-13 14:51
    "I'm a lefty [noparse]:)[/noparse]"

    Hmm... my assumption was based on that it's less stress to move your wrist forward, than it is back and still keep alignment (back tends to skew a little bit).
    The same with Left or Right, but it depends on which hand you are using....an inward wrist rotation would have more control than outward rotation. ...but who
    says you were tilting with your wrist?

    Anyway, I hope the 13-bit explanation made sense.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • ALIBEALIBE Posts: 299
    edited 2006-09-13 14:57
    yes, it does - thanks for your help again

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    thanks in advance,


    ALIBE - Artificial LIfe BEing. In search of building autonoumous land robot
Sign In or Register to comment.