So I know enough to know I don't know enough. But the problem I cannot figure out is I got a Adafruit M0 LFM95 LORA board and a Max318756 thermocouple amplifier. I have the correct K-type thermocouple, I have it specified in the program as K. I have gotten the LORA radio to work and send messages and receive them. But I cannot for the life of me get any of the data from the Amplifier board. I had the MAX board wired like:
VIN to 3V on Feather M0
GND to GND on Feather M0
SCK to SCK (pin 13) on Feather M0
SDO to MISO (pin 12) on Feather M0
SDI to MOSI (pin 11) on Feather M0
CS to digital pin 10 on Feather M0
Here is the test Code:
#include <SPI.h>
#include <Adafruit_MAX31856.h>
#define MAX31856_CS 10
Adafruit_MAX31856 maxthermo = Adafruit_MAX31856(MAX31856_CS);
void setup() {
Serial.begin(115200);
pinMode(MAX31856_CS, OUTPUT);
Serial.println("Initializing MAX31856...");
if (!maxthermo.begin()) {
Serial.println("Could not find a valid MAX31856 sensor, check wiring!");
while (1);
}
Serial.println("MAX31856 initialized.");
maxthermo.setThermocoupleType(MAX31856_TCTYPE_K);
}
void loop() {
float temperature = maxthermo.readThermocoupleTemperature();
if (isnan(temperature)) {
Serial.println("Error reading temperature!");
} else {
temperature = temperature * 9.0 / 5.0 + 32.0; // Convert to Fahrenheit
Serial.print("Temperature: ");
Serial.println(temperature);
}
delay(1000); // Read temperature every second
}
Welcome! Sorry I cannot follow your word substation for a schematic.
Max board pin VIN to 3V on Adafruit feather M0
Max board GND to GND on Adafruit Feather M0
Max board SCK to SCK (pin 13) on Adafruit Feather M0
Max board SDO to MISO (pin 12) on Adafruit Feather M0
Max board SDI to MOSI (pin 11) on Adafruit Feather M0
Max board CS to digital pin 10 on Adafruit Feather M0
jim-p
June 27, 2024, 6:12pm
4
So your code finds the board but prints out "error reading temperature"?
jim-p
June 27, 2024, 6:21pm
5
If this the board then you are connected to the wrong pins
The SPI pins are labeled as SCK, MOS, MIS on the board
They are using those ports
Max board SCK to SCK on Adafruit Feather M0
Max board SDO to MIS on Adafruit Feather M0
Max board SDI to MOS on Adafruit Feather M0
Sorry didn't realize it was labeled as pi s 11 and 12 that wasn't right. But I am.using the mos and mis pins
To also clarify I have two of each board as I am trying to create 2 wireless temperature probes that transmit the data over LORA. I have tried this on both prototypes and I cannot get this work on either so I am doubting its a DOA issue unless everthing I got was DOA which isnt likely.
This is not close to a schematic!
Yes There was one point where the only time I would get a reading from the board is for the very first message after resetting it would have a reading then nothing after that. Now I cannot get a reading at all.
I have tried many different version of the code this is just the last attempt. I just cannot figure out why even with the most basic sketch I cannot communicate with the Amplifier board anymore. As I said I have two Feather M0 and Two Max Amplifier Boards and the problem is the same on both.
jim-p
June 28, 2024, 3:23pm
14
Understood but does it print "MAX31856 initialized"
I get a reading but it will not change states now,
18:14:15.507 -> Temperature: 32.00
18:14:16.496 -> Temperature: 32.00
18:14:17.482 -> Temperature: 32.00
18:14:18.518 -> Temperature: 32.00
18:14:19.512 -> Temperature: 32.00
Whereas if I pull the 3.3v Power line to the thermocouple board I will get a couple readings before it defaults back to the 32.00 degrees:
:13.596 -> Temperature: 32.00
18:16:14.580 -> Temperature: 32.00
18:16:15.561 -> Temperature: 32.00
18:16:16.597 -> Temperature: 32.00
18:16:17.727 -> Temperature: 82.85
18:16:18.857 -> Temperature: 32.00
18:16:19.889 -> Temperature: 32.00
18:16:20.872 -> Temperature: 32.00
18:16:21.859 -> Temperature: 32.00
18:16:22.891 -> Temperature: 32.00
18:16:23.878 -> Temperature: 32.00
18:16:24.860 -> Temperature: 32.00
18:16:25.891 -> Temperature: 32.00
18:16:26.877 -> Temperature: 32.00
18:16:28.038 -> Temperature: 81.11
18:16:29.160 -> Temperature: 81.09
18:16:30.329 -> Temperature: 81.06
18:16:31.455 -> Temperature: 80.71
18:16:32.638 -> Temperature: 80.70
18:16:33.760 -> Temperature: 80.45
18:16:34.791 -> Temperature: 32.00
18:16:35.826 -> Temperature: 32.00
18:16:36.860 -> Temperature: 32.00
18:16:37.847 -> Temperature: 32.00
18:16:38.880 -> Temperature: 32.00
18:16:40.002 -> Temperature: 79.74
18:16:41.172 -> Temperature: 79.66
18:16:42.299 -> Temperature: 79.53
18:16:43.466 -> Temperature: 79.36
18:16:44.642 -> Temperature: 79.22
18:16:45.779 -> Temperature: 79.17
18:16:46.907 -> Temperature: 79.10
18:16:48.078 -> Temperature: 79.08
18:16:49.212 -> Temperature: 79.03
18:16:50.384 -> Temperature: 78.98
18:16:51.507 -> Temperature: 78.94
18:16:52.675 -> Temperature: 78.88
18:16:53.848 -> Temperature: 78.66
jim-p
June 29, 2024, 8:25am
17
Have you tried any of the Adafruit example programs?
Try the max31856_manual.ino
14:13:38.829 -> 96.99
14:13:39.346 -> 1060.68
14:13:39.865 -> 96.84
14:13:40.340 -> 1060.58
14:13:40.860 -> 96.49
14:13:41.330 -> 1060.40
14:13:41.855 -> 96.36
14:13:42.326 -> 1060.30
14:13:42.847 -> 96.43
14:13:43.323 -> 1060.11
14:13:43.846 -> 96.36
14:13:44.363 -> 1060.05
That seems to work
jim-p
June 30, 2024, 9:19am
19
matt_winter:
That seems to work
Should not bounce around like that.
Are you using a K thermocouple?
Try this program. It will print out faults if any.
// Basic example using one-shot measurement.
// The call to readThermocoupleTemperature() is blocking for O(100ms)
#include <Adafruit_MAX31856.h>
Adafruit_MAX31856 maxthermo = Adafruit_MAX31856(10);
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println("MAX31856 thermocouple test");
maxthermo.begin();
maxthermo.setThermocoupleType(MAX31856_TCTYPE_K);
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;
}
Serial.println("------------------------------------------- ");
Serial.println(" ");
}
void loop() {
Serial.print("Cold Junction Temp: ");
Serial.println(maxthermo.readCJTemperature());
Serial.print("Thermocouple Temp: ");
Serial.println(maxthermo.readThermocoupleTemperature());
Serial.println(" ");
// Check and print any faults
uint8_t fault = maxthermo.readFault();
if (fault) {
if (fault & MAX31856_FAULT_CJRANGE) Serial.println("Cold Junction Range Fault");
if (fault & MAX31856_FAULT_TCRANGE) Serial.println("Thermocouple Range Fault");
if (fault & MAX31856_FAULT_CJHIGH) Serial.println("Cold Junction High Fault");
if (fault & MAX31856_FAULT_CJLOW) Serial.println("Cold Junction Low Fault");
if (fault & MAX31856_FAULT_TCHIGH) Serial.println("Thermocouple High Fault");
if (fault & MAX31856_FAULT_TCLOW) Serial.println("Thermocouple Low Fault");
if (fault & MAX31856_FAULT_OVUV) Serial.println("Over/Under Voltage Fault");
if (fault & MAX31856_FAULT_OPEN) Serial.println("Thermocouple Open Fault");
Serial.println(" ");
}
Serial.println("-------------------------------------");
delay(1000);
}
10:40:03.090 -> MAX31856 thermocouple test
10:40:03.090 -> Thermocouple type: K Type
10:40:03.090 -> -------------------------------------------
10:40:03.090 ->
10:40:03.090 -> Cold Junction Temp: 0.00
10:40:03.090 -> Thermocouple Temp: nan
10:40:03.340 ->
10:40:03.340 -> Thermocouple Open Fault
10:40:03.340 ->
10:40:03.340 -> -------------------------------------
10:40:04.330 -> Cold Junction Temp: 2.01
10:40:04.330 -> Thermocouple Temp: nan
10:40:04.563 ->
10:40:04.563 -> Thermocouple Range Fault
10:40:04.563 ->
10:40:04.563 -> -------------------------------------
10:40:05.601 -> Cold Junction Temp: 128.50
10:40:05.601 -> Thermocouple Temp: nan
10:40:05.836 ->
10:40:05.836 -> Cold Junction Low Fault
10:40:05.836 ->
10:40:05.836 -> -------------------------------------
10:40:06.819 -> Cold Junction Temp: 32.13
10:40:06.819 -> Thermocouple Temp: nan
10:40:07.099 ->
10:40:07.099 -> Thermocouple Low Fault
10:40:07.099 ->
10:40:07.099 -> -------------------------------------
10:40:08.079 -> Cold Junction Temp: 8.03
10:40:08.079 -> Thermocouple Temp: nan
10:40:08.357 ->
10:40:08.357 -> Thermocouple Open Fault
10:40:08.357 ->
10:40:08.357 -> -------------------------------------
10:40:09.340 -> Cold Junction Temp: 2.01
10:40:09.340 -> Thermocouple Temp: nan
10:40:09.572 ->
10:40:09.572 -> Thermocouple Range Fault
10:40:09.572 ->
10:40:09.572 -> -------------------------------------
This is what I am getting now.
Yes I am using a K-type.
I pulled the 3.3v pwr to the MAX amplifier and now I get the opposite:
10:42:10.752 -> -------------------------------------
10:42:11.741 -> Cold Junction Temp: 23.22
10:42:11.741 -> Thermocouple Temp: 86.87
10:42:11.928 ->
10:42:11.928 -> Thermocouple High Fault
10:42:11.928 ->
10:42:11.928 -> -------------------------------------
10:42:12.917 -> Cold Junction Temp: 23.22
10:42:12.917 -> Thermocouple Temp: 86.89
10:42:13.103 ->
10:42:13.103 -> Thermocouple High Fault
10:42:13.103 ->
10:42:13.103 -> -------------------------------------
10:42:14.097 -> Cold Junction Temp: 23.22
10:42:14.097 -> Thermocouple Temp: 86.93
10:42:14.288 ->
10:42:14.288 -> Thermocouple High Fault
10:42:14.288 ->
10:42:14.288 -> -------------------------------------
10:42:15.273 -> Cold Junction Temp: 23.22
10:42:15.273 -> Thermocouple Temp: 86.87
10:42:15.460 ->
10:42:15.460 -> Thermocouple High Fault
10:42:15.460 ->
10:42:15.460 -> -------------------------------------
jim-p
June 30, 2024, 6:01pm
22
Doing that serves no purpose and can damage the board.
Not sure what is wrong.