tobmag,
Unlike the temperature sensor, the pressure sensor is not calibrated in TunerStudio. Instead, you can either use the default response 'curve', or log the ADC directly (see:
http://www.msgpio.com/manuals/mshift/V22tune.html#gi) and convert it using a formula in TunerStudio.
For your example: 0bar= 0.5v and 20bar = 4.5 volt.
There are 1024 ADC count to cover 0.0 to 5.0 Volts. So:
0.5V = 0.5/5.0*1024 = 102 ADC counts, and
4.5V = 4.5/5.0*1024 = 922 ADC counts.
So the pairs we have are:
(102 counts, 0 Bar) and (922 counts, 20 Bar).
The slope is then:
m = rise/run = (20 - 0)/(922-102) = 20/820 = 0.0244 Bar/count
The y-intercept is:
b = y - mx = 20 - 0.0244*922 = 20 - 22.488 = -2.488 Bar (this is the theoretical pressure when the Voltage is zero (if everything was linear).
So the pressure (in Bars) from the ADC count is:
Pressure(Bar) = 0.0244*ADCcount - 2.488
Then in the [OutputChannels] section of the mainController.ini file, create a line (using a test editor like notepad or notepad++) near the end like this:
Code: Select all
LinePressBar = {(0.0244*linepressure) - 2.488}, "Bar" ; line pressure for custom sensor in bars
(linepressure is the ADC count IF you have selected that in the menu linked above)
You can then create a gauge, add it to the datalog, etc. The gauge entry in the [GaugeConfigurations] section should look something like this:
Code: Select all
LinePressBar = LinePressBar, "Line Pressure", "Bar", 0, 20, 2, 4, 18, 20, 0, 0
and the datalog entry should look like this:
Code: Select all
entry = LinePressBar, "line", int, "%d"
See the existing entries for more examples.
If you wanted the output to read in psi, you would change the 20 in the above example to the corresponding pressure in psi (~290).
Lance.