Skip to main content
deleted 122 characters in body; edited title
Source Link
dda
  • 1.6k
  • 1
  • 13
  • 18

multiple Multiple 3 wire spi-wire SPI sensor interfacing with arduinoArduino

I want to connect 4 MAX6675 thermocouple to arduinoArduino. MAX 6675 discriptiondescription.
It

It comes with a its own arduinoArduino library  .  library link.
I

I tested the example code for one sensor and it works perfectly.
Now i Now I want to connect all the four sensors to arduinoArduino using minimum gpioGPIO pins possible  .

I connected - (for 2 sensors only for initial testing)
D7 -> clk(slave 1 ) ->clk (slave 2)
D3 -> so(slave 1 ) ->so (slave 2)
D4 -> cs(slave 1 ) D5 -> cs(slave 2):

D7 -> clk (slave 1) ->clk (slave 2)
D3 -> so (slave 1) ->so (slave 2)
D4 -> cs (slave 1)
D5 -> cs (slave 2)

My code (iI modified the original example code a bit):

// this example is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple

#include "max6675.h"

int thermoCLK = 7;
 
int thermoDO = 3;
int thermoCS = 4;
 
int thermoCS2 = 5;
 
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
MAX6675 thermocouple2(thermoCLK, thermoCS2, thermoDO);

  
void setup() {
  Serial.begin(9600);
  
  Serial.println("MAX6675 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
  
   Serial.print("C = "); 
   Serial.println(thermocouple.readCelsius());
   Serial.print("F = ");
   Serial.println(thermocouple.readFahrenheit());
   Serial.print("C 2= "); 
   Serial.println(thermocouple2.readCelsius());
   Serial.print("F 2= ");
   Serial.println(thermocouple2.readFahrenheit());
 
   delay(1000);
}

I am able to read only one sensor information correctly,other. The other output is nan
Am i. Am I wiring the circuit wrong or is my code is incorrect or both?

multiple 3 wire spi sensor interfacing with arduino

I want to connect 4 MAX6675 thermocouple to arduino. MAX 6675 discription.
It comes with a its own arduino library  .library link.
I tested the example code for one sensor and it works perfectly.
Now i want to connect all the four sensors to arduino using minimum gpio pins possible  .

I connected - (for 2 sensors only for initial testing)
D7 -> clk(slave 1 ) ->clk (slave 2)
D3 -> so(slave 1 ) ->so (slave 2)
D4 -> cs(slave 1 ) D5 -> cs(slave 2)

My code (i modified the original example code a bit)

// this example is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple

#include "max6675.h"

int thermoCLK = 7;
 
int thermoDO = 3;
int thermoCS = 4;
 
int thermoCS2 = 5;
 
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
MAX6675 thermocouple2(thermoCLK, thermoCS2, thermoDO);

  
void setup() {
  Serial.begin(9600);
  
  Serial.println("MAX6675 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
  
   Serial.print("C = "); 
   Serial.println(thermocouple.readCelsius());
   Serial.print("F = ");
   Serial.println(thermocouple.readFahrenheit());
   Serial.print("C 2= "); 
   Serial.println(thermocouple2.readCelsius());
   Serial.print("F 2= ");
   Serial.println(thermocouple2.readFahrenheit());
 
   delay(1000);
}

I am able to read only one sensor information correctly,other output is nan
Am i wiring the circuit wrong or my code is incorrect or both?

Multiple 3-wire SPI sensor interfacing with Arduino

I want to connect 4 MAX6675 thermocouple to Arduino. MAX 6675 description.

It comes with its own Arduino library.  library link.

I tested the example code for one sensor and it works perfectly. Now I want to connect all the four sensors to Arduino using minimum GPIO pins possible.

I connected - (for 2 sensors only for initial testing):

D7 -> clk (slave 1) ->clk (slave 2)
D3 -> so (slave 1) ->so (slave 2)
D4 -> cs (slave 1)
D5 -> cs (slave 2)

My code (I modified the original example code a bit):

// this example is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple

#include "max6675.h"

int thermoCLK = 7;
int thermoDO = 3;
int thermoCS = 4;
int thermoCS2 = 5;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
MAX6675 thermocouple2(thermoCLK, thermoCS2, thermoDO);

void setup() {
  Serial.begin(9600);
  Serial.println("MAX6675 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
  Serial.print("C = ");
  Serial.println(thermocouple.readCelsius());
  Serial.print("F = ");
  Serial.println(thermocouple.readFahrenheit());
  Serial.print("C 2= ");
  Serial.println(thermocouple2.readCelsius());
  Serial.print("F 2= ");
  Serial.println(thermocouple2.readFahrenheit());
  delay(1000);
}

I am able to read only one sensor information correctly. The other output is nan. Am I wiring the circuit wrong or is my code incorrect or both?

Post Migrated Here from electronics.stackexchange.com (revisions)
Source Link

multiple 3 wire spi sensor interfacing with arduino

I want to connect 4 MAX6675 thermocouple to arduino. MAX 6675 discription.
It comes with a its own arduino library .library link.
I tested the example code for one sensor and it works perfectly.
Now i want to connect all the four sensors to arduino using minimum gpio pins possible .

I connected - (for 2 sensors only for initial testing)
D7 -> clk(slave 1 ) ->clk (slave 2)
D3 -> so(slave 1 ) ->so (slave 2)
D4 -> cs(slave 1 ) D5 -> cs(slave 2)

My code (i modified the original example code a bit)

// this example is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple

#include "max6675.h"

int thermoCLK = 7;

int thermoDO = 3;
int thermoCS = 4;

int thermoCS2 = 5;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
MAX6675 thermocouple2(thermoCLK, thermoCS2, thermoDO);

  
void setup() {
  Serial.begin(9600);
  
  Serial.println("MAX6675 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
  
   Serial.print("C = "); 
   Serial.println(thermocouple.readCelsius());
   Serial.print("F = ");
   Serial.println(thermocouple.readFahrenheit());
   Serial.print("C 2= "); 
   Serial.println(thermocouple2.readCelsius());
   Serial.print("F 2= ");
   Serial.println(thermocouple2.readFahrenheit());
 
   delay(1000);
}

I am able to read only one sensor information correctly,other output is nan
Am i wiring the circuit wrong or my code is incorrect or both?