Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Orientation Detection in accelerometer

  1. Dec 10, 2015 #1
    I am using accelerometer to detect orientation change.for an e.g.if mobile accelerometer senses the direction that
    is it in portrait or landscape mode.so basically in this method the change of axis is detected .
    I am using the BMA250e module as an acceleromter,which has an inbuilt feature that it detects the change in orientation and respectively generates the interrupt,In my code i have checked the status of bits which detects the change after changing the orientation the status remains the same.
    I seriously want to know how to resolve the issue?
  2. jcsd
  3. Dec 10, 2015 #2


    User Avatar
    Gold Member

    Are you expected to detect the bits directly? Or is there an API available, where you just call a function and it returns a value?
  4. Dec 11, 2015 #3
    I have an register available in the sensor chip which when read shows the status of orient_bit in the register.
    If there is any change in orientation than orient_bit sets to '1' and after a certain delay it gets to '0' say, after 50 ms
    First,I am unable to get the status it always remains zero.
    Secondly,there are three types of orient modes low asymmetrical,high asymmetrical and symmetrical,what do these signify?
  5. Dec 11, 2015 #4


    User Avatar
    Gold Member

    It is difficult to determine your issue since there are so many things you could be doing incorrectly in the firmware.

    Do you actually get the interrupt, or are you just polling for changes? Are you using latched, non-latched or temporary?
    The interrupt condition could be going away while you check it if you use temporary or non latched.

    Does the temperature sensor work? (just to check your data interface)

    Have you activated the self check and verified its results?

    Have you written a register and read it back to verify the write worked?

    As for the symmetry modes, page 35 of the spec explains the angles for the different modes.

    Basically, in order to use a chip of this complexity you need to have read the spec from beginning to end at least twice, and understand the purpose of every bit in every register.

    I didn't look at the driver API to see how much they abstracted the control details. Are you using the drivers, or writing your own.
  6. Dec 11, 2015 #5
    I am not using any drivers ,just writing my own,
    since orientation interrupt gets cleared automatically after about 50 ms so there is no need it to be latched,but yes the register INT_STATUS0 (0x09).shows the status of orientation change.
    Yes the temperature sensor is working fine.
    I run the self test ,and checked the data on each axis if there is any motion in any axis i wold get any alarm.
    So if there is any slow motion i would get the result that slow motion is detected,
    that status can also be checked by reading the register INT_STATUS0.

    the thing you said are general procedure that i tested,but if i want to check the orientation change ,how should i proceed according to you?
  7. Dec 11, 2015 #6


    User Avatar
    Gold Member

    I'm not entirely clear what your problem is. Is it "how do I do this with this module?, or "I am doing XYZ and getting the incorrect result".

    I have never used the module, so I would have to mess with it to figure out exactly what to do.

    You can read the orientation in register 09 since it always reflects the current orientation. Do you see that change when you change orientation?
  8. Dec 11, 2015 #7
    No,i do not see any change that is my question,why is there any problem of timing ?
  9. Dec 11, 2015 #8


    User Avatar
    Gold Member

    Register 0C (I mistakenly said 09) is supposed to always contain the orientation. If it has values and they change with orientation, then there is something wrong with your threshold or interrupt settings. Do you see 0C change with orientation. If so, the chip is working and you need to determine the interrupt settings.

    If the values in 0C do not change, maybe you have the axis disabled (0x16)

    Since the orientation interrupt is cleared after 1 stable period of the value in 0C, maybe you are missing it. I don't see how to set the period.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook