# LIS3DH Asset tracker

**URL:** <https://community.particle.io/t/lis3dh-asset-tracker/42291>\
**Category:** General\
**Created:** [June 6, 2018, 3:25pm UTC](https://community.particle.io/t/lis3dh-asset-tracker/42291 "2018-06-06T15:25:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![majj\_11](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/majj_11/32/21851_2.png) [@majj\_11](https://community.particle.io/u/majj_11)\
**Post date:** [June 6, 2018, 3:25pm UTC](https://community.particle.io/t/lis3dh-asset-tracker/42291/1 "2018-06-06T15:25:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [June 6, 2018, 3:43pm UTC](https://community.particle.io/t/lis3dh-asset-tracker/42291/2 "2018-06-06T15:43:15Z")

</div>

The LIS3DH returns a 16-bit [two’s complement](https://en.wikipedia.org/wiki/Two%27s_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.

---

<div class="post-metadata">

**Author:** ![majj\_11](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/majj_11/32/21851_2.png) [@majj\_11](https://community.particle.io/u/majj_11)\
**Post date:** [June 6, 2018, 3:47pm UTC](https://community.particle.io/t/lis3dh-asset-tracker/42291/3 "2018-06-06T15:47:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [June 6, 2018, 3:50pm UTC](https://community.particle.io/t/lis3dh-asset-tracker/42291/4 "2018-06-06T15:50:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![majj\_11](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/majj_11/32/21851_2.png) [@majj\_11](https://community.particle.io/u/majj_11)\
**Post date:** [June 6, 2018, 3:57pm UTC](https://community.particle.io/t/lis3dh-asset-tracker/42291/5 "2018-06-06T15:57:44Z")

</div>

yea i got you now , thank you very much,

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

---

<div class="post-metadata">

**Author:** ![rickkas7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rickkas7/32/8681_2.png) [@rickkas7](https://community.particle.io/u/rickkas7)\
**Post date:** [June 6, 2018, 4:03pm UTC](https://community.particle.io/t/lis3dh-asset-tracker/42291/6 "2018-06-06T16:03:11Z")

</div>

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

```auto
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);

```

---

<div class="post-metadata">

**Author:** ![HEng](https://avatars.discourse-cdn.com/v4/letter/h/c77e96/32.png) [@HEng](https://community.particle.io/u/HEng)\
**Post date:** [June 7, 2018, 3:41am UTC](https://community.particle.io/t/lis3dh-asset-tracker/42291/7 "2018-06-07T03:41:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![majj\_11](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/majj_11/32/21851_2.png) [@majj\_11](https://community.particle.io/u/majj_11)\
**Post date:** [June 7, 2018, 3:41pm UTC](https://community.particle.io/t/lis3dh-asset-tracker/42291/8 "2018-06-07T15:41:21Z")

</div>

Thank you 🙂
