cancel
Showing results for 
Search instead for 
Did you mean: 

LSM9DS0 axis orientation and readings

carmixdev
Associate
Posted on August 24, 2014 at 10:44

Hi, I'm trying to understand the readings I got for a LSM9DS0 on my board. If I hold the board on my desk, according to the datasheet I should read a negative value for the Z-AXIS, because Z-AXIS vector points up,  instead I read a positive 1g value.

The same happens with the other two axes.

Are all the readings inverted? Or am I wrong with something?
3 REPLIES 3
marcohartung9
Associate
Posted on July 29, 2015 at 11:13

Hello,

are you using the linux driver?

If yes you must play with the init data:

#if defined(CONFIG_LSM9DS0)

static struct lsm9ds0_acc_platform_data lsm9ds0_acc_data = {

   .fs_range = LSM9DS0_ACC_FS_2G,

   .rot_matrix = {

      {1, 0, 0},

      {0, 1, 0},

      {0, 0, 1},

   },

   .poll_interval = 500,

   .min_interval = LSM9DS0_ACC_MIN_POLL_PERIOD_MS,

   .aa_filter_bandwidth = ANTI_ALIASING_773,

   .gpio_int1 = 149,

   .gpio_int2 = 151,

};

static struct lsm9ds0_mag_platform_data lsm9ds0_mag_data = {

   .poll_interval = 500,

   .min_interval = LSM9DS0_MAG_MIN_POLL_PERIOD_MS,

   .fs_range = LSM9DS0_MAG_FS_2G,

   .rot_matrix = {

      {1, 0, 0},

      {0, 1, 0},

      {0, 0, 1},

   },

};

static struct lsm9ds0_gyr_platform_data lsm9ds0_gyr_data = {

   .poll_interval =  500,

   .min_interval = LSM9DS0_GYR_MIN_POLL_PERIOD_MS, /* 2ms */

   .fs_range = LSM9DS0_GYR_FS_250DPS,

   /* gpio ports for interrupt pads */

   .gpio_int1 = 152,

   .gpio_int2 = 153,    /* int for fifo */

   .axis_map_x = 0,

   .axis_map_y = 1,

   .axis_map_z = 2,

   .negate_x = 0,

   .negate_y = 0,

   .negate_z = 0,

};

static struct lsm9ds0_main_platform_data lsm9ds0_acc_mag_data = {

   .pdata_acc = &lsm9ds0_acc_data,

   .pdata_mag = &lsm9ds0_mag_data,

};

#endif /* CONFIG_LSM9DS0 */

oyvind2
Associate II
Posted on July 29, 2015 at 15:32

I think you've misunderstood something. 

The accelerometer measures acceleration relative to the free fall reference frame. That is, if the accelerometer had been in free fall, you would measure zero acceleration. Relative to this, the accelerometer is accelerating upwards at a rate of 1 g when it is flat on your desk.. Therefore you will read +1 g.