LIS3DH Asset tracker

Hi All,

I am using Particle asset tracker and i use the accelerometer example from the library, it works fine, however the reading i got using ubidots (t.readXYZmagnitude) is around 8000 when i place the box in horizontal way and no vibration at all, i need to know whats this value in terms of g, how to convert and present this value as g force.

thank you

The LIS3DH returns a 16-bit two’s complement value (-32768 to 32767).

The value is relative to the sensitivity, which can be 2G, 4G, 8G, or 16G. The hardware defaults to 2G, however the AssetTracker library overrides this to be 4G by default.

In the default 4G setting, 32767 should be +4G, so 8000 seems about right for the effect of gravity.

The LIS3DH does not have automatic gravity compensation using a gyroscope, so if you have the possibility of setting it down angled, you will run into difficulties.

Thanks rickkas7, this is really valuable information. so 8000 equivalent to +4G? to me that is high, i get confused.

i want to use the LIS3DH to measure the machine vibration in g so I am not sure now if that can be done.

No, 32767 = 4G, so I’d expect the natural force of gravity 1G to be 8191. But the LIS3DH isn’t that precise, so 8000 would not be unexpected.

3 Likes

yea i got you now , thank you very much,

do you know how to use the 16g instead of 4G in asset tracker?

The method is not exposed, but if you copy AssetTracker.cpp and .h directly into your project, change this:

void AssetTracker::begin() {
    accel.begin(LIS3DH_DEFAULT_ADDRESS);

    // Default to 5kHz low-power sampling
    accel.setDataRate(LIS3DH_DATARATE_LOWPOWER_5KHZ);

    // Default to 4 gravities range
    accel.setRange(LIS3DH_RANGE_4_G);
1 Like

Just in general, it’s a safe bet that whatever value it reads when it’s sitting still, flat on an axis, is 1G.

1 Like

Thank you :slight_smile: