Arduino Code | Adafruit MAX31865 RTD PT100 Or PT1000 Amplifier
Maybe your like
- Overview
- Pinouts
- Assembly
- RTD Wiring & Config
- Arduino Code
- Python & CircuitPython
- Python Docs
- F.A.Q.
- Downloads
- Single page
- Feedback? Corrections?
- Text View
-
Adafruit PT100 RTD Temperature Sensor Amplifier - MAX31865 $14.95 Add to Cart -
Adafruit PT1000 RTD Temperature Sensor Amplifier - MAX31865 $14.95 Add to Cart -
Platinum RTD Sensor - PT100 - 3 Wire 1 meter long $11.95 Add to Cart -
Platinum RTD Sensor - PT1000 - 3 Wire 1 meter long $14.95 Add to Cart
Arduino Code
You can easily wire this breakout to any microcontroller, we'll be using an Arduino. For another kind of microcontroller, as long as you have 4 available pins it is possible to 'bit-bang SPI' or you can use hardware SPI if you like. Just check out the library, then port the code.
SPI Wiring Since this is a SPI-capable sensor, we can use hardware or 'software' SPI. To make wiring identical on all Arduinos, we'll begin with 'software' SPI. The following pins should be used:
- Connect Vin to the power supply, 3V or 5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
- Connect GND to common power/data ground
- Connect the CLK pin to Digital #13 but any pin can be used later
- Connect the SDO pin to Digital #12 but any pin can be used later
- Connect the SDI pin to Digital #11 but any pin can be used later
- Connect the CS pin Digital #10 but any pin can be used later
Later on, once we get it working, we can adjust the library to use hardware SPI if you desire, or change the pins to other
Download Adafruit_MAX31865 libraryTo begin reading sensor data, you will need to the Adafruit MAX31865 library from the Arduino library manager.
Open up the Arduino library manager:
Search for the Adafruit MAX31865 library and install it
We also have a great tutorial on Arduino library installation at:http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use
Attach PT100 or PT1000 RTDYou'll need to attach an RTD, for this demo we'll be using a 3-wire 1 meter long one but you can adjust the demo if you have a 2 or 4 wire. Check the RTD wiring page for the jumpers and wiring requirements!
Load Demo Open up File->Examples->Adafruit_MAX31865->max31865 and upload to your Arduino wired up to the sensor. Adjust the max.begin(MAX31865_3WIRE) line if necessary.
Upload to your Arduino and open up the serial console at 115200 baud to see a print out of the sensors data. The MAX31865 doesn't actually return the resistance it measures. Instead it returns the ratio between the resistance measured and the Rref reference resistor.
- For the PT100 version of the breakout, this is a 430 ohm 0.1% resistor (marking is 4300 !!!)
- For the PT1000 version of the breakout, this is a 4300 ohm 0.1% resistor (marking is 4301 !!!)
You can use that ratio to calculate the resistance and then determine the temperature
More Accuracy Our library is efficient and small and uses an algorithm to calculate temperature. While this works very well, it isn't as accurate as it could be. Check out this ITS-90 conforming library from DrHaney that uses a lookup table for better accuracy!
Library ReferenceYou can start out by creating a MAX31865 object with either software SPI (where all four pins can be any I/O) using
Download File Copy Code // Use software SPI: CS, DI, DO, CLK Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13); // Use software SPI: CS, DI, DO, CLK Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);Or you can use hardware SPI. With hardware SPI you must use the hardware SPI pins for your Arduino - and each arduino type has different pins! Check the SPI reference to see what pins to use.In this case, you can use any CS pin, but the other three pins are fixed
Download File Copy Code // use hardware SPI, just pass in the CS pin Adafruit_MAX31865 max = Adafruit_MAX31865(10); // use hardware SPI, just pass in the CS pin Adafruit_MAX31865 max = Adafruit_MAX31865(10);Once started, you can initialize the sensor with one of the following, depending on what kind of RTD you've got connected!
Download File Copy Code max.begin(MAX31865_2WIRE) max.begin(MAX31865_3WIRE) max.begin(MAX31865_4WIRE) max.begin(MAX31865_2WIRE) max.begin(MAX31865_3WIRE) max.begin(MAX31865_4WIRE)Reading Resistance
If you want to know the actual resistance (not temperature) you can do that fairly easily. You can read ratio from the MAX31865 with
Download File Copy Code max.readRTD() max.readRTD()This will give you the raw 16-bit unsigned value where 0xFFFF is '1.0 ratio'. Chances are you want to convert it to the resistance. We recommend this code:
Download File Copy Code 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("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);You'll need to define RREF - in this case its 430.0 for PT100 and 4300.0 for PT1000
Calculating Temperature
Once you have the resistance you can look up in an RTD table or use a calculation to do a best-fit approximation. We use the example from this app note: http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf
It's fast and seems to work very well! We have a one-stop function that does everything for you, just call:
Download File Copy Code max.temperature(100, RREF) max.temperature(100, RREF)Where the first argument is the resistance of the RTD at 0°C (for PT100 that's 100) and the second argument is the value of the reference resistor. This function returns the tempreature in °C
Faults
The MAX31865 has a wide-ranging fault mechanism that can alert you via pin or function when something is amiss. Don't forget to test this functionality before relying on it!
You can read faults with
Download File Copy Code max.readFault() max.readFault()Which will return a uint8_t type with bits set for each of 6 different fault types. You can test for each one with this set of code:
Download File Copy Code // Check and print any faults uint8_t fault = max.readFault(); if (fault) { Serial.print("Fault 0x"); Serial.println(fault, HEX); if (fault & MAX31865_FAULT_HIGHTHRESH) { Serial.println("RTD High Threshold"); } if (fault & MAX31865_FAULT_LOWTHRESH) { Serial.println("RTD Low Threshold"); } if (fault & MAX31865_FAULT_REFINLOW) { Serial.println("REFIN- > 0.85 x Bias"); } if (fault & MAX31865_FAULT_REFINHIGH) { Serial.println("REFIN- < 0.85 x Bias - FORCE- open"); } if (fault & MAX31865_FAULT_RTDINLOW) { Serial.println("RTDIN- < 0.85 x Bias - FORCE- open"); } if (fault & MAX31865_FAULT_OVUV) { Serial.println("Under/Over voltage"); } max.clearFault(); } // Check and print any faults uint8_t fault = max.readFault(); if (fault) { Serial.print("Fault 0x"); Serial.println(fault, HEX); if (fault & MAX31865_FAULT_HIGHTHRESH) { Serial.println("RTD High Threshold"); } if (fault & MAX31865_FAULT_LOWTHRESH) { Serial.println("RTD Low Threshold"); } if (fault & MAX31865_FAULT_REFINLOW) { Serial.println("REFIN- > 0.85 x Bias"); } if (fault & MAX31865_FAULT_REFINHIGH) { Serial.println("REFIN- < 0.85 x Bias - FORCE- open"); } if (fault & MAX31865_FAULT_RTDINLOW) { Serial.println("RTDIN- < 0.85 x Bias - FORCE- open"); } if (fault & MAX31865_FAULT_OVUV) { Serial.println("Under/Over voltage"); } max.clearFault(); }In particular, the last four are ones that indicate a hardware failure. The first two are threshold faults, we don't have code for setting those thresholds at this time.
Page last edited March 08, 2024
Text editor powered by tinymce.
RTD Wiring & Config Python & CircuitPython Related Guides Adafruit MIDI FeatherWing By Kattni Rembor beginner Adafruit Metro M7 1011 with AirLift By lady ada beginner Adafruit DRV2605L Haptic Controller Breakout By lady ada beginner Monitor Your Home With the Raspberry Pi B+ By M. Schwartz intermediate Adafruit SHT31-D Temperature & Humidity Sensor Breakout By lady ada intermediate Adafruit DACx578 - 8 x Channel I2C DAC By Liz Clark beginner Adafruit SPI Flash SD Card By Kattni Rembor beginner Adafruit microSD Card BFF By Liz Clark beginner Adafruit LSM9DS1 Accelerometer + Gyro + Magnetometer... By lady ada intermediate TMP006 Infrared Sensor Breakout By Bill Earl beginner Adafruit Metro RP2040 By Kattni Rembor beginner Analog Devices ADT7410 Breakout By Brent Rubell beginner Adafruit TMC2209 Stepper Motor Driver Breakout Board By Tim C beginner Thermistor By lady ada intermediate Adafruit SHT4x Trinkey By Liz Clark beginnerCreate Wishlist
× Title Description Close Search SearchCategories
Tag » Arduino Pt1000 Temperature Sensor
-
How To Connect A PT1000 Temperature Sensor To Arduino Nano
-
Amplifier For PT1000 Temperature Sensor - Arduino Forum
-
Calibrating A PT1000 RTD Sensor - Arduino Forum
-
PT1000 Temperature Sensor Code - Arduino Forum
-
PT1000 Converter For Arduino - AEQ-WEB
-
How To Use RTD Sensor ( PT100 With Arduino Tutorial ) - YouTube
-
Measuring Temperature From PT100 Using Arduino - Instructables
-
Temperature Sensor Interfacing With Arduino Project
-
Results For Arduino Temperature Sensor Pt1000 - AliExpress
-
Getting Started With High Precision Temperature Sensing - Digikey
-
Comidox 1PCS MAX31865 PT100/PT1000 RTD Temperature ...
-
DC 3V-5V MAX31865 SPI PT100 To PT1000 RTD Converter Board ...
-
Results For Arduino Pt1000 Sensor - AliExpress
Adafruit MIDI FeatherWing By
Adafruit Metro M7 1011 with AirLift By
Adafruit DRV2605L Haptic Controller Breakout By
Monitor Your Home With the Raspberry Pi B+ By
Adafruit SHT31-D Temperature & Humidity Sensor Breakout By
Adafruit DACx578 - 8 x Channel I2C DAC By
Adafruit SPI Flash SD Card By
Adafruit microSD Card BFF By
Adafruit LSM9DS1 Accelerometer + Gyro + Magnetometer... By
TMP006 Infrared Sensor Breakout By
Adafruit Metro RP2040 By
Analog Devices ADT7410 Breakout By
Adafruit TMC2209 Stepper Motor Driver Breakout Board By
Thermistor By
Adafruit SHT4x Trinkey By