Multiple thermocouples

Hello! I would like to read temperatures using two k-type thermocouples. I've got two Max31855 breakout boards and two T-couples. I've installed the Max31855 libraries and have one thermocouple connected and reading temperatures. My question is ... "how do I edit the code to accommodate a second set-up? or do I need to write some code from scratch?"

I will be grateful for a nudge in the right direction.

You need to connect the CS (chip select) pins of your two MAX31855 breakout boards to two separate digital outputs on your Arduino.

In your code, you then determine which breakout board is currently active, by taking that board's CS pin low, whilst the CS for the other board remains high.

Basically you can just duplicate whatever code you already have to read the first thermocouple, but change any reference to the CS pin number to reflect your hardware connection for the second thermocouple.

JohnLincoln:
Basically you can just duplicate whatever code you already have to read the first thermocouple, but change any reference to the CS pin number to reflect your hardware connection for the second thermocouple.

Better than duplicating code would be to put the code in a function to which you pass the CS pin number. That way if you ever have to change the code you don't have to change it in multiple places.

Thanks for the input and direction! Got it to work! Very satisfying. I duplicated the code to verify that I could get it to work, now I will make an attempt at creating a function.

I have 2 new questions:

  1. what exactly does the "Adafruit_MAX31855.h" library do? is it a formula that converts voltages to temps or is it some sort of look-up table.

  2. is there some way I can view the programming code in the library.

Once again... thank you for your help and the nudge I needed. I will

Dave51plus1:

  1. what exactly does the "Adafruit_MAX31855.h" library do? is it a formula that converts voltages to temps or is it some sort of look-up table.

It puts a wrapper around the SPI interface to make the chip easier to use. It reads the temperature from registers in the chip and formats the temperature into an easy-to-use number.

Dave51plus1:
2) is there some way I can view the programming code in the library.

Look in the libraries/Adafruit_MAX31855 folder in the folder containing your sketches. There you will find the library sources. All Arduino libraries are installed as source and re-compiled as needed.

Thanks for the reply. I looked at the library and it helps me understand what is going on behind the scenes