# What's the formula Kenneth?

Hi, I’ve been testing temperature sensors against a reference sensor, found I need to apply calibration gain and offset to correct for differences in the external electronics.
However, based on multiple measurements at different temperatures, it’s not clear how the values entered into either PAC Control Basic or groov Manage IO units are applied to the raw voltages sampled on the analogue input cards to get the final Temperature displayed/used in my chart. The Temp Sensor spec: Linear + 10 mV/°C Scale Factor.
SensorScaling set is: (goal is to read process temps from 0-115 degC).
Actual → Scaled
mV → C
0 → 0
1200 → 120, on a +/- 1200mV input card.

I expected: T = (m * Vin) + c, where:

m is (SensorScale * CalibrationGain)
c is the offset, ie:
Tcorrected = [(1degC/10mV) * Vin * CalibrationGain] + CalibrationOffset
= [100 * CalibrationGain * Vin] + CalibrationOffset.
, but this doesn’t work out, maybe CalibrationOffset is scaled as well, but by what ?

If I measure a voltage at the input with a DMM, what formula do I use to calculate the T shown by PAC debug/groov Manage/used in the chart ?

1 Like

EPIC or RIO?

I will get the appropriate engineer(s) to take a look at this one… but just had to comment about your topic title… Not many would get the reference and it made my bald Aussie geek heart smile.

1 Like

The hardware:
Brains: 1 GRV-EPIC-PR1(GRV-EPIC-PR1)
2 GRV-ITMI-8
1 GRV-IVI-12
The ITMI-8 are used to read temperatures, the IVI-12 pressures, so if I could please get an answer for both those module types, as offset only calibration doesn’t seem to fit my application.
As the information doesn’t seem to be in the manual / kb, perhaps the findings could be placed in a KB entry for all hardware that supports similar calibration parameters, including any differences between modules ?

I also liked the title of this post and got the reference.

2 Likes

Ok, Im working on the answer, but meanwhile…Off topic (sort of) @grant1 How in the world did you come to know that song?

@beno I assumed it was a play on the REM song by a similar name. But maybe there is another song with that exact title?

2 Likes

REM, 1994, which means we may be well old.

1 Like

Not ‘may well be old’, but we is old!

Ok, so I think what threw me was your formula in the first post…
I got tangled up in it rather than reading and understanding that you clearly stated…

Once I stopped fretting over the formula it all came together pretty smoothly.

There are two places to enter scaling.

1. PAC Control.
2. groov Mange.

Of course, since there are two places, there is a wrinkle…

PAC Control will over write the scaling in groov Mange, but we do give a check box option to use the groov Manage offset and gain rather than the PAC Control one.
Lets take a screenshot…

Its not perfect since one is a RIO and the other is an EPIC, but its close enough in regards to talking about the scaling, offset and gain.

Since your temperature sensor is linear, we can do a two point line.
0mv is 0C and 1200mV is 120C. And you are looking for a range of 0 to 115C

So we just have to set the analog input card scaling to match. The GRV-ITMI-8 is bipolar. We are going to use the range of ±1200.0mV (Since we can’t clamp the lower at 0v, we need the scaling ‘curve’ to go through zero).
So we really should set the lower to be -1200mV to be -120C and the upper 1200mV to be 120C
In this way, if the temp does goes -0.1 or over 115C, its not a problem.

I have done this in groov Manage and PAC Control in the screenshot.

The important thing to note is that PAC Control will, on download and strategy run, overwrite groov Manage scaling with its.
You don’t have an option here, it will blow away any scaling you set up in groov Manage. (And the name and the channel type).

Now if you need to tweak things a tiny bit to get the temperature dead nuts on, you can use the gain and offset.
In this case, see there is a check box in the PAC Control, if you don’t check it, you can use the offset and gain in groov Manage, if you do check it, what you put in PAC Control will over write whats in groov Manage. So in the case of the screen shot, once I download and run, 8 and 1 would be sent and over write the 0 and 1.

If your pressure gauge is linear, same setup with the GRV-IVI-12.

@grant1 You got it, I guess I did not think the song was as big over here as in Australia, the link you included put me straight, it was a big hit everywhere.

@david.timms KB’s are for bugs, not ‘how to’ stuff. But, I am going to talk to the doc people since they do point to doing the offset and gain in PAC Manager which is not an option with EPIC and it needs to be clearer in the PAC Control users guide and in the PAC Manager users guide.

1 Like

Thanks for the explanation Beno, and I think my coarse scaling is fine, and I understand it. I’m trying to take into account the difference in readings from different temperature sensors (spec linearity is 0.9 to 1.1 times ideal linearity) with different electronic paths to the EPIC IO unit.

For gain: if the sensor readings line has higher gradient (>1) than the course scaling, then I’m assuming I need to set gain < 1 to bring the combined result of (sensor and electronic path) back to 1. So I’m guessing to use 1/m: the gradient of the line of best fit for uncalibrated values as read by the EPIC ?

For offset: is the entered value in volts, degrees, etc ? And is the offset result affected by either the coarse scaling, gain, or which type of input module I’m using ?

Offset should be entered in volts and will be added (or subtracted) before scaling is applied, and you’re right, it will depend on the input module you’re using. For example an offset on a GRV-IV-24 module should be ±8V.

Thinks torchard, I’m guessing you’ve found this from having to do this yourself
If that’s the case, sounds like the calculation would be:

Tcorrected = [Scale * CalibrationGain] * [Vin + CalibrationOffset (Volts)]

So, I should be able to measure a voltage Vin on the module, perform the above, and see the same value showing as my (10Hz read) IVal in debug or my PAC control chart/subroutine ?

I haven’t tested that exact formula, but yes, that looks right to me.
Please do let us know if that does (or doesn’t) work as expected for you!