Connecting more SPI devices

Hello,
I'm newbie in Arduino.
I want to make a controller for an industrial oven and I want to read 6 PT100 sensors.
I'm using a chineese version of max31865 to connect them to Arduino Mega.
I wire up 1 sensor first, it works.
I add 1 more, it works.
When I added the 4th, all the sensors are giving under/overvoltage error.

I used the demo sketch for max31865 as follows:

/*************************************************** 
  This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865

  Designed specifically to work with the Adafruit RTD Sensor
  ----> https://www.adafruit.com/products/3328

  This sensor uses SPI to communicate, 4 pins are required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafru  it!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Adafruit_MAX31865.h>

// Use software SPI: CS, DI, DO, CLK
//Adafruit_MAX31865 thermo = Adafruit_MAX31865(10, 11, 12, 13);
// use hardware SPI, just pass in the CS pin
Adafruit_MAX31865 thermo53 = Adafruit_MAX31865(53);
Adafruit_MAX31865 thermo49 = Adafruit_MAX31865(49);
Adafruit_MAX31865 thermo48 = Adafruit_MAX31865(48);
Adafruit_MAX31865 thermo47 = Adafruit_MAX31865(47);

// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF      430.0
// The 'nominal' 0-degrees-C resistance of the sensor
// 100.0 for PT100, 1000.0 for PT1000
#define RNOMINAL  100.0

void setup() {
  Serial.begin(115200);
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");

  thermo53.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
  thermo49.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
  thermo48.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
  thermo47.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
}


void loop() {
  uint16_t rtd53 = thermo53.readRTD();

  /*Serial.print("RTD value: "); Serial.println(rtd);
  float ratio = rtd;
  ratio /= 32768;
  Serial.print("Ratio = "); Serial.println(ratio,8);
  Serial.print("Resistance = "); Serial.println(RREF*ratio,8);*/
  Serial.print("Temperature 53 = "); Serial.println(thermo53.temperature(RNOMINAL, RREF));
  delay(900);
  Serial.print("Temperature 49 = "); Serial.println(thermo49.temperature(RNOMINAL, RREF));
  delay(900);
  Serial.print("Temperature 48 = "); Serial.println(thermo48.temperature(RNOMINAL, RREF));
  delay(900);
  Serial.print("Temperature 47 = "); Serial.println(thermo47.temperature(RNOMINAL, RREF));
  delay(900);
  /*
  // Check and print any faults
  uint8_t fault = thermo.readFault();
  if (fault) {
    Serial.print("Fault 0x"); Serial.println(fault, HEX);
    if (fault & MAX31865_FAULT_HIGHTHRESH) {
      Serial.println("RTD High Threshold"); 
    }
    if (fault & MAX31865_FAULT_LOWTHRESH) {
      Serial.println("RTD Low Threshold"); 
    }
    if (fault & MAX31865_FAULT_REFINLOW) {
      Serial.println("REFIN- > 0.85 x Bias"); 
    }
    if (fault & MAX31865_FAULT_REFINHIGH) {
      Serial.println("REFIN- < 0.85 x Bias - FORCE- open"); 
    }
    if (fault & MAX31865_FAULT_RTDINLOW) {
      Serial.println("RTDIN- < 0.85 x Bias - FORCE- open"); 
    }
    if (fault & MAX31865_FAULT_OVUV) {
      Serial.println("Under/Over voltage"); 
    }
    thermo.clearFault();
  }*/
  Serial.println();
  delay(1000);
}

I followed this diagram for wiring:

http://www.learningaboutelectronics.com/images/SPI-hardware-configuration.png

What am I missing?

By the way, I read that on Mega the the ICSP connector can be used instead of ports 50-52 for SPI communication, but my ports (50-52) are not free using this sketch. I would prefer to use ports 50-52 to other purposes.
The library that I'm using is not configured correctly to free up ports 50-52?

thanks in advance

More power.

try this

 `/*************4 channel PT100's********************/

#include <Adafruit_MAX31865.h>
# include "SPI.h"       //********added************

// use hardware SPI, just pass in the CS pin
Adafruit_MAX31865 thermo53 = Adafruit_MAX31865(53);
Adafruit_MAX31865 thermo49 = Adafruit_MAX31865(49);
Adafruit_MAX31865 thermo48 = Adafruit_MAX31865(48);
Adafruit_MAX31865 thermo47 = Adafruit_MAX31865(47);

// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF      430.0
#define RNOMINAL  100.0

void setup() {
  Serial.begin(115200);
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");

  thermo53.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
  thermo49.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
  thermo48.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
  thermo47.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
}

void loop()
{
  uint16_t rtd53 = thermo53.readRTD();
  uint16_t rtd49 = thermo49.readRTD();    //********added************
  uint16_t rtd48 = thermo48.readRTD();    //********added************
  uint16_t rtd47 = thermo47.readRTD();    //********added************

  Serial.print("Temperature 53 = "); Serial.println(thermo53.temperature(RNOMINAL, RREF));
  delay(900);
  Serial.print("Temperature 49 = "); Serial.println(thermo49.temperature(RNOMINAL, RREF));
  delay(900);
  Serial.print("Temperature 48 = "); Serial.println(thermo48.temperature(RNOMINAL, RREF));
  delay(900);
  Serial.print("Temperature 47 = "); Serial.println(thermo47.temperature(RNOMINAL, RREF));
  delay(900);
  Serial.println();
  delay(1000);
}`

I thought that command is only for reading the RTD ratio, it has no relevance in reading temperature value.

Your version is ONLY measuring the RTD on pin53!

did you NOT try my version?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.