Adafruit MAX31865 Arduino Library
Public Member Functions | List of all members
Adafruit_MAX31865 Class Reference

#include <Adafruit_MAX31865.h>

Public Member Functions

 Adafruit_MAX31865 (int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk)
 Create the interface object using software (bitbang) SPI. More...
 
 Adafruit_MAX31865 (int8_t spi_cs, SPIClass *theSPI=&SPI)
 Create the interface object using hardware SPI. More...
 
bool begin (max31865_numwires_t x=MAX31865_2WIRE)
 Initialize the SPI interface and set the number of RTD wires used. More...
 
uint8_t readFault (max31865_fault_cycle_t fault_cycle=MAX31865_FAULT_AUTO)
 Read the raw 8-bit FAULTSTAT register. More...
 
void clearFault (void)
 Clear all faults in FAULTSTAT.
 
uint16_t readRTD ()
 Read the raw 16-bit value from the RTD_REG in one shot mode. More...
 
void setThresholds (uint16_t lower, uint16_t upper)
 Write the lower and upper values into the threshold fault register to values as returned by readRTD() More...
 
uint16_t getLowerThreshold (void)
 Read the raw 16-bit lower threshold value. More...
 
uint16_t getUpperThreshold (void)
 Read the raw 16-bit lower threshold value. More...
 
void setWires (max31865_numwires_t wires)
 How many wires we have in our RTD setup, can be MAX31865_2WIRE, MAX31865_3WIRE, or MAX31865_4WIRE. More...
 
void autoConvert (bool b)
 Whether we want to have continuous conversions (50/60 Hz) More...
 
void enable50Hz (bool b)
 Whether we want filter out 50Hz noise or 60Hz noise. More...
 
void enableBias (bool b)
 Enable the bias voltage on the RTD sensor. More...
 
float temperature (float RTDnominal, float refResistor)
 Read the temperature in C from the RTD through calculation of the resistance. Uses http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf technique. More...
 
float calculateTemperature (uint16_t RTDraw, float RTDnominal, float refResistor)
 Calculate the temperature in C from the RTD through calculation of the resistance. Uses http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf technique. More...
 

Detailed Description

Interface class for the MAX31865 RTD Sensor reader

Constructor & Destructor Documentation

◆ Adafruit_MAX31865() [1/2]

Adafruit_MAX31865::Adafruit_MAX31865 ( int8_t  spi_cs,
int8_t  spi_mosi,
int8_t  spi_miso,
int8_t  spi_clk 
)

Create the interface object using software (bitbang) SPI.

Parameters
spi_csthe SPI CS pin to use
spi_mosithe SPI MOSI pin to use
spi_misothe SPI MISO pin to use
spi_clkthe SPI clock pin to use

◆ Adafruit_MAX31865() [2/2]

Adafruit_MAX31865::Adafruit_MAX31865 ( int8_t  spi_cs,
SPIClass *  theSPI = &SPI 
)

Create the interface object using hardware SPI.

Parameters
spi_csthe SPI chip select pin to use
theSPIthe SPI device to use, default is SPI

Member Function Documentation

◆ begin()

bool Adafruit_MAX31865::begin ( max31865_numwires_t  wires = MAX31865_2WIRE)

Initialize the SPI interface and set the number of RTD wires used.

Parameters
wiresThe number of wires in enum format. Can be MAX31865_2WIRE, MAX31865_3WIRE, or MAX31865_4WIRE
Returns
True

◆ readFault()

uint8_t Adafruit_MAX31865::readFault ( max31865_fault_cycle_t  fault_cycle = MAX31865_FAULT_AUTO)

Read the raw 8-bit FAULTSTAT register.

Parameters
fault_cycleThe fault cycle type to run. Can be MAX31865_FAULT_NONE, MAX31865_FAULT_AUTO, MAX31865_FAULT_MANUAL_RUN, or MAX31865_FAULT_MANUAL_FINISH
Returns
The raw unsigned 8-bit FAULT status register

◆ readRTD()

uint16_t Adafruit_MAX31865::readRTD ( void  )

Read the raw 16-bit value from the RTD_REG in one shot mode.

Returns
The raw unsigned 16-bit value, NOT temperature!

◆ setThresholds()

void Adafruit_MAX31865::setThresholds ( uint16_t  lower,
uint16_t  upper 
)

Write the lower and upper values into the threshold fault register to values as returned by readRTD()

Parameters
lowerraw lower threshold
upperraw upper threshold

◆ getLowerThreshold()

uint16_t Adafruit_MAX31865::getLowerThreshold ( void  )

Read the raw 16-bit lower threshold value.

Returns
The raw unsigned 16-bit value, NOT temperature!

◆ getUpperThreshold()

uint16_t Adafruit_MAX31865::getUpperThreshold ( void  )

Read the raw 16-bit lower threshold value.

Returns
The raw unsigned 16-bit value, NOT temperature!

◆ setWires()

void Adafruit_MAX31865::setWires ( max31865_numwires_t  wires)

How many wires we have in our RTD setup, can be MAX31865_2WIRE, MAX31865_3WIRE, or MAX31865_4WIRE.

Parameters
wiresThe number of wires in enum format

◆ autoConvert()

void Adafruit_MAX31865::autoConvert ( bool  b)

Whether we want to have continuous conversions (50/60 Hz)

Parameters
bIf true, auto conversion is enabled

◆ enable50Hz()

void Adafruit_MAX31865::enable50Hz ( bool  b)

Whether we want filter out 50Hz noise or 60Hz noise.

Parameters
bIf true, 50Hz noise is filtered, else 60Hz(default)

◆ enableBias()

void Adafruit_MAX31865::enableBias ( bool  b)

Enable the bias voltage on the RTD sensor.

Parameters
bIf true bias is enabled, else disabled

◆ temperature()

float Adafruit_MAX31865::temperature ( float  RTDnominal,
float  refResistor 
)

Read the temperature in C from the RTD through calculation of the resistance. Uses http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf technique.

Parameters
RTDnominalThe 'nominal' resistance of the RTD sensor, usually 100 or 1000
refResistorThe value of the matching reference resistor, usually 430 or 4300
Returns
Temperature in C

◆ calculateTemperature()

float Adafruit_MAX31865::calculateTemperature ( uint16_t  RTDraw,
float  RTDnominal,
float  refResistor 
)

Calculate the temperature in C from the RTD through calculation of the resistance. Uses http://www.analog.com/media/en/technical-documentation/application-notes/AN709_0.pdf technique.

Parameters
RTDrawThe raw 16-bit value from the RTD_REG
RTDnominalThe 'nominal' resistance of the RTD sensor, usually 100 or 1000
refResistorThe value of the matching reference resistor, usually 430 or 4300
Returns
Temperature in C

The documentation for this class was generated from the following files: