Ciao
Sto confrontando alcune board per sensori di temperatura
max 31855
max 6675
per termocoppia tipo K
max 31865
per una PT100
ho messo tutto in uno sketch ma il max 31855 da valori diversi da quelli che ottengo se lo uso singolarmente con l'esempio della libreria
/***************************************************
This is an example for the Adafruit Thermocouple Sensor w/MAX31855K
Designed specifically to work with the Adafruit Thermocouple Sensor
----> https://www.adafruit.com/products/269
These displays use SPI to communicate, 3 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 <SPI.h>
#include "Adafruit_MAX31855.h"
// Default connection is using software SPI, but comment and uncomment one of
// the two examples below to switch between software SPI and hardware SPI:
// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXDO 6
#define MAXCS 7
#define MAXCLK 8
// initialize the Thermocouple
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);
// Example creating a thermocouple instance with hardware SPI
// on a given CS pin.
//#define MAXCS 10
//Adafruit_MAX31855 thermocouple(MAXCS);
// Example creating a thermocouple instance with hardware SPI
// on SPI1 using specified CS pin.
//#define MAXCS 10
//Adafruit_MAX31855 thermocouple(MAXCS, SPI1);
void setup() {
Serial.begin(9600);
while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc
Serial.println("MAX31855 test");
// wait for MAX chip to stabilize
delay(500);
Serial.print("Initializing sensor...");
if (!thermocouple.begin()) {
Serial.println("ERROR.");
while (1) delay(10);
}
Serial.println("DONE.");
}
void loop() {
// basic readout test, just print the current temp
Serial.print("Internal Temp = ");
Serial.println(thermocouple.readInternal());
double c = thermocouple.readCelsius();
if (isnan(c)) {
Serial.println("Something wrong with thermocouple!");
} else {
Serial.print("C = ");
Serial.println(c);
}
//Serial.print("F = ");
//Serial.println(thermocouple.readFahrenheit());
delay(1000);
}
questo รจ l'output
MAX31855 test
Initializing sensor...DONE.
Internal Temp = 25.75
C = 27.75
Internal Temp = 26.87
C = 21.50
Internal Temp = 27.31
C = 22.25
Internal Temp = 27.69
C = 22.50
mentre se uso lo sketch che ho creato inglobando l'esempio della libreria
//2021 04 22
//#include <Adafruit_MAX31865.h> PT100
//in questo sketch vengono utilizzati insieme per verificare le differenze
//#include "max6675.h" termocoppia tipo K
//sensori in parallelo per verificare corrispondenza
//#include "Adafruit_MAX31855.h" termocoppia
//#include "Adafruit_MCP9808.h"
//sensori in parallelo per verificare corrispondenza
/***************************************************
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
// this example is public domain. enjoy!
// https://learn.adafruit.com/thermocouple/
****************************************************/
/////////////////////////////////////////////////termocoppia con max 31855
#include <SPI.h>
#include "Adafruit_MAX31855.h"
// Default connection is using software SPI, but comment and uncomment one of
// the two examples below to switch between software SPI and hardware SPI:
// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXDO 6
#define MAXCS 7
#define MAXCLK 8
//
// initialize the Thermocouple
Adafruit_MAX31855 thermocouple_1(MAXCLK, MAXCS, MAXDO);
//
//// Example creating a thermocouple instance with hardware SPI
//// on a given CS pin.
////#define MAXCS 10
////Adafruit_MAX31855 thermocouple_1(MAXCS);
//
//// Example creating a thermocouple instance with hardware SPI
//// on SPI1 using specified CS pin.
////#define MAXCS 10
////Adafruit_MAX31855 thermocouple_1(MAXCS, SPI1);
/////////////////////////////////////////////////termocoppia con max 6675
#include "max6675.h"
#define thermoDO 3
#define thermoCS 4
#define thermoCLK 5
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
//#define MAXDO 6
//#define MAXCS 7
//#define MAXCLK 8
////
//// initialize the Thermocouple
//MAX6675 thermocouple_1(MAXCLK, MAXCS, MAXDO);
//////////////////////////////////////////////////PT100 con max 31865
#include <Adafruit_MAX31865.h>
#define tCS 10
#define tSI 11
#define tSO 12
#define tCK 13
// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(tCS, tSI, tSO, tCK);
//Adafruit_MAX31865::Adafruit_MAX31865(int8_t spi_cs, int8_t spi_mosi, int8_t spi_miso, int8_t spi_clk) {
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31865 thermo = Adafruit_MAX31865(10);
// 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
void setup()
{
Serial.begin(9600);
while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc
////////////////////////////////////////////////////////////////////max 31855
Serial.println("MAX31855 test");
// wait for MAX chip to stabilize
delay(500);
Serial.print("Initializing sensor...");
if (!thermocouple_1.begin())
{
Serial.println("ERROR.");
while (1) delay(10);
}
Serial.println("DONE.");
////////////////////////////////////////////////////////////////PT100 con max 31865
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
thermo.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
delay(1000);
}
void loop()
{
//////////////////////////////////////////////////termocoppia con max 31855
// basic readout test, just print the current temp
Serial.println("Max31855");
// Serial.print("Internal Temp = ");
// Serial.println(thermocouple_1.readInternal());
double c = thermocouple_1.readCelsius();
if (isnan(c))
{
Serial.println("Something wrong with thermocouple!");
}
else
{
Serial.print("Temperature = ");
// Serial.print("C = ");
Serial.println(c);
}
//Serial.print("F = ");
//Serial.println(thermocouple_1.readFahrenheit());
// digitalWrite(MAXCS, LOW);
Serial.println();
delay(1000);
/////////////////////////////////////////////PT100 max 31865
Serial.println("Max31865");
uint16_t rtd = thermo.readRTD();
// 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.println("PT100");
Serial.print("Temperature = ");
Serial.println(thermo.temperature(RNOMINAL, RREF));
// Check and print any faults
uint8_t fault = thermo.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();
}
Serial.println();
delay(1000);
////////////////////////////////////////////termocoppia con max 6675
// basic readout test, just print the current temp
Serial.println("Max6675");
Serial.print("Temperature = ");
//Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
// Serial.print("F = ");
// Serial.println(thermocouple.readFahrenheit());
// For the MAX6675 to update, you must delay AT LEAST 250ms between reads!
Serial.println();
delay(1000);
// // basic readout test, just print the current temp
// Serial.println("Max6675");
// Serial.print("Temperature = ");
// //Serial.print("C = ");
// Serial.println(thermocouple_1.readCelsius());
// // Serial.print("F = ");
// // Serial.println(thermocouple.readFahrenheit());
//
// // For the MAX6675 to update, you must delay AT LEAST 250ms between reads!
// Serial.println();
// delay(1000);
}
ottengo questo output
MAX31855 test
Initializing sensor...DONE.
Adafruit MAX31865 PT100 Sensor Test!
Max31855
Temperature = 21.75
Max31865
Temperature = 20.43
Max6675
Temperature = 20.75
Max31855
Temperature = 14.50
Max31865
Temperature = 20.43
Max6675
Temperature = 21.00
Max31855
Temperature = 15.50
Max31865
Temperature = 20.46
Max6675
Temperature = 21.00
Max31855
Temperature = 15.75
Max31865
Temperature = 20.43
Max6675
Temperature = 20.50
Max31855
Temperature = 14.75
avete qualche idea
grazie
stefano