Temperaturmessung mit Arduino & MAX31855
Um mit dem MAX31855 Baustein die Temperatur an einem Typ-K Sensor zu messen benötigt man zusätzlich zur Arduino IDE eine zusätzliche Bibliothek.
Daten MAX31855
Messbereich Temperatur | -200 .... 1350 °C |
Anschluss-PINs an Arduino : | |
GND | Masse |
Vin | 3.3V |
DO | Data Out der SPI, Anschluss-Pin Arduino abhängig vom Quellcode |
CLK | Clock/Takt der SPI, Anschluss-Pin Arduino abhängig vom Quellcode |
CS | CableSelect um den Chip zu aktivieren, Anschluss-Pin Arduino abhängig vom Quellcode |
..
Temperaturmessung
Die Adafruit MAX31855 Bibbliothek lässt sich direkt im Bibliotheksverwalter der Arduino IDE installieren.
Unter GitHub ist die Bibliothek hier zu finden :
https://github.com/adafruit/Adafruit-MAX31855-library
Dieses auch mit der Bibliothek mitgelieferte Beispiel in der Arduino IDE gibt im Sekundentakt die am Thermoelement gemessene Temperatur des Sensors über die serielle Schnittstelle aus.
#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 3
#define MAXCS 4
#define MAXCLK 5
// 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);
void setup() {
while (!Serial); // wait for Serial on Leonardo/Zero, etc
Serial.begin(9600);
Serial.println("MAX31855 test");
// wait for MAX chip to stabilize
delay(500);
}
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.readFarenheit());
delay(1000);
}
Die Galerie zeigt ein MAX31855 Board, welches wie im Beispiel an den PINs 3 / 4 / 5 angeschlossen ist.