Interfacing multiple MAX6675 with Arduino Uno

cont.

This is the wiring diagram I have set up currently with two MAX6675 and Arduino Uno, on a breadboard.

I have looked extensively and cannot find the right way to add a second CS pin so I can have two temperature readings from two MAX6675. My very limited understanding of Arduino makes me write the following code.

// this example is public domain. enjoy!
// https://learn.adafruit.com/thermocouple/

#include "max6675.h"

int thermoDO = 12;
int thermoCS1 = 10;
int thermoCS2 = 9;
int thermoCLK = 13;

MAX6675 thermocouple1(thermoCLK, thermoCS1, thermoDO);
MAX6675 thermocouple (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());
 
   // For the MAX6675 to update, you must delay AT LEAST 250ms between reads!
   delay(1000);
}

When I click verify, it throws this error code.
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Uno"

C:\Users\gregm\AppData\Local\Temp\arduino_modified_sketch_471998\serialthermocouple.ino: In function 'void loop()':

serialthermocouple:26:19: error: 'thermocouple' was not declared in this scope

Serial.println(thermocouple.readCelsius());

               ^~~~~~~~~~~~

C:\Users\gregm\AppData\Local\Temp\arduino_modified_sketch_471998\serialthermocouple.ino:26:19: note: suggested alternative: 'thermocouple2'

Serial.println(thermocouple.readCelsius());

               ^~~~~~~~~~~~

               thermocouple2

exit status 1

'thermocouple' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

My question is two fold. Can I interface 2-6 MAX6675's with Ardiuno Uno? If so, What am I doing wrong?

I appreciate any assistance.

1 Like