Git Product home page Git Product logo

adafruit_max31865's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_max31865's Issues

Example not working on Arduino Nano RP2040 Connect

I wanted to move my project from the Nano Every to the Nano Connect. I used the example from the library, on the Nano every where everything works as expected. On the Nano RP2040 Connect, however, it prints the values as nothing is connectec:

RTD value: 0
Ratio = 0.00000000
Resistance = 0.00000000
Temperature = -242.02

Regarding to this post, it has probably something to do with the SPI settings:
https://forum.arduino.cc/t/nano-rp2040-connect-not-showing-as-a-device-under-ports/864686/18?page=2

Does someone know if it is possible to use the library on the Nano RP2040 Connect?

Thanks in advance!

Cheers
Paul

Using Adafruit Feather M0 with RFM95 LoRa Radio

I am totally stumped as to why I'm unable to get this module to work with a M0. I can take the same module move it back to Arduino Uno and it works fine. I'm using the standard example and changing
Adafruit_MAX31865 max = Adafruit_MAX31865(10, 11, 12, 13);
to
Adafruit_MAX31865 max = Adafruit_MAX31865(12,23,22,24);

Unfortunately, I get this:

RTD value: 0 Ratio = 0.00000000 Resistance = 0.00000000 Temperature = -242.02

max31865_featherm0

I also tried swapping pin 23 & 22 incase I misunderstood the MOSI MISO stuff.

Adafruit_MAX31865 library does not work with software SPI

MAX31865 library with software SPI does not work properly and false data is generated with the example sketch max31865.ino

Work around:

  1. Use hardware SPI only
  2. Replace the read and write functions of the MAX31865 class library by using the corresponding calls to SPI.h

minor issue:
after Serial.begin(115200); a delay of approx. 1000 should be added to allow for settling time of the serial port connection.

Adafruit_MAX31865::Begin does not initiate the "Fault Detection Cycle"

According to the MAX31865 data sheet (page 14) a manual or automatic fault detection cycle must be run at startup.
Without that the startup of the MAX31865 behaves arbitrarily and can prevent data reading, which in occurred to me at every second boot cycle.

I solved this issue by adding the following code at the beginning of my local copy of Adafruit_MAX31865::Begin to enable "Automatic fault detection":

#define MAX31865_CONFIG_AUTO_FAULT_DETECT 0b10010101
uint8_t t = readRegister8(MAX31856_CONFIG_REG);
t |= MAX31865_CONFIG_AUTO_FAULT_DETECT;
writeRegister8(MAX31856_CONFIG_REG, t);

I recommend to extend the begin function accordingly by defining a new "Fault detection" function, ideally configurable for automatic or manual fault detection.

MAX31865.pdf

how can I swich spi mode?

I have multiple max9814 thermo module and other adc module.
thing is that max31865 use SPI_MODE_1 but other adc module use SPI_MODE_0.

so how can I set spi mode to 1/0, everytime I want to switch SPI slave?

I can only see that can set spi mode on begin() function.

Intermittent wrong results since V1.2.1

In my project I am using 6 MAX31865 boards on an ESP32 TTGO T1 for temperature measurements.
The IDE I am using is Arduino 1.8.12.
After updating Adafruit_MAX31865 library to version 1.2.1 I get intermittent (about every 2000th measurement) wrong readings.
Wrong means up to +/-5 degrees offset.
When switching back to version 1.1.0 everything is fine.
grafik
(Graph shows just a sample of the measured values)

Any idea what could be wrong?

Daisy chain mode

Hello,

As temperatures measurements often involves several sensors, it would be great if there was a daisy chain possibility with this library to limit the numbers of GPIO used when you have 2,3,...8 max 31865 in a project.
Could it be possible to write a "daisy chain version" of the function :
'''float Adafruit_MAX31865::temperature(float RTDnominal, float refResistor)'''

Or explain how use adafruit max31865 module in daisy chain mode if already possible with this library ?

Thanks !

implicit conversions from float to double

There are several implicit conversions from single precision to double precision happening in
float Adafruit_MAX31865::temperature(float RTDnominal, float refResistor)
for example:

Z3 = (4 * RTD_B) / RTDnominal;

Since the input and output variables are single precision, I suggest keeping all intermediary calculations as single precision as well. You get the respective warnings if you turn on -Wdouble-promotion.

wrong readings

I am using PT100 (3 Wire) to measure the temperature.
I have connected everything perfectly.
Configuration in the code i am using is :
max1.begin(MAX31865_3WIRE);

And the output is:
output
RTD value: 0
Ratio = 0.00000000
Resistance = 0.00000000
Temperature = -242.02

I am testing it in a room temperature.
My question is , is there any settings or calibration that i need to do, or any other way to test the PT100 sensor, because the temperature is showing correct readings.

Hardware SPI, CS pin no corect.

Hi.
I used hardware SPI,
example

pinMode(53,INPUT);
Adafruit_MAX31865 thermo = Adafruit_MAX31865(5); // use cs pin 5
thermo.begin(MAX31865_3WIRE);

//after begin i see pin 53 output state high, How to fix it?

Two delays in readRTD are blocking

In Adafruit_MAX31865::readRTD two delays are used. This makes it unusable when driving a stepper motor at the same time (motor stops at every reading). Is there an easy way around it?

The way it is it is hard to be used for simultaneous tasks, it would be nice if this could be changed.
Thank you :)

MAX31856_CONFIG_REG ???

I know - this library is to abstract the #defines for the registers and bits in the registers away - the user should not need to use them.
However, the names for that should have the right IC-name in it.
All "MAX31856_*" have to be replaced by "MAX31865_*"
Here we are not dealing with the "MAX31856 Precision Thermocouple to Digital Converter
with Linearization" but the "MAX31865 RTD-to-Digital Converter".

And if the #defines are not thought to be used outside the library, should they be exported by the .h-file, or kept secret in the .cpp-file?

error when going to 1.2.0 from 1.1.0

simply changing the version from 1.1.0 to 1.2.0 in the library manager causes the following error to appear for me:
fatal error: Adafruit_SPIDevice.h: No such file or directory

  • Arduino board: ESP32 TTGO T-Display

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.8

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Sorry, I can't share the sketch. This happens on recompile. It's consistent - switch to 1.1.0, and it works, switch to 1.2.0 and it breaks. My guess is that it forgets to download the .h file for the newer lib.

Library not working for Arduino R4

It always shows no result like this:

RTD value: 0
Ratio = 0.00000000
Resistance = 0.00000000
Temperature = -242.02

Software SPI or hardware SPI does not matter, the error remains the same.

hardware SPI asumes it is always HSPI and does not allow to use VSPI

Even though Adafruit_SPIDevice library allows to pass the hardward SPI as parameter in its constructor, it is not reflected in this library's constructor.

So Adafruit_MAX31865 hardware SPI assumes Adafruit_SPIDevice with SPIClass = SPI, which is defined in the SPI.h as HSPI (meaning pins 12, 13, 14, 15).

The Adafruit_SPIDevice allows to select the hardware SPI VSPI (pins 19, 18, 5, 23), but this library doesn't.

The constructor must allow to pass a hardware SPI.

The ESP32 has 3 hardware SPIs: SPI, HSPI, and VSPI

0x40 fault

I try demo with Arduino Nano and it´s print only 0x40 fault.

RTD value: 0
Ratio = 0.00000000
Resistance = 0.00000000
Temperature = -242.02
Fault 0x40
RTD Low Threshold

Please what it s mean?

Thanks,

Jan

MAX31865 libs conflict with Ethernet2 and WiFi101

Hello! I have a Feather M0 Adalogger with a Ethernet Featherwing and a Feather M0 + ATWINC1500 that I want to use to send MAX31865 readings from PT-100s over the network.

I have tried with both native SPI pins and defined SPI over GPIO pins. Either way the moment I turn on either networking library the MAX31865 starts reporting every single fault available;

Fault 0xFF
RTD High Threshold
RTD Low Threshold
REFIN- > 0.85 x Bias
REFIN- < 0.85 x Bias - FORCE- open
RTDIN- < 0.85 x Bias - FORCE- open
Under/Over voltage

It would be nice to use the MAX31865 in a IoT setting. Does anyone know what is going on here?

Thanks!

Some errors will never appear...

Hi,

as far as i see, the errors

MAX31865_FAULT_REFINLOW
MAX31865_FAULT_REFINHIGH
MAX31865_FAULT_RTDINLOW

will never appear.
These are the bits 3 to 5 in the fault register, which are only handled, if a fault-detection cycle is initiated through the config register. Neither readFault() nor any other method seems to trigger a fault-detection cycle.
Could be a great improvement to do this alway in readFault() or to overload the method and give a parameter to trigger automatic or manual fault-detection mode.
Currently an unconnected sensor could not be detected through readFault(), but this is implied trough the example.

Edit:
I supplied two patches for the .cpp and .h files with an extended readFault() method. Just call readFault(true) to initiate a fault-detection cycle. readFault(false) gives the same result as readFault().
To be improved... :-)

Regards, Thorsten

Adafruit_MAX31865.cpp.patch.txt
Adafruit_MAX31865.h.patch.txt

Convert to BusIO.

Currently directly using the SPI bus. Change to using SPIDevice from BusIO instead.

Adafruit_SPIDevice does not drive MOSI pin

I have tried this library on an ESP32-WROVER as well as on an Arduino Uno R4 Minima and on both platforms this library does not drive the MOSI pin (observed with oscilloscope). It does drive CS and SCLK but not MOSI. Thus, the MAX31865 does not respond...

  • Arduino board: Arduino Uno R4 Minima

  • Arduino IDE version (found in Arduino -> About Arduino menu): 2.1.1 (also using PlatformIO makes no difference)

  • List the steps to reproduce the problem below:

    • attach Adafruit MAX31865 board to any Arduino device, e.g. Arduino Uno R4 Minima
      • attach the MAX31865 board to power or not, makes no difference
      • choose either HardwareSerial with the fixed pins or use SofwareSerial and specify pins
      • with SoftwareSerial, choose any pin for MOSI you like and pass it to the Adafruit_MAX31865 constructor
      • connect Arduino board's MOSI to MAX31865 or not, makes no difference
      • call pinMode(MOSI_PIN, OUTPUT); in void setup() or not, it makes no difference
    • run example code from this repository
    • attach an oscilloscope to all four pins and set trigger to falling edge on CS
    • observe how CS falls and SCLK goes up and down beautifully
    • observe how MOSI stays high the entire time

Should I cross-post this issue on Adafruit_BusIO?

Problem with more than 3 thermo.begin(MAX31865_2WIRE) function

In the original Adafruit_MAX31865 library, the library works well with a single MAX31865.
I am trying to read up to 10 MAX31865 using an Arduino Mega, however, at the setup thermo.begin(MAX31865_2WIRE); allows modification of the bool line only up to three, any modification after the third returns a null value for the MAX31865.
Have tried the multiple sensor code by @sylvanoMTL and others but there is still no reading after the third modification.

Can you provide a working library with example for reading multiple MAX31865 sensors of up to 10 with an arduino sketch.
It is my belief that the arduino.h code is limited somehow to just three instances preventing additional instances.

I have attached a sample code for 5 MAX31865 to aid troubleshooting.
Note: when thermo3.begin(MAX31865_2WIRE); and thermo4.begin(MAX31865_2WIRE); are commented out, I get stable readings from the MAX31865 for the first three, however when they are uncommented, only the first gives a reading, while the others is driven to the 5V HIGH.

I have commented out all others and was able to find that the problem is from the setup function and it has something to do with the bool begin function as explained above.

/***************************************************
This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865

Designed specifically to work with the Adafruit RTD Sensor
----> https://www.adafruit.com/products/3328

This sensor uses SPI to communicate, 4 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

#include <Adafruit_MAX31865.h>

// Use software SPI: CS, DI, DO, CLK 54213
// for uno and nano SPI pins are 11(DI), 12(DO), 13(CLK)
// for mega the SPI pins are: 51(DI), 50(DO), 52(CLK)
/*Adafruit_MAX31865 thermo = Adafruit_MAX31865(46,51,50,52); // for 1st max31865
Adafruit_MAX31865 thermo1 = Adafruit_MAX31865(44,51,50,52); //for 2nd max31865, only CS is changing
Adafruit_MAX31865 thermo2 = Adafruit_MAX31865(42,51,50,52); //for 3rd max31865, only CS is changing
Adafruit_MAX31865 thermo3 = Adafruit_MAX31865(40,51,50,52); //for 4th max31865, only CS is changing
Adafruit_MAX31865 thermo4 = Adafruit_MAX31865(38,51,50,52); //for 5th max31865, only CS is changing
*/

// use hardware SPI, just pass in the CS pin
Adafruit_MAX31865 thermo = Adafruit_MAX31865(46);
Adafruit_MAX31865 thermo1 = Adafruit_MAX31865(44);
Adafruit_MAX31865 thermo2 = Adafruit_MAX31865(42);
Adafruit_MAX31865 thermo3 = Adafruit_MAX31865(40);
Adafruit_MAX31865 thermo4 = Adafruit_MAX31865(38);

// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF 430.0
// The 'nominal' 0-degrees-C resistance of the sensor
// 100.0 for PT100, 1000.0 for PT1000
#define RNOMINAL 100.0

float ratio, ratio1, ratio2, ratio3, ratio4;

void setup() {
Serial.begin(115200);
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");

thermo.begin(MAX31865_2WIRE); //delay(50);// set to 2WIRE or 4WIRE as necessary
thermo1.begin(MAX31865_2WIRE); //delay(50); // set to 2WIRE or 4WIRE
thermo2.begin(MAX31865_2WIRE); //delay(150);// set to 2WIRE or 4WIRE
thermo3.begin(MAX31865_2WIRE); //delay(150);// set to 2WIRE or 4WIRE
thermo4.begin(MAX31865_2WIRE); //delay(150);

}

void loop() {
uint16_t rtd = thermo.readRTD(); //delay(50);
uint16_t rtd1 = thermo1.readRTD(); //delay (50);
uint16_t rtd2 = thermo2.readRTD(); //delay (50);
uint16_t rtd3 = thermo3.readRTD();
uint16_t rtd4 = thermo4.readRTD();

Serial.print("RTD value 1: "); Serial.println(rtd);
Serial.print("RTD value 2: "); Serial.println(rtd1);
Serial.print("RTD value 3: "); Serial.println(rtd2);
Serial.print("RTD value 4: "); Serial.println(rtd3);
Serial.print("RTD value 5: "); Serial.println(rtd4);

ratio = rtd;
ratio1 = rtd1;
ratio2 = rtd2;
ratio3 = rtd3;
ratio4 = rtd4;

ratio /= 32768;
ratio1 /= 32768;
ratio2 /= 32768;
ratio3 /= 32768;
ratio4 /= 32768;

Serial.print("Ratio 1 = "); Serial.println(ratio,8);
Serial.print("Resistance 1 = "); Serial.println(RREFratio,8);
Serial.print("Ratio 2 = "); Serial.println(ratio1,8);
Serial.print("Resistance 3 = "); Serial.println(RREF
ratio1,8);
Serial.print("Ratio 4 = "); Serial.println(ratio2,8);
Serial.print("Resistance 4 = "); Serial.println(RREFratio2,8);
Serial.print("Ratio 5 = "); Serial.println(ratio3,8);
Serial.print("Resistance 5 = "); Serial.println(RREF
ratio3,8);
Serial.print("Ratio 5 = "); Serial.println(ratio4,8);
Serial.print("Resistance 5 = "); Serial.println(RREF*ratio4,8);

Serial.print("Temperature 1 = "); Serial.println(thermo.temperature(RNOMINAL, RREF));
Serial.print("Temperature 2 = "); Serial.println(thermo1.temperature(RNOMINAL, RREF));
Serial.print("Temperature 3 = "); Serial.println(thermo2.temperature(RNOMINAL, RREF));
Serial.print("Temperature 4 = "); Serial.println(thermo3.temperature(RNOMINAL, RREF));
Serial.print("Temperature 5 = "); Serial.println(thermo4.temperature(RNOMINAL, RREF));
//*/
// Check and print any faults
uint8_t fault = thermo.readFault();
uint8_t fault1 = thermo1.readFault();
uint8_t fault2 = thermo2.readFault();
uint8_t fault3 = thermo3.readFault();
uint8_t fault4 = thermo4.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");
}
thermo.clearFault();
thermo1.clearFault();
thermo2.clearFault();
thermo3.clearFault();
thermo4.clearFault();
}
Serial.println();
delay(1000);
}

sometime got high resistance

I using mega2560 and connect six max31865 modules to detect PT100 temperature.
Sometimes read high resistance from different module....
How to fix this issues?

thanks

Bias voltage remains on after one-shot read

The MAX31865 board dumps a whopping ~4 ma into a Pt100 sensor at room temperature causing visible self-heating while the resistance stabilizes. Sampling it less frequently made no difference until the bias voltage was shut off after reading in ReadRTD(). With the bias voltage strobed only as needed and the RTD sampled at 15+ second intervals, self-heating was at a tolerable minimum.

A short patch file is attached:
max31865_patch.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.