Max31865 on Raspberry Pi setup

流过昼夜 提交于 2019-12-11 14:22:01

问题


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.


回答1:


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




回答2:


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:


来源:https://stackoverflow.com/questions/44931935/max31865-on-raspberry-pi-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!