Using multiple multiple max31855

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Jrodeghi
 
Posts: 14
Joined: Mon Jun 07, 2021 11:44 am

Using multiple multiple max31855

Post by Jrodeghi »

Hello, I am currently using nine max31855 to try and take temperatures for different points on a machine. I have followed the tutorials I have found online, and individually they all seem to work, but when I try to implement them all together, they stop returning data or give garbage data. I am using an Arduino mega 2560 as the control board, and the thermocouples are not grounded. Attached below is my testing code and example of the outputs.

Code: Select all

#include <AccelStepper.h>       // Controls the stepper motors
#include <EduIntro.h>           // Controls the SSR's
#include <AutoPID.h>            // Enables the use of a PID Temp_Celsiusontrol loop
#include <SPI.h>                // Enables the use of SPI for thermocouples
#include <Wire.h>
#include "Adafruit_MAX31855.h"


Adafruit_MAX31855 PD_one(4, 3, 2);
Adafruit_MAX31855 PD_two(7, 6, 5);
Adafruit_MAX31855 PD_three(10, 9, 8);
Adafruit_MAX31855 PD_four(13, 12, 11);


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

  PD_one.begin();
  PD_two.begin();
  PD_three.begin();
  PD_four.begin();
}

void loop() {

  Serial.println("-----------------------------");
    Serial.print("PD1: ");
    Serial.println(PD_one.readError());
    delay(250);
    Serial.print("PD2: ");
    Serial.println(PD_two.readCelsius());
    delay(250);
    Serial.print("PD3: ");
    Serial.println(PD_three.readCelsius());
    delay(250);
    Serial.print("PD4: ");
    Serial.println(PD_four.readCelsius());
    delay(250);
  Serial.println("-----------------------------");

  delay(1000);

}

Code: Select all

-----------------------------
-----------------------------
PD1: 0
PD2: 0x23D1
nan
PD3: 0x0
0.00
PD4: 0x1BD1A32
nan
-----------------------------
-----------------------------
PD1: 6
PD2: 0x22022D1
nan
PD3: 0x0
0.00
PD4: 0x1B91A42
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x23D1B72
nan
PD3: 0x0
0.00
PD4: 0x1806D46
nan
-----------------------------
-----------------------------
PD1: 5
PD2: 0x22D1808
34.75
PD3: 0x0
0.00
PD4: 0x1B11A42
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x2191B72
nan
PD3: 0x600
0.00
PD4: 0x1B51A32
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x2211B01
nan
PD3: 0x0
0.00
PD4: 0x1BD1A42
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x2091B62
nan
PD3: 0x0
0.00
PD4: 0x1B11A00
27.00
-----------------------------
-----------------------------
PD1: 0
PD2: 0x1ED1B62
nan
PD3: 0x0
0.00
PD4: 0x1B91A00
27.50
-----------------------------
-----------------------------
PD1: 0
PD2: 0x1D803B2
nan
PD3: 0x0
0.00
PD4: 0x1BD1A40
27.75
-----------------------------
-----------------------------
PD1: 0
PD2: 0x38A36
nan
PD3: 0x0
0.00
PD4: 0x1C10038
28.00
-----------------------------
-----------------------------
PD1: 0
PD2: 0x1CC039A
nan
PD3: 0x0
0.00
PD4: 0x1BD0000
27.75
-----------------------------
-----------------------------
PD1: 1
PD2: 0x1DD1B72
nan
PD3: 0x0
0.00
PD4: 0x1C51A42
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x1D11B72
nan
PD3: 0x0
0.00
PD4: 0x1B4036A
nan
-----------------------------
-----------------------------
PD1: 7
PD2: 0x1CD1B62
nan
PD3: 0x0
0.00
PD4: 0x1BD1A42
nan
-----------------------------
-----------------------------
PD1: 7
PD2: 0x1E11807
nan
PD3: 0x0
0.00
PD4: 0x1D91A42
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x1F11B72
nan
PD3: 0x0
0.00
PD4: 0x1E91A00
30.50
-----------------------------
-----------------------------
PD1: 0
PD2: 0x1ED1B62
nan
PD3: 0x0
0.00
PD4: 0x1F11A32
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x1E91B62
nan
PD3: 0x0
0.00
PD4: 0x1F51A32
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x1F91B72
nan
PD3: 0x0
0.00
PD4: 0x1F91A42
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x2091B72
nan
PD3: 0x0
0.00
PD4: 0x1F51A32
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x20D1B62
nan
PD3: 0x0
0.00
PD4: 0x1F11A32
nan
-----------------------------
-----------------------------
PD1: 0
PD2: 0x21D1B62
nan
PD3: 0x1800000
24.00
PD4: 0x1F51A32
nan
-----------------------------

User avatar
adafruit_support_carter
 
Posts: 29164
Joined: Tue Nov 29, 2016 2:45 pm

Re: Using multiple multiple max31855

Post by adafruit_support_carter »

The MAX31855 uses SPI for communications. You can share the SCLK and MISO pins for all the breakouts. However, each breakout needs it's own dedicated CS (chip select) pin.

So instead of this:

Code: Select all

Adafruit_MAX31855 PD_one(4, 3, 2);
Adafruit_MAX31855 PD_two(7, 6, 5);
Adafruit_MAX31855 PD_three(10, 9, 8);
Adafruit_MAX31855 PD_four(13, 12, 11);
You'd do something more like:

Code: Select all

Adafruit_MAX31855 PD_one(5, 6, 3);
Adafruit_MAX31855 PD_two(5, 7, 3);
Adafruit_MAX31855 PD_three(5, 8, 3);
Adafruit_MAX31855 PD_four(5, 9, 3);
Where 5 is used for SCLK and 3 is used for MISO (aka DO = data out) and the pins 6, 7, 8, and 9 are the CS pins. You can changes those to be anything available.

User avatar
Jrodeghi
 
Posts: 14
Joined: Mon Jun 07, 2021 11:44 am

Re: Using multiple multiple max31855

Post by Jrodeghi »

Thank you that got it working.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”