PT100 with XFW-HX711

I got a spare PT100 around and given that is getting cold here I wanted to know the temperature at night while I am sleeping. First I thought it would be easy to use with the ADC of any board, but then I realized that typical analog channels are not that good. Fist I tried with a 10 bits ADC and resolution was not enough with a simple voltage divider set-up, unless I used a low programming resistance that I assumed was producing self-heating in the PT100 at 10mA. Then I used a 14 bits ADC and it was so noisy it was useless, even with a capacitor and numerical smoothing. Then I remembered I had some XFW-HX711 modules around from a load cell project, which are 24 bits, and surprisingly turned out to work well for the job.
image
The wiring is simple as in the figure and it was connected to a Arduino Uno. The voltage getting to the HX711 was not optimal, around 4.65 V, so the excitation voltage E+ is not very stable, but it works anyways. I used the gain equal to 64. It should have worked with the 128 gain but it seems the offset was high. To get the offset I set the scaling factor to 1, then shorted A+ with A-, and recorded the number, which was far from the expected 2^23-1. Then I used a known fixed resistor of 120 Ohm to calibrate the resistance measurement. Finally I connected the PT100. Unfortunately my PT100 class B was not well calibrated, with an offset of about 1 Ohm (as per my multitester). So I had to resort to a 2 point calibration with melting glass and boiling water. I used Olav Kallhovd's HX711_ADC library to communicate with the ADC. The HX711 has excellent noise features.

1 Like


And there is the board.

The HX711 is designed for a Wheatstone bridge input, which is easy to make with a PT100 and 3x100 Ohm precision resistors.

That kind of Wheatstone bridge would produce an exceedingly high current through the PT100 and the HX711.

1 Like

No. The HX711 is designed to be used with an external pass transistor for bridge current.

hi, could you please send me your code? i have some problems,thank you

1 Like

Here it is, you must set HX711_dout and HX711_sck according to your settings, and calculate C1 and C2 by a suitable calibration.

#include <HX711_ADC.h>
#define offst 8389853.16
#define C1 2.5541748E-05
#define C2  4.26637378
#define  p1  2.9248E-09
#define  p2  -1.3962E-06
#define  p3  0.0013477
#define  p4  2.3141
#define  p5  -243.85

const int HX711_dout = 12; //mcu > HX711 dout pin
const int HX711_sck = 13; //mcu > HX711 sck pin


HX711_ADC LoadCell(HX711_dout, HX711_sck);
unsigned long t = 0;

void setup() {
  Serial.begin(57600); delay(10);
  Serial.println();
  Serial.println("Starting...");

  LoadCell.begin();
  float calibrationValue; 
  calibrationValue = 1.0; 


  LoadCell.setGain(64);
  unsigned long stabilizingtime = 2000; 
  boolean _tare = false; 
  LoadCell.start(stabilizingtime, _tare);
  if (LoadCell.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
    while (1);
  }
  else {
    LoadCell.setCalFactor(calibrationValue); 
    Serial.println("Startup is complete");
  }
}

void loop() {
  static boolean newDataReady = 0;
  const int serialPrintInterval = 1000; 
  float R;
  float T;


  if (LoadCell.update()) newDataReady = true;

  if (newDataReady) {
    if (millis() > t + serialPrintInterval) {
      
      float i = LoadCell.getData();  //ADC value
      R=(i-offst)*C1+C2;  //resistance calibration
      T = p1*pow(R,4) + p2*pow(R,3) + p3*pow(R,2) + p4*R +p5; //T(R) parametrization
      Serial.print("ADC: ");
      Serial.print(i);
      Serial.print(" ");
      Serial.print("Cal Resistance: ");
      Serial.print(R,4);
      Serial.print(" ");
      Serial.print("Temp: ");
      Serial.println(T);
      newDataReady = 0;
      t = millis();
    }
  }


  if (Serial.available() > 0) {
    char inByte = Serial.read();
    if (inByte == 't') LoadCell.tareNoDelay();
  }


  if (LoadCell.getTareStatus() == true) {
    Serial.println("Tare complete");
  }

}
1 Like

Just use a Ds18b20. - simple and accurate

thank you very much

1 Like

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