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?