Temperature to pressure

I'm looking to be able to display the temperature from a sensor and at the same time display a corresponding result... for example if the temperature is 100 degrees C, then also display 0 Bar.... if the temperature is 101 degrees C then display 0.04 Bar ect.

There is no simple formula to covert the readings hence why it must be this way. I have looked at gas tables but it seems extremely difficult to convert temperature of steam to guage pressure in Bar.

Can anyone assist with how to do this?

Thanks in advance.

I am not sure what you are trying to do. Temperature and Pressure are 2 different things and if you want to measure each one of them you would need a temperature sensor and pressure sensor.

For gas, there is; see e.g. Relationship Between Pressure and Temperature - Pediaa.Com. But you did not say what you're measuring (gas or liquid).

Steam is a gas.

OOPS, missed that :frowning:

For "Ideal" gasses, pressure is proportional to absolute temperature in Kelvin.

However, steam is not an Ideal gas...

steam_chart

It looks close to being proportional to temperature. @Cbrenn0823 are you certain that assuming proportionality to temperature will not be accurate enough for your application? If not, perhaps the table on the page linked above can be used? For temperatures between those shown in the table, it might be actuate enough to use linear interpolation to find the pressure.

some reading

to your question, if you can't have a function that interpolates the curve for the relationship you have, then you could use a look up table

A lookup table as already mentioned. But once you have the mapping in a table, consider using Excel's solver (or similar) to see if it it can provide you a formula.

Just subtract 100 from the measured temperature. Note that the temperature must actually be in Kelvin.

The chart in post #6 is misleading due to an irregular spacing of points on the horizontal axis.

In fact, the curve is quite smooth and it should be easy to find a simple formula to very closely fit the data.

I'd use Excel's graph "trendline" feature to find the formula. A polynomial of relatively small order ought to give a satisfactory fit.

1 Like

Hi,
In the REAL world you use temperature sensor AND a pressure sensor.

What is the range of temperatures?
What is the range of pressures?
I assume you are talking gauge pressure and not absolute?

Is the steam pressure involved in a boiler pressure vessel?
How big is the vessel?

If you have a safety valve you would still be advised to have a proper gauge for pressure.

Why do you want to calculate pressure?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

1 Like

Hi,

You will develop pressure in a sealed container even as you increase temperature from well below 100 deg C.
I assume your vessel has an air gap between to surface of the water and the top of the vessel.

Tom... :smiley: :+1: :coffee: :australia:

NO.

Gay-Lussac's law states that the pressure of a given mass of gas varies directly with the absolute temperature of the gas when the volume is kept constant.

You cant just ignore those criteria and say P is propotional to T.

Nor its limitations: the law only applies when the conditions inside the closed container allow the contents to behave as an ideal gas.

As mentioned above, it's Gay-Lussac's Law, so I don't believe there's an easy formula.

I can get the figures I need one by one from this website:

I should explain this project..

It's to test the accuracy of the existing pressure guage fitted to a coffee boiler. Currently we can use an infrared handheld thermometer to measure the temperature of the shell of the boiler and compare it to a chart. The boilers only go to about the very maximum 3 bar, so i won't need 1000's of entry's.
In my project the sensor would be secured to the boiler and would then read the temperature and display the corresponding result from the table in 1 deg steps.
These boilers vary in volume and also working pressure.

I did find an excel spreadsheet for the gas law, however it used macros and such and did not seem simple at all.

Thanks

And Boyle-Mariotte is for constant temperature (1662)

In 1834 Émile Clapeyron came up with the formula
PV = nRTIdeal gas law - Wikipedia

Hi,

For any accuracy, remove it and get it professionally calibrated, buy a spare so you can swap them out to always have your machine working.

In fact a new gauge will already have a calibration certificate with it.
Look at the economics, using calculations like you want to, has too many variables, each having to be measured with the precision needed of your final calculated pressure.

I work for a company that does pressure calibration/certification, you need it to be checked by either another calibrated gauge or get its calibration measured professionally.

Tom... :smiley: :+1: :coffee: :australia:

1 Like

It's only a guide + or - 10% say.. it would not be viable to remove and bench calibrate each guage.
The process is already an approved method of testing.
Was just looking for assistance with the coding.
(If temperature = "x" then display "x" pressure)

I'll get back onto it later and hopefully work it out.

Sounds a bit iffy to me ..anyway ..

If you have your (temperature )v (pretend pressure) , put the values in a spreadsheet and then curve fit them . Use the curve fit equation in your code .

Okay so this is what I have so far.. I only have a few temperature refrences as yet, however when the temperature probe is less than 27 Deg C, it reads "Too Cold" correctly. However if the temp is above 27 Deg, then it just seems to freeze and even the temperatue does't vary unless it drops below 27 deg again. The serial print of the tep continues to work throughought.

I like the sound of a lookuo table, however I am totaly clueless as to how I would create it.

#include <LiquidCrystal_I2C.h>
#include <Adafruit_MAX31865.h>

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(10, 11, 12, 13);
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31865 thermo = Adafruit_MAX31865(10);

// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF      4300.0
// The 'nominal' 0-degrees-C resistance of the sensor
// 100.0 for PT100, 1000.0 for PT1000
#define RNOMINAL  1000.0
//#define buzzer 7           //buzzer pin

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x3F for a 16 chars and 2 line display

void setup() {
  Serial.begin(115200);
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
  lcd.init();
  lcd.clear();         
  lcd.backlight();      // Make sure backlight is on
  thermo.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary

  lcd.setCursor(1,0);   //Set cursor to character 1 on line 0
  lcd.print("Coffee Boiler");

  lcd.setCursor(2,1);   //Move cursor to character 2 on line 1
  lcd.print("Temperature");

  //delay(3000);

  lcd.clear();
  lcd.setCursor(2,0);   //Set cursor to character 2 on line 0
  lcd.print("To Pressure");

  lcd.setCursor(4,1);   //Move cursor to character 2 on line 1
  lcd.print("Sensor");

  delay(3000);
  }


void loop() {
  uint16_t rtd = thermo.readRTD();

  //Serial.print("RTD value: "); Serial.println(rtd);
  float ratio = rtd;
  ratio /= 32768;
  //Serial.print("Ratio = "); Serial.println(ratio,8);
  //Serial.print("Resistance = "); Serial.println(RREF*ratio,8);
  Serial.print("Temperature = "); Serial.println(thermo.temperature(RNOMINAL, RREF));

  delay(300);

  //Serial.print("Temperature = "); Serial.println(TempReading);


  //delay(3000);             //delay of 10 seconds
    if(thermo.temperature(RNOMINAL, RREF)<= 27){      
      lcd.clear();
      lcd.setCursor(0,0);     //Set cursor to character 2 on line 0
      lcd.print("Temp=  ");
      lcd.print(thermo.temperature(RNOMINAL, RREF));
      lcd.print((char)223);
      lcd.print(" C");
      lcd.setCursor(0,1);
      lcd.print("Too Cold");    //display warning message
      //digitalWrite(buzzer,HIGH); //turn on the buzzer
    }
    if(thermo.temperature(RNOMINAL, RREF)== 28){      
      //lcd.clear();
      lcd.setCursor(0,0);     //Set cursor to character 2 on line 0
      lcd.print("Temp=  ");
      lcd.print(thermo.temperature(RNOMINAL, RREF));
      lcd.print((char)223);
      lcd.print(" C");
      lcd.setCursor(0,1);
      lcd.print("Press= ");
      lcd.print("0.00");    //display warning message
      lcd.print("Bar g");
      //digitalWrite(buzzer,HIGH); //turn on the buzzer
    }
     if(thermo.temperature(RNOMINAL, RREF)== 29){      //check if temperature>30
      //lcd.clear();
      lcd.setCursor(0,0);     //Set cursor to character 2 on line 0
      lcd.print("Temp=  ");
      lcd.print(thermo.temperature(RNOMINAL, RREF));
      lcd.print((char)223);
      lcd.print(" C");
      lcd.setCursor(0,1);
      lcd.print("Press= ");
      lcd.print("1.00");    //display warning message
      lcd.print("Bar g");
      //digitalWrite(buzzer,HIGH); //turn on the buzzer
    }

  // Check and print any faults
  uint8_t fault = thermo.readFault();
  if (fault) {
    Serial.print("Fault 0x"); Serial.println(fault, HEX);
    if (fault & MAX31865_FAULT_HIGHTHRESH) {
      Serial.println("RTD High Threshold"); 
      lcd.clear();
      lcd.setCursor(0,0);   //Move cursor to character 2 on line 1
      lcd.print("RTD High Threshold");
    }
    if (fault & MAX31865_FAULT_LOWTHRESH) {
      Serial.println("RTD Low Threshold"); 
      lcd.clear();
      lcd.setCursor(0,0);   //Move cursor to character 2 on line 1
      lcd.print("RTD Low Threshold");
    }
    if (fault & MAX31865_FAULT_REFINLOW) {
      Serial.println("REFIN- > 0.85 x Bias"); 
      lcd.clear();
      lcd.setCursor(0,0);   //Move cursor to character 2 on line 1
      lcd.print("RTD Low Threshold");
    }
    if (fault & MAX31865_FAULT_REFINHIGH) {
      Serial.println("REFIN- < 0.85 x Bias - FORCE- open"); 
      lcd.clear();
      lcd.setCursor(0,0);   //Move cursor to character 2 on line 1
      lcd.print("REFIN- < 0.85 x Bias - FORCE- open");
    }
    if (fault & MAX31865_FAULT_RTDINLOW) {
      Serial.println("RTDIN- < 0.85 x Bias - FORCE- open"); 
      lcd.clear();
      lcd.setCursor(0,0);   //Move cursor to character 2 on line 1
      lcd.print("RTDIN- < 0.85 x Bias - FORCE- open");
    }
    if (fault & MAX31865_FAULT_OVUV) {
      Serial.println("Under/Over voltage"); 
      lcd.clear();
      lcd.setCursor(0,0);   //Move cursor to character 2 on line 1
      lcd.print("Under/Over voltage");
    }
    thermo.clearFault();
  }
  Serial.println();
  delay(2000);
}

Thermo.temperature returns a float, you're better off using < and > to test for a range rather than checking for exact numbers.