Best way to convert accelerometer readings into distance


I currently have a device which is sending acceleration readings in X, Y and Z axes every 2ms.

I am looking to convert those readings into displacement. From looking around the internet, it seems like the best way to do this is by double integrating, so, I was wondering what would be the best way to implement double integration on this platform ?


@Tauras the best way to solve this is in the platform is almost certainly to use a Function Node; you’ll need to write your equation in JavaScript, referencing the x, y, and z values from your payload and storing the result on the payload as well. You can then save that result as a separate attribute on the same device that reported the raw readings using a Device State Node.

One other note: You said that these values are reporting every 2ms. Cloud-side, the platform will not be able to accept a state report that frequently (we limit to a max. of 2 per second) so you may need to do the calculation in the code on your device. However, if you are using our Gateway Edge Agent, you could accumulate those readings and execute workflows at your desired rate, and then report consolidated values up to the cloud on a lower frequency.