Arduino Uno and Max31855 random resets Arduino

Hi, first of I hope this is the right place to post my problem (If not let me know!)

I have recently been working on a temperature regulation system. I intended to measure the temperature using a K-type thermocouple with a MAX31855 breakout board and Arduino Uno, but I encountered problems during the initial testing.

To get started with the Adafruit_MAX31855 library, I used some sample code to test whether the thermocouple was working as intended (which can be seen below). The code is supposed to continuously write the measured temperature to the console in the Arduino IDE. Here's where things get interesting: in the console, I can see that the Arduino randomly resets while transmitting the measured data, which is, of course, very problematic. The reset can happen almost immediately after the code has been uploaded, or it can occur after some time. Sometimes it resets again and again in quick succession, and sometimes it just freezes the Arduino altogether, requiring manual reset. Other times, it starts spamming the current temperature like crazy until it crashes. I have included a screenshot of what I experience.

I have tried the following things:

  1. Using a different MAX31855.

  2. Using several different thermocouples.

  3. Using different PCs.

  4. Using external power to power the MAX31855.

  5. Using Python to collect serial output.

  6. Flushing the serial each time the Arduino transmits.

  7. Several different jumpwires

Does anyone have any experience with these breakout boards? Or have you experienced faults like these? Please let me know!

    #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   13
    #define MAXCS   12
    #define MAXCLK  11
     
    // 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 temp test");
      // wait for MAX chip to stabilize
      delay(500);
      Serial.print("Initializing sensor...");
      if (!thermocouple.begin()) {
        Serial.println("ERROR.");
        while (1) delay(10);
      }
     
      // OPTIONAL: Can configure fault checks as desired (default is ALL)
      // Multiple checks can be logically OR'd together.
      // thermocouple.setFaultChecks(MAX31855_FAULT_OPEN | MAX31855_FAULT_SHORT_VCC);  // short to GND fault is ignored
     
      Serial.println("DONE.");
    }
     
    void loop() {
      // basic readout test, just print the current temp
     
       double c = thermocouple.readCelsius();
       if (isnan(c)) {
         Serial.println("Thermocouple fault(s) detected!");
         uint8_t e = thermocouple.readError();
         if (e & MAX31855_FAULT_OPEN) Serial.println("FAULT: Thermocouple is open - no connections.");
         if (e & MAX31855_FAULT_SHORT_GND) Serial.println("FAULT: Thermocouple is short-circuited to GND.");
         if (e & MAX31855_FAULT_SHORT_VCC) Serial.println("FAULT: Thermocouple is short-circuited to VCC.");
       } else {
         Serial.print("C = ");
         Serial.println(c);
       }
    
       delay(1000);
    }


Solved. The Pie was bad. Dead on arrival.