Interfacing multiple MAX6675 with Arduino Uno

Hi,
I have no coding skills but I need to make or modify a code for Ardiuno Uno or Mega to collect temperature readings from 6 k-type thermocouples with MAX6675. I have managed to make it work with Uno and one MAX6675 using serialthermocouple code by Adafruit, but I can't figure out how to add more to Uno or where to start if I can't use Uno and have to use Mega. I just want the readings to show up on serial monitor when I upload the code.
Any help to get me in the right direction would be greatly appreciated. I've watched Youtube, searched, and scoured forums for hours and I can't figure it out.

1 Like

Start by reading the "How to get the best out of the forum" post, then describe your setup and post the code, using code tags.

The MAX6675 uses the SPI bus, which you can read about in the Arduino reference and other tutorials. You need a separate CE or CS connection for each MAX6675 connected to the bus, and your program will access them one by one.

Thank you for your help, I hope this post is more in line with what you mean.
I just ran it again and got some results. This is the code I used to get the results.

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

#include "max6675.h"

int thermoDO = 12;
int thermoCS = 10;
int thermoCLK = 13;

MAX6675 thermocouple(thermoCLK, thermoCS, 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);
}

This is a picture of the results from this code.

More to follow, I can only post one picture per post it says.

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.

This may be useful: How to Connect Multiple SPI devices to an Arduino Microcontroller

Is it because you have a space after thermocouple and before the bracket?

no, C++ does not care about that. The code compiles just fine as-is for me.

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