Hi all,
I have a ESP32 Sparkfun hooked up to a adafruit MAX 31856 and having no joy. I used this as as guide.
I have it powered up by USB and the connections are as follows:
I changed the code to S Type thermocouple but have also tried the standard K type.
It seems the SPI is not communicating at all as I pull the wiring out and the output result is the same.
MAX31856 --- ESP32
VIN -------------------- 3V3
GND -------------------- GND
SCK -------------------- D18
SDO -------------------- D19
SDI -------------------- D23
CS --------------------- D5
DRDY -------------------- D4
The code I entered is as follows:
// This example demonstrates continuous conversion mode using the
// DRDY pin to check for conversion completion.
#include <Adafruit_MAX31856.h>
#define DRDY_PIN 4
// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31856 maxthermo = Adafruit_MAX31856(5, 23, 19, 18);
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31856 maxthermo = Adafruit_MAX31856(10);
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("MAX31856 thermocouple test");
pinMode(DRDY_PIN, INPUT);
if (!maxthermo.begin()) {
Serial.println("Could not initialize thermocouple.");
while (1) delay(10);
}
maxthermo.setThermocoupleType(MAX31856_TCTYPE_S);
Serial.print("Thermocouple type: ");
switch (maxthermo.getThermocoupleType() ) {
case MAX31856_TCTYPE_B: Serial.println("B Type"); break;
case MAX31856_TCTYPE_E: Serial.println("E Type"); break;
case MAX31856_TCTYPE_J: Serial.println("J Type"); break;
case MAX31856_TCTYPE_K: Serial.println("K Type"); break;
case MAX31856_TCTYPE_N: Serial.println("N Type"); break;
case MAX31856_TCTYPE_R: Serial.println("R Type"); break;
case MAX31856_TCTYPE_S: Serial.println("S Type"); break;
case MAX31856_TCTYPE_T: Serial.println("T Type"); break;
case MAX31856_VMODE_G8: Serial.println("Voltage x8 Gain mode"); break;
case MAX31856_VMODE_G32: Serial.println("Voltage x8 Gain mode"); break;
default: Serial.println("Unknown"); break;
}
maxthermo.setConversionMode(MAX31856_CONTINUOUS);
}
void loop() {
// The DRDY output goes low when a new conversion result is available
int count = 0;
while (digitalRead(DRDY_PIN)) {
if (count++ > 200) {
count = 0;
Serial.print(".");
}
}
Serial.println(maxthermo.readThermocoupleTemperature());
}
All I am getting is 0.0 back from the serial.
On reset the following is displayed followed by repeating 0.0
ho 0 tail 12 room 4
load:0x40078000,len:15488
load:0x40080400,len:4
load:0x40080404,len:3180
entry 0x400805b8
MAX31856 thermocouple test
Thermocouple type: B Type
0.00
0.00
0.00
0.00
0.00
0.00
I have tried changing the wiring and pins pins to different pins via
Adafruit_MAX31856 maxthermo = Adafruit_MAX31856(5, 23, 19, 18);
Im pretty stuck here.
Any help would be very much appreciated.
I believe its a problem with the SPI not starting up but I am very new at this. This is actually my first attempt.
Cheers.
