0

I'm pretty new to coding. I'm trying to read a PT100 rtd via my Raspberry Pi 3. I read that I needed the Max31865 RTD amplifier to properly read the data because the resistances are so small. I am fairly certain I have it plugged in correctly. I'm using this code, only slightly editted. https://github.com/steve71/MAX31865

I'm getting two different outputs so far but it doesn't seem to correlate with anything I'm changing (The byte associated with the readTemp mostly) since I've run the same code twice and gotten both outputs. The outputs are as follows:

config register byte: ff
RTD ADC Code: 32767
PT100 Resistance: 429.986877 ohms
Straight Line Approx. Temp: 767.968750 degC
Callendar-Van Dusen Temp (degC > 0): 988.792111 degC
high fault threshold: 32767
low fault threshold: 32767

and

config register byte: 08
RTD ADC Code: 0
PT100 Resistance: 0.000000 ohms
Straight Line Approx. Temp: -256.000000 degC
Callendar-Van Dusen Temp (degC > 0): -246.861024 degC
high fault threshold: 0
low fault threshold: 0

Any help would be appreciated.

Derek
  • 1
  • 1
  • 1
  • Hi and welcome to Stack Overflow, please take a time to go through the [welcome tour](https://stackoverflow.com/tour) to know your way around here (and also to earn your first badge), read how to create a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and also check [How to Ask Good Questions](https://stackoverflow.com/help/how-to-ask) so you increase your chances to get feedback and useful answers. – DarkCygnus Jul 05 '17 at 22:19
  • Did you ever get this to work? I see exactly the same behavior, using a 3-wire pt100 from Adafruit (with the 2 jumpers soldered correctly). I can never read any output from the max31865 that makes any sense. – Zach Mar 18 '18 at 17:15
  • I solved my problem - the code uses GPIO.setmode(GPIO.BCM) but I was using the "physical pin" numbering when connecting things. After changing to the correct numbering, I get correct temperature readings. – Zach Mar 19 '18 at 22:30

2 Answers2

2

I'am dealing exactly with the same issue right now. Do you use your Pt100 with 3- or 4-wires?

I fixed the problem by setting the correct configuration status register in Line 78 of the original code (https://github.com/steve71/MAX31865) to 0xA2

self.writeRegister(0, 0xA2)

I am using 4-wires, so i had to change bit4 from 1 (3-wires) to 0 (2- or 4-wires)

0xb10100010

After this, i've got this as output

config register byte: 80
RTD ADC Code: 8333
PT100 Resistance: 101.721191 ohms
Straight Line Approx. Temp: 4.406250 degC
Callendar-Van Dusen Temp (degC > 0): 4.406808 degC
high fault threshold: 32767
low fault threshold: 0

Brrr... it's very cold in my room, isn't it? To fix this, i had to change the reference resistance in Line 170 to 430 Ohm

R_REF = 430.0 # Reference Resistor

It's curious, because i red a lot of times, there is a 400 Ohm resistance mounted on this devices as the reference. Indeed, on the SMD resistor is a 3-digit Code "431" which means 430 Ohm. Humm...

But now i have it nice and warm in here

Callendar-Van Dusen Temp (degC > 0): 25.091629 degC

Best regards

  • I'm not getting any luck with 0xA2. I'm using a 2-wire RTD so I also changed bit4 to 0 (Is that right?). I've already changed the reference resistance to 430. – Derek Jul 05 '17 at 20:47
  • Yes thats right. According to the datasheet page no. 13, the bit4 = 0 stands for 2/4-wiring ([link](https://datasheets.maximintegrated.com/en/ds/MAX31865.pdf)). Did you soldered the two jumpers behind each "terminal block", where you connected your RTD to? (Or easily put some little wires from F+ to RTD+ and F- to RTD- respectively. (There are some explanations [link](https://learn.adafruit.com/adafruit-max31865-rtd-pt100-amplifier/rtd-wiring-and-config)). – Sebastian M Jul 06 '17 at 06:38
  • Yes, I soldered the jumpers. Followed the adafruit tutorial pretty much to the letter, then used the code from above. But can't seem to get it to work right still. I've used a bunch of different config reg values and still nothing. No rhyme or reason to the outputs I'm getting. – Derek Jul 06 '17 at 20:40
0

Did you get this resolved ? In case you didn't, the below python class method works for me. I remember that I had some trouble with wiring the force terminals, from memory for 2-wire you have to bridge both force terminals.

def _take_Resistance_Reading(self):
    msg = '%s: taking resistance reading...' % self.Name
    try:
        self.Logger.debug(msg + 'entered method take_resistance_Reading()')
        with self._RLock:
            reg = self.spi.readbytes(9)
            del reg[0]                      # delete 0th dummy data
            self.Logger.debug("%s: register values: %s", self.Name, reg)           
            RTDdata = reg[1] << 8 | reg[2]
            self.Logger.debug("%s: RTD data: %s", self.Name, hex(RTDdata))
            ADCcode = RTDdata >> 1
            self.Logger.debug("%s: ADC code: %s", self.Name, hex(ADCcode))
            self.Vout = ADCcode
            self._Resistance = round(ADCcode * self.Rref / 8192, 1)
            self.Logger.debug(msg + "success, Vout: %s, resistance: %s Ohm" % (self.Vout, self._Resistance))
            return True
    except Exception as e:
Blindfreddy
  • 622
  • 6
  • 12