# Correct the values of a measurement

**URL:** <https://discourse.nodered.org/t/correct-the-values-of-a-measurement/29045>\
**Category:** General\
**Created:** [26 June 2020 20:45 UTC](https://discourse.nodered.org/t/correct-the-values-of-a-measurement/29045 "2020-06-26T20:45:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![volker1078](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/volker1078/32/19735_2.png) [@volker1078](https://discourse.nodered.org/u/volker1078)\
**Post date:** [26 June 2020 20:45 UTC](https://discourse.nodered.org/t/correct-the-values-of-a-measurement/29045/1 "2020-06-26T20:45:23Z")

</div>

Hello,

I built a measuring device with which I can measure the insulation in MOhm. Up to a value of 10MOhm, the device is very precise, the only way to make it more and more inaccurate. from a measured value of 10, the measured value deviates more and more from the real value.

I set up a series of measurements with the deviation in percent.

| real value | measured value | Deviation in percent % |
| --- | --- | --- |
| 0 | 0 | 0 |
| 1 | 1 | 0,0 |
| 4,8 | 4,8 | 0,0 |
| 10 | 10 | 0,0 |
| 11 | 10,9 | -0,9 |
| 14,8 | 14,3 | -3,4 |
| 50 | 45,7 | -8,6 |
| 60 | 50 | -16,7 |
| 100 | 81,2 | -18,8 |
| 110 | 84,4 | -23,3 |
| 150 | 110 | -26,7 |
| 200 | 130 | -35,0 |

Is it possible to correct the value with Node red so that I can not only measure exactly up to 10 but up to 200?

Greetings Volker

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 June 2020 20:57 UTC](https://discourse.nodered.org/t/correct-the-values-of-a-measurement/29045/2 "2020-06-26T20:57:24Z")

</div>

plotting them on a chart I can see that the deviation is not changing linearly

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/d/9d3f91eed3a8b581c11d81cd640c76e7fdf1e869.png)  
so the simple range node we have may help but will not be accurate.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 June 2020 21:28 UTC](https://discourse.nodered.org/t/correct-the-values-of-a-measurement/29045/3 "2020-06-26T21:28:45Z")

</div>

The simplest way might be to fit it to maybe three straight line segments, then use the measured value to determine which segment to use.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 June 2020 06:09 UTC](https://discourse.nodered.org/t/correct-the-values-of-a-measurement/29045/4 "2020-06-27T06:09:32Z")

</div>

This looks like it should do the job [https://flows.nodered.org/node/node-red-contrib-interpolate](https://flows.nodered.org/node/node-red-contrib-interpolate)  
Use as many line segments as you need to get the best fit.

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [27 June 2020 09:19 UTC](https://discourse.nodered.org/t/correct-the-values-of-a-measurement/29045/5 "2020-06-27T09:19:49Z")

</div>

Taking either the plot from @dceejay or using the raw data, you could likely work out a good fit to the error curve, and use that to correct your values.

If possible though, it might be better to work out why the values are inaccurate and to make some design changes to improve them. Are the errors due to limitations of your underlying sensor, or the circuitry around it?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 June 2020 10:01 UTC](https://discourse.nodered.org/t/correct-the-values-of-a-measurement/29045/6 "2020-06-27T10:01:53Z")

</div>

Yes, I was going to suggest that, or considering the design and working out what mathematical formula the error actually is, then using that knowledge to correct the measurements in software.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 August 2020 10:09 UTC](https://discourse.nodered.org/t/correct-the-values-of-a-measurement/29045/7 "2020-08-26T10:09:54Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
