# Digital Ruler / Linear Displacement Sensor

**URL:** <https://discourse.nodered.org/t/digital-ruler-linear-displacement-sensor/18140>\
**Category:** General\
**Created:** [19 November 2019 10:11 UTC](https://discourse.nodered.org/t/digital-ruler-linear-displacement-sensor/18140 "2019-11-19T10:11:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![agoralive](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/agoralive/32/14407_2.png) [@agoralive](https://discourse.nodered.org/u/agoralive)\
**Post date:** [19 November 2019 10:11 UTC](https://discourse.nodered.org/t/digital-ruler-linear-displacement-sensor/18140/1 "2019-11-19T10:11:43Z")

</div>

For a long time Node-Red has been my friends, as things seems to be SO EASY, but I have learned my lesson ☹

I have bought a Linear Displacement Sensor, and I am able to the readings that I need, but now I want to compare measurements, and this is where I have problems.

I would like to be able to measure and compare the distance between the sensor and the object over time. ie, in x minutes how far did the object go....

From SerialIn I have the distance, and this I would like to be "calibrated" into a relative 0/zero, but how do I check the distance between the current measurement and the "calibrated 0/zero"?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [19 November 2019 10:28 UTC](https://discourse.nodered.org/t/digital-ruler-linear-displacement-sensor/18140/2 "2019-11-19T10:28:46Z")

</div>

Store the calibrated value in a Flow or Global variable and subtract this value from the actual value.
